diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-10-11 19:14:02 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-10-11 19:14:02 +0000 |
commit | c4be951ddc193cd4dc550dc6b12436dcbaee4dc9 (patch) | |
tree | 1f43f9cbcf6146ab7a1f4ed6ae34c6598d8d49d2 | |
parent | da3d79642444858ccbd55ce1fa5aa5aa25f4bba2 (diff) | |
download | external_llvm-c4be951ddc193cd4dc550dc6b12436dcbaee4dc9.zip external_llvm-c4be951ddc193cd4dc550dc6b12436dcbaee4dc9.tar.gz external_llvm-c4be951ddc193cd4dc550dc6b12436dcbaee4dc9.tar.bz2 |
Implement proper asmprinting for the globals. This eliminates bogus "call" modifier and also adds support for offsets wrt globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83784 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp | 22 | ||||
-rw-r--r-- | lib/Target/MSP430/MSP430InstrInfo.td | 2 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp index 0f70e48..852019f 100644 --- a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp @@ -149,7 +149,7 @@ void MSP430AsmPrinter::printMachineInstruction(const MachineInstr *MI) { // Call the autogenerated instruction printer routines. printInstruction(MI); - + if (VerboseAsm && !MI->getDebugLoc().isUnknown()) EmitComments(*MI); O << '\n'; @@ -174,26 +174,26 @@ void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum, return; case MachineOperand::MO_GlobalAddress: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); - bool isCallOp = Modifier && !strcmp(Modifier, "call"); std::string Name = Mang->getMangledName(MO.getGlobal()); - assert(MO.getOffset() == 0 && "No offsets allowed!"); + uint64_t Offset = MO.getOffset(); - if (isCallOp) - O << '#'; - else if (isMemOp) - O << '&'; + O << (isMemOp ? '&' : '#'); + if (Offset) + O << '(' << Offset << '+'; O << Name; + if (Offset) + O << ')'; return; } case MachineOperand::MO_ExternalSymbol: { - bool isCallOp = Modifier && !strcmp(Modifier, "call"); + bool isMemOp = Modifier && !strcmp(Modifier, "mem"); std::string Name(MAI->getGlobalPrefix()); Name += MO.getSymbolName(); - if (isCallOp) - O << '#'; - O << Name; + + O << (isMemOp ? '&' : '#') << Name; + return; } default: diff --git a/lib/Target/MSP430/MSP430InstrInfo.td b/lib/Target/MSP430/MSP430InstrInfo.td index ced612e..37a9492 100644 --- a/lib/Target/MSP430/MSP430InstrInfo.td +++ b/lib/Target/MSP430/MSP430InstrInfo.td @@ -155,7 +155,7 @@ let isCall = 1 in let Defs = [R12W, R13W, R14W, R15W, SRW], Uses = [SPW] in { def CALLi : Pseudo<(outs), (ins i16imm:$dst, variable_ops), - "call\t${dst:call}", [(MSP430call imm:$dst)]>; + "call\t$dst", [(MSP430call imm:$dst)]>; def CALLr : Pseudo<(outs), (ins GR16:$dst, variable_ops), "call\t$dst", [(MSP430call GR16:$dst)]>; def CALLm : Pseudo<(outs), (ins memsrc:$dst, variable_ops), |