summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-15 19:21:31 +0000
committerChris Lattner <sabre@nondot.org>2001-10-15 19:21:31 +0000
commit77d2c22d94cf293a8f8a62e4abd46fe3b3288e71 (patch)
tree5987edd26a0276e6e92fc640c1a6269322d39759
parent67beacef4f4c8a6f440bb588e2fcaf7771bebc3e (diff)
downloadbcm5719-llvm-77d2c22d94cf293a8f8a62e4abd46fe3b3288e71.tar.gz
bcm5719-llvm-77d2c22d94cf293a8f8a62e4abd46fe3b3288e71.zip
Handle abnormal jmpl syntax correctly
llvm-svn: 844
-rw-r--r--llvm/lib/Target/Sparc/EmitAssembly.cpp85
1 files changed, 50 insertions, 35 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp
index 7a200e06de7..6aa5a21c12f 100644
--- a/llvm/lib/Target/Sparc/EmitAssembly.cpp
+++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp
@@ -46,10 +46,8 @@ private :
//void processMethodArgument(const MethodArgument *MA);
void emitBasicBlock(const BasicBlock *BB);
void emitMachineInst(const MachineInstr *MI);
-
+ void printOperand(const MachineOperand &Op);
- //void writeOperand(const Value *Op, bool PrintType, bool PrintName = true);
-
// enterSection - Use this method to enter a different section of the output
// executable. This is used to only output neccesary section transitions.
@@ -120,6 +118,41 @@ private :
};
+void SparcAsmPrinter::printOperand(const MachineOperand &Op) {
+ switch (Op.getOperandType()) {
+ case MachineOperand::MO_VirtualRegister:
+ case MachineOperand::MO_CCRegister:
+ case MachineOperand::MO_MachineRegister: {
+ int RegNum = (int)Op.getAllocatedRegNum();
+
+ // ****this code is temporary till NULL Values are fixed
+ if (RegNum == 10000) {
+ Out << "<NULL VALUE>";
+ } else {
+ Out << "%" << Target.getRegInfo().getUnifiedRegName(RegNum);
+ }
+ break;
+ }
+
+ case MachineOperand::MO_PCRelativeDisp: {
+ const Value *Val = Op.getVRegValue();
+ if (!Val) {
+ Out << "\t<*NULL Value*>";
+ } else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val)) {
+ Out << getID(BB);
+ } else {
+ Out << "<unknown value=" << Val << ">";
+ }
+ break;
+ }
+
+ default:
+ Out << Op; // use dump field
+ break;
+ }
+}
+
+
void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
unsigned Opcode = MI->getOpCode();
@@ -128,6 +161,19 @@ void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
Out << "\t" << TargetInstrDescriptors[Opcode].opCodeString << "\t";
+ switch (Opcode) { // Some opcodes have special syntax...
+ case JMPL:
+ assert(MI->getNumOperands() == 3 && "Unexpected JMPL instr!");
+ printOperand(MI->getOperand(0));
+ Out << "+";
+ printOperand(MI->getOperand(0));
+ Out << ", ";
+ printOperand(MI->getOperand(0));
+ Out << endl;
+ return;
+ default: break;
+ }
+
unsigned Mask = getOperandMask(Opcode);
bool NeedComma = false;
@@ -138,38 +184,7 @@ void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
if (NeedComma) Out << ", "; // Handle comma outputing
NeedComma = true;
- switch (Op.getOperandType()) {
- case MachineOperand::MO_VirtualRegister:
- case MachineOperand::MO_CCRegister:
- case MachineOperand::MO_MachineRegister: {
- int RegNum = (int)Op.getAllocatedRegNum();
-
- // ****this code is temporary till NULL Values are fixed
- if (RegNum == 10000) {
- Out << "<NULL VALUE>";
- continue;
- }
-
- Out << "%" << Target.getRegInfo().getUnifiedRegName(RegNum);
- break;
- }
-
- case MachineOperand::MO_PCRelativeDisp: {
- const Value *Val = Op.getVRegValue();
- if (!Val) {
- Out << "\t<*NULL Value*>";
- } else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val)) {
- Out << getID(BB);
- } else {
- Out << "<unknown value=" << Val << ">";
- }
- break;
- }
-
- default:
- Out << Op; // use dump field
- break;
- }
+ printOperand(Op);
}
Out << endl;
}
OpenPOWER on IntegriCloud