Handle abnormal jmpl syntax correctly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-15 19:21:31 +00:00
parent 7b851abd85
commit c28f6d6258

View File

@ -46,9 +46,7 @@ private :
//void processMethodArgument(const MethodArgument *MA);
void emitBasicBlock(const BasicBlock *BB);
void emitMachineInst(const MachineInstr *MI);
//void writeOperand(const Value *Op, bool PrintType, bool PrintName = true);
void printOperand(const MachineOperand &Op);
// enterSection - Use this method to enter a different section of the output
@ -120,24 +118,7 @@ private :
};
void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
unsigned Opcode = MI->getOpCode();
if (TargetInstrDescriptors[Opcode].iclass & M_DUMMY_PHI_FLAG)
return; // IGNORE PHI NODES
Out << "\t" << TargetInstrDescriptors[Opcode].opCodeString << "\t";
unsigned Mask = getOperandMask(Opcode);
bool NeedComma = false;
for(unsigned OpNum = 0; OpNum < MI->getNumOperands(); ++OpNum) {
if ((1 << OpNum) & Mask) continue; // Ignore this operand?
const MachineOperand &Op = MI->getOperand(OpNum);
if (NeedComma) Out << ", "; // Handle comma outputing
NeedComma = true;
void SparcAsmPrinter::printOperand(const MachineOperand &Op) {
switch (Op.getOperandType()) {
case MachineOperand::MO_VirtualRegister:
case MachineOperand::MO_CCRegister:
@ -147,10 +128,9 @@ void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
// ****this code is temporary till NULL Values are fixed
if (RegNum == 10000) {
Out << "<NULL VALUE>";
continue;
}
} else {
Out << "%" << Target.getRegInfo().getUnifiedRegName(RegNum);
}
break;
}
@ -170,6 +150,41 @@ void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
Out << Op; // use dump field
break;
}
}
void SparcAsmPrinter::emitMachineInst(const MachineInstr *MI) {
unsigned Opcode = MI->getOpCode();
if (TargetInstrDescriptors[Opcode].iclass & M_DUMMY_PHI_FLAG)
return; // IGNORE PHI NODES
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;
for(unsigned OpNum = 0; OpNum < MI->getNumOperands(); ++OpNum) {
if ((1 << OpNum) & Mask) continue; // Ignore this operand?
const MachineOperand &Op = MI->getOperand(OpNum);
if (NeedComma) Out << ", "; // Handle comma outputing
NeedComma = true;
printOperand(Op);
}
Out << endl;
}