Add support for FP cmoves

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12575 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-03-31 22:02:21 +00:00
parent 1c54a85447
commit 30b2f72e7c
2 changed files with 56 additions and 20 deletions

View File

@ -104,7 +104,8 @@ namespace {
return "X86 Assembly Printer"; return "X86 Assembly Printer";
} }
void checkImplUses (const TargetInstrDescriptor &Desc); void printImplUsesBefore(const TargetInstrDescriptor &Desc);
void printImplUsesAfter(const TargetInstrDescriptor &Desc);
void printMachineInstruction(const MachineInstr *MI); void printMachineInstruction(const MachineInstr *MI);
void printOp(const MachineOperand &MO, void printOp(const MachineOperand &MO,
bool elideOffsetKeyword = false); bool elideOffsetKeyword = false);
@ -528,12 +529,26 @@ void Printer::printMemReference(const MachineInstr *MI, unsigned Op) {
O << "]"; O << "]";
} }
/// checkImplUses - Emit the implicit-use registers for the
/// instruction described by DESC, if its PrintImplUses flag is set. /// printImplUsesBefore - Emit the implicit-use registers for the instruction
/// described by DESC, if its PrintImplUsesBefore flag is set.
/// ///
void Printer::checkImplUses (const TargetInstrDescriptor &Desc) { void Printer::printImplUsesBefore(const TargetInstrDescriptor &Desc) {
const MRegisterInfo &RI = *TM.getRegisterInfo(); const MRegisterInfo &RI = *TM.getRegisterInfo();
if (Desc.TSFlags & X86II::PrintImplUses) { if (Desc.TSFlags & X86II::PrintImplUsesBefore) {
for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
// Bug Workaround: See note in Printer::doInitialization about %.
O << "%" << RI.get(*p).Name << ", ";
}
}
}
/// printImplUsesAfter - Emit the implicit-use registers for the instruction
/// described by DESC, if its PrintImplUsesAfter flag is set.
///
void Printer::printImplUsesAfter(const TargetInstrDescriptor &Desc) {
const MRegisterInfo &RI = *TM.getRegisterInfo();
if (Desc.TSFlags & X86II::PrintImplUsesAfter) {
for (const unsigned *p = Desc.ImplicitUses; *p; ++p) { for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
// Bug Workaround: See note in Printer::doInitialization about %. // Bug Workaround: See note in Printer::doInitialization about %.
O << ", %" << RI.get(*p).Name; O << ", %" << RI.get(*p).Name;
@ -628,6 +643,9 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
unsigned Reg = MI->getOperand(0).getReg(); unsigned Reg = MI->getOperand(0).getReg();
O << TII.getName(MI->getOpcode()) << " "; O << TII.getName(MI->getOpcode()) << " ";
printImplUsesBefore(Desc); // fcmov*
printOp(MI->getOperand(0)); printOp(MI->getOperand(0));
if (MI->getNumOperands() == 2 && if (MI->getNumOperands() == 2 &&
(!MI->getOperand(1).isRegister() || (!MI->getOperand(1).isRegister() ||
@ -637,7 +655,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(1)); printOp(MI->getOperand(1));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }
@ -668,7 +686,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(2)); printOp(MI->getOperand(2));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }
@ -690,7 +708,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(5)); printOp(MI->getOperand(5));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }
@ -778,7 +796,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(MI->getNumOperands()-1)); printOp(MI->getOperand(MI->getNumOperands()-1));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
@ -841,7 +859,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(4)); printOp(MI->getOperand(4));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }

View File

@ -104,7 +104,8 @@ namespace {
return "X86 Assembly Printer"; return "X86 Assembly Printer";
} }
void checkImplUses (const TargetInstrDescriptor &Desc); void printImplUsesBefore(const TargetInstrDescriptor &Desc);
void printImplUsesAfter(const TargetInstrDescriptor &Desc);
void printMachineInstruction(const MachineInstr *MI); void printMachineInstruction(const MachineInstr *MI);
void printOp(const MachineOperand &MO, void printOp(const MachineOperand &MO,
bool elideOffsetKeyword = false); bool elideOffsetKeyword = false);
@ -528,12 +529,26 @@ void Printer::printMemReference(const MachineInstr *MI, unsigned Op) {
O << "]"; O << "]";
} }
/// checkImplUses - Emit the implicit-use registers for the
/// instruction described by DESC, if its PrintImplUses flag is set. /// printImplUsesBefore - Emit the implicit-use registers for the instruction
/// described by DESC, if its PrintImplUsesBefore flag is set.
/// ///
void Printer::checkImplUses (const TargetInstrDescriptor &Desc) { void Printer::printImplUsesBefore(const TargetInstrDescriptor &Desc) {
const MRegisterInfo &RI = *TM.getRegisterInfo(); const MRegisterInfo &RI = *TM.getRegisterInfo();
if (Desc.TSFlags & X86II::PrintImplUses) { if (Desc.TSFlags & X86II::PrintImplUsesBefore) {
for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
// Bug Workaround: See note in Printer::doInitialization about %.
O << "%" << RI.get(*p).Name << ", ";
}
}
}
/// printImplUsesAfter - Emit the implicit-use registers for the instruction
/// described by DESC, if its PrintImplUsesAfter flag is set.
///
void Printer::printImplUsesAfter(const TargetInstrDescriptor &Desc) {
const MRegisterInfo &RI = *TM.getRegisterInfo();
if (Desc.TSFlags & X86II::PrintImplUsesAfter) {
for (const unsigned *p = Desc.ImplicitUses; *p; ++p) { for (const unsigned *p = Desc.ImplicitUses; *p; ++p) {
// Bug Workaround: See note in Printer::doInitialization about %. // Bug Workaround: See note in Printer::doInitialization about %.
O << ", %" << RI.get(*p).Name; O << ", %" << RI.get(*p).Name;
@ -628,6 +643,9 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
unsigned Reg = MI->getOperand(0).getReg(); unsigned Reg = MI->getOperand(0).getReg();
O << TII.getName(MI->getOpcode()) << " "; O << TII.getName(MI->getOpcode()) << " ";
printImplUsesBefore(Desc); // fcmov*
printOp(MI->getOperand(0)); printOp(MI->getOperand(0));
if (MI->getNumOperands() == 2 && if (MI->getNumOperands() == 2 &&
(!MI->getOperand(1).isRegister() || (!MI->getOperand(1).isRegister() ||
@ -637,7 +655,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(1)); printOp(MI->getOperand(1));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }
@ -668,7 +686,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(2)); printOp(MI->getOperand(2));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }
@ -690,7 +708,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(5)); printOp(MI->getOperand(5));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }
@ -778,7 +796,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(MI->getNumOperands()-1)); printOp(MI->getOperand(MI->getNumOperands()-1));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
@ -841,7 +859,7 @@ void Printer::printMachineInstruction(const MachineInstr *MI) {
O << ", "; O << ", ";
printOp(MI->getOperand(4)); printOp(MI->getOperand(4));
} }
checkImplUses(Desc); printImplUsesAfter(Desc);
O << "\n"; O << "\n";
return; return;
} }