diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:02:04 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2009-05-03 13:02:04 +0000 |
commit | 1df221f2bb8e8380e255d1bec73ab07b388d01a2 (patch) | |
tree | 25feae768943a171215f858d0786a4c95c52cc15 /lib/Target/MSP430/MSP430AsmPrinter.cpp | |
parent | 09c42f509a10e1725f52ebac36d38deee194b526 (diff) | |
download | llvm-1df221f2bb8e8380e255d1bec73ab07b388d01a2.tar.gz llvm-1df221f2bb8e8380e255d1bec73ab07b388d01a2.tar.bz2 llvm-1df221f2bb8e8380e255d1bec73ab07b388d01a2.tar.xz |
Add code enough for emission of reg-reg and reg-imm moves. This allows us to compile "ret i16 0" properly!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSP430/MSP430AsmPrinter.cpp')
-rw-r--r-- | lib/Target/MSP430/MSP430AsmPrinter.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/Target/MSP430/MSP430AsmPrinter.cpp b/lib/Target/MSP430/MSP430AsmPrinter.cpp index 6b0f5100c3..e8004a7d1b 100644 --- a/lib/Target/MSP430/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/MSP430AsmPrinter.cpp @@ -47,6 +47,7 @@ namespace { return "MSP430 Assembly Printer"; } + void printOperand(const MachineInstr *MI, int OpNum); bool printInstruction(const MachineInstr *MI); // autogenerated. void printMachineInstruction(const MachineInstr * MI); bool runOnMachineFunction(MachineFunction &F); @@ -108,7 +109,7 @@ bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) { return false; } -void MSP430AsmPrinter::printMachineInstruction(const MachineInstr * MI) { +void MSP430AsmPrinter::printMachineInstruction(const MachineInstr *MI) { ++EmittedInsts; // Call the autogenerated instruction printer routines. @@ -117,3 +118,23 @@ void MSP430AsmPrinter::printMachineInstruction(const MachineInstr * MI) { assert(0 && "Should not happen"); } + +void MSP430AsmPrinter::printOperand(const MachineInstr *MI, int OpNum) { + const MachineOperand &MO = MI->getOperand(OpNum); + switch (MO.getType()) { + case MachineOperand::MO_Register: + if (TargetRegisterInfo::isPhysicalRegister(MO.getReg())) + O << TM.getRegisterInfo()->get(MO.getReg()).AsmName; + else + assert(0 && "not implemented"); + break; + case MachineOperand::MO_Immediate: + O << "#" << MO.getImm(); + break; + case MachineOperand::MO_MachineBasicBlock: + printBasicBlockLabel(MO.getMBB()); + break; + default: + assert(0 && "Not implemented yet!"); + } +} |