mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-29 22:52:18 +00:00
wire up some basic printOperand goodness, giving us stuff like this before
we abort: _main: stm , mov r7, sp sub sp, sp, mov r0, str r0, git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9cf0eb5e58
commit
8bc86cba60
@ -310,25 +310,25 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
||||
const char *Modifier) {
|
||||
const MachineOperand &MO = MI->getOperand(OpNum);
|
||||
switch (MO.getType()) {
|
||||
default:
|
||||
assert(0 && "<unknown operand type>");
|
||||
case MachineOperand::MO_Register: {
|
||||
unsigned Reg = MO.getReg();
|
||||
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {
|
||||
if (Modifier && strcmp(Modifier, "dregpair") == 0) {
|
||||
unsigned DRegLo = TRI->getSubReg(Reg, 5); // arm_dsubreg_0
|
||||
unsigned DRegHi = TRI->getSubReg(Reg, 6); // arm_dsubreg_1
|
||||
O << '{'
|
||||
<< getRegisterName(DRegLo) << ',' << getRegisterName(DRegHi)
|
||||
<< '}';
|
||||
} else if (Modifier && strcmp(Modifier, "lane") == 0) {
|
||||
unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(Reg);
|
||||
unsigned DReg = TRI->getMatchingSuperReg(Reg, RegNum & 1 ? 2 : 1,
|
||||
&ARM::DPR_VFP2RegClass);
|
||||
O << getRegisterName(DReg) << '[' << (RegNum & 1) << ']';
|
||||
} else {
|
||||
O << getRegisterName(Reg);
|
||||
}
|
||||
} else
|
||||
llvm_unreachable("not implemented");
|
||||
assert(TargetRegisterInfo::isPhysicalRegister(Reg));
|
||||
if (Modifier && strcmp(Modifier, "dregpair") == 0) {
|
||||
unsigned DRegLo = TRI->getSubReg(Reg, 5); // arm_dsubreg_0
|
||||
unsigned DRegHi = TRI->getSubReg(Reg, 6); // arm_dsubreg_1
|
||||
O << '{'
|
||||
<< getRegisterName(DRegLo) << ',' << getRegisterName(DRegHi)
|
||||
<< '}';
|
||||
} else if (Modifier && strcmp(Modifier, "lane") == 0) {
|
||||
unsigned RegNum = ARMRegisterInfo::getRegisterNumbering(Reg);
|
||||
unsigned DReg = TRI->getMatchingSuperReg(Reg, RegNum & 1 ? 2 : 1,
|
||||
&ARM::DPR_VFP2RegClass);
|
||||
O << getRegisterName(DReg) << '[' << (RegNum & 1) << ']';
|
||||
} else {
|
||||
O << getRegisterName(Reg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MachineOperand::MO_Immediate: {
|
||||
@ -376,8 +376,6 @@ void ARMAsmPrinter::printOperand(const MachineInstr *MI, int OpNum,
|
||||
O << MAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
||||
<< '_' << MO.getIndex();
|
||||
break;
|
||||
default:
|
||||
O << "<unknown operand type>"; abort (); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,3 +31,19 @@ using namespace llvm;
|
||||
|
||||
void ARMInstPrinter::printInst(const MCInst *MI) { printInstruction(MI); }
|
||||
|
||||
void ARMInstPrinter::printOperand(const MCInst *MI, unsigned OpNo,
|
||||
const char *Modifier) {
|
||||
assert((Modifier == 0 || Modifier[0] == 0) && "Cannot print modifiers");
|
||||
|
||||
const MCOperand &Op = MI->getOperand(OpNo);
|
||||
if (Op.isReg()) {
|
||||
O << getRegisterName(Op.getReg());
|
||||
} else if (Op.isImm()) {
|
||||
O << '#' << Op.getImm();
|
||||
} else {
|
||||
assert(Op.isExpr() && "unknown operand kind in printOperand");
|
||||
assert(0 && "UNIMP");
|
||||
//O << '$';
|
||||
//Op.getExpr()->print(O, &MAI);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
|
||||
|
||||
void printOperand(const MCInst *MI, unsigned OpNo,
|
||||
const char *Modifier = 0) {}
|
||||
const char *Modifier = 0);
|
||||
|
||||
void printSOImmOperand(const MCInst *MI, unsigned OpNum) {}
|
||||
void printSOImm2PartOperand(const MCInst *MI, unsigned OpNum) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user