diff options
author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-07-10 21:41:21 +0000 |
---|---|---|
committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2002-07-10 21:41:21 +0000 |
commit | 195a5d50935e89e7de8876467e8f5ff7393cb3c3 (patch) | |
tree | 5503d482b2a34fdddaec535c9adc3dbff017f778 /lib/Target | |
parent | 53fd400cdf226e3b3856aee1bd9b300b6670d93c (diff) | |
download | external_llvm-195a5d50935e89e7de8876467e8f5ff7393cb3c3.zip external_llvm-195a5d50935e89e7de8876467e8f5ff7393cb3c3.tar.gz external_llvm-195a5d50935e89e7de8876467e8f5ff7393cb3c3.tar.bz2 |
Add support to print %hh, %hm, %lm, or %lo in an operand field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2857 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r-- | lib/Target/SparcV9/SparcV9AsmPrinter.cpp | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp index 881a67e..940b722 100644 --- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp +++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp @@ -259,47 +259,60 @@ SparcFunctionAsmPrinter::OpIsMemoryAddressBase(const MachineInstr *MI, } -#define PrintOp1PlusOp2(Op1, Op2) \ - printOneOperand(Op1); \ +#define PrintOp1PlusOp2(mop1, mop2) \ + printOneOperand(mop1); \ toAsm << "+"; \ - printOneOperand(Op2); + printOneOperand(mop2); unsigned int SparcFunctionAsmPrinter::printOperands(const MachineInstr *MI, unsigned int opNum) { - const MachineOperand& Op = MI->getOperand(opNum); + const MachineOperand& mop = MI->getOperand(opNum); if (OpIsBranchTargetLabel(MI, opNum)) { - PrintOp1PlusOp2(Op, MI->getOperand(opNum+1)); + PrintOp1PlusOp2(mop, MI->getOperand(opNum+1)); return 2; } else if (OpIsMemoryAddressBase(MI, opNum)) { toAsm << "["; - PrintOp1PlusOp2(Op, MI->getOperand(opNum+1)); + PrintOp1PlusOp2(mop, MI->getOperand(opNum+1)); toAsm << "]"; return 2; } else { - printOneOperand(Op); + printOneOperand(mop); return 1; } } void -SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &op) +SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &mop) { - switch (op.getOperandType()) + bool needBitsFlag = true; + + if (mop.opHiBits32()) + toAsm << "%lm("; + else if (mop.opLoBits32()) + toAsm << "%lo("; + else if (mop.opHiBits64()) + toAsm << "%hh("; + else if (mop.opLoBits64()) + toAsm << "%hm("; + else + needBitsFlag = false; + + switch (mop.getOperandType()) { case MachineOperand::MO_VirtualRegister: case MachineOperand::MO_CCRegister: case MachineOperand::MO_MachineRegister: { - int RegNum = (int)op.getAllocatedRegNum(); + int RegNum = (int)mop.getAllocatedRegNum(); // better to print code with NULL registers than to die if (RegNum == Target.getRegInfo().getInvalidRegNum()) { @@ -312,7 +325,7 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &op) case MachineOperand::MO_PCRelativeDisp: { - const Value *Val = op.getVRegValue(); + const Value *Val = mop.getVRegValue(); assert(Val && "\tNULL Value in SparcFunctionAsmPrinter"); if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val)) @@ -329,17 +342,20 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &op) } case MachineOperand::MO_SignExtendedImmed: - toAsm << op.getImmedValue(); + toAsm << mop.getImmedValue(); break; case MachineOperand::MO_UnextendedImmed: - toAsm << (uint64_t) op.getImmedValue(); + toAsm << (uint64_t) mop.getImmedValue(); break; default: - toAsm << op; // use dump field + toAsm << mop; // use dump field break; } + + if (needBitsFlag) + toAsm << ")"; } |