[llvm-commits] [llvm] r83784 - in /llvm/trunk/lib/Target/MSP430: AsmPrinter/MSP430AsmPrinter.cpp MSP430InstrInfo.td
Anton Korobeynikov
asl at math.spbu.ru
Sun Oct 11 12:14:02 PDT 2009
Author: asl
Date: Sun Oct 11 14:14:02 2009
New Revision: 83784
URL: http://llvm.org/viewvc/llvm-project?rev=83784&view=rev
Log:
Implement proper asmprinting for the globals. This eliminates bogus "call" modifier and also adds support for offsets wrt globals.
Modified:
llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td
Modified: llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp?rev=83784&r1=83783&r2=83784&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp Sun Oct 11 14:14:02 2009
@@ -149,7 +149,7 @@
// Call the autogenerated instruction printer routines.
printInstruction(MI);
-
+
if (VerboseAsm && !MI->getDebugLoc().isUnknown())
EmitComments(*MI);
O << '\n';
@@ -174,26 +174,26 @@
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:
Modified: llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td?rev=83784&r1=83783&r2=83784&view=diff
==============================================================================
--- llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td (original)
+++ llvm/trunk/lib/Target/MSP430/MSP430InstrInfo.td Sun Oct 11 14:14:02 2009
@@ -155,7 +155,7 @@
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),
More information about the llvm-commits
mailing list