Use the predicate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29322 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Laskey
2006-07-27 02:05:13 +00:00
parent cc8414ffdb
commit ea348585c8
3 changed files with 15 additions and 15 deletions

View File

@@ -26,7 +26,7 @@ using namespace llvm;
/// method to print assembly for each instruction. /// method to print assembly for each instruction.
/// ///
bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
// Let PassManager know we need debug information and relay // Let PassManager know we need debug information and relay
// the MachineDebugInfo address on to DwarfWriter. // the MachineDebugInfo address on to DwarfWriter.
DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>()); DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
@@ -56,7 +56,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
break; break;
case Function::WeakLinkage: case Function::WeakLinkage:
case Function::LinkOnceLinkage: case Function::LinkOnceLinkage:
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
SwitchToTextSection( SwitchToTextSection(
".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F); ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F);
O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.globl\t" << CurrentFnName << "\n";
@@ -78,7 +78,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
} }
O << CurrentFnName << ":\n"; O << CurrentFnName << ":\n";
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
// Emit pre-function debug information. // Emit pre-function debug information.
DW.BeginFunction(&MF); DW.BeginFunction(&MF);
} }
@@ -101,7 +101,7 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (HasDotTypeDotSizeDirective) if (HasDotTypeDotSizeDirective)
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n"; O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
// Emit post-function debug information. // Emit post-function debug information.
DW.EndFunction(); DW.EndFunction();
} }
@@ -143,7 +143,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
if (!isMemOp) O << '$'; if (!isMemOp) O << '$';
O << PrivateGlobalPrefix << "JTI" << getFunctionNumber() << "_" O << PrivateGlobalPrefix << "JTI" << getFunctionNumber() << "_"
<< MO.getJumpTableIndex(); << MO.getJumpTableIndex();
if (Subtarget->TargetType == X86Subtarget::isDarwin && if (Subtarget->isTargetDarwin() &&
TM.getRelocationModel() == Reloc::PIC_) TM.getRelocationModel() == Reloc::PIC_)
O << "-\"L" << getFunctionNumber() << "$pb\""; O << "-\"L" << getFunctionNumber() << "$pb\"";
return; return;
@@ -153,7 +153,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
if (!isMemOp) O << '$'; if (!isMemOp) O << '$';
O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_" O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
<< MO.getConstantPoolIndex(); << MO.getConstantPoolIndex();
if (Subtarget->TargetType == X86Subtarget::isDarwin && if (Subtarget->isTargetDarwin() &&
TM.getRelocationModel() == Reloc::PIC_) TM.getRelocationModel() == Reloc::PIC_)
O << "-\"L" << getFunctionNumber() << "$pb\""; O << "-\"L" << getFunctionNumber() << "$pb\"";
int Offset = MO.getOffset(); int Offset = MO.getOffset();
@@ -168,7 +168,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
bool isMemOp = Modifier && !strcmp(Modifier, "mem"); bool isMemOp = Modifier && !strcmp(Modifier, "mem");
if (!isMemOp && !isCallOp) O << '$'; if (!isMemOp && !isCallOp) O << '$';
// Darwin block shameless ripped from PPCAsmPrinter.cpp // Darwin block shameless ripped from PPCAsmPrinter.cpp
if (Subtarget->TargetType == X86Subtarget::isDarwin && if (Subtarget->isTargetDarwin() &&
TM.getRelocationModel() != Reloc::Static) { TM.getRelocationModel() != Reloc::Static) {
GlobalValue *GV = MO.getGlobal(); GlobalValue *GV = MO.getGlobal();
std::string Name = Mang->getValueName(GV); std::string Name = Mang->getValueName(GV);
@@ -201,7 +201,7 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
case MachineOperand::MO_ExternalSymbol: { case MachineOperand::MO_ExternalSymbol: {
bool isCallOp = Modifier && !strcmp(Modifier, "call"); bool isCallOp = Modifier && !strcmp(Modifier, "call");
if (isCallOp && if (isCallOp &&
Subtarget->TargetType == X86Subtarget::isDarwin && Subtarget->isTargetDarwin() &&
TM.getRelocationModel() != Reloc::Static) { TM.getRelocationModel() != Reloc::Static) {
std::string Name(GlobalPrefix); std::string Name(GlobalPrefix);
Name += MO.getSymbolName(); Name += MO.getSymbolName();
@@ -344,7 +344,7 @@ bool X86ATTAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) { void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
++EmittedInsts; ++EmittedInsts;
// This works around some Darwin assembler bugs. // This works around some Darwin assembler bugs.
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
switch (MI->getOpcode()) { switch (MI->getOpcode()) {
case X86::REP_MOVSB: case X86::REP_MOVSB:
O << "rep/movsb (%esi),(%edi)\n"; O << "rep/movsb (%esi),(%edi)\n";

View File

@@ -87,7 +87,7 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) {
default: break; default: break;
} }
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
// Emit initial debug information. // Emit initial debug information.
DW.BeginModule(&M); DW.BeginModule(&M);
} }
@@ -118,7 +118,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
if (C->isNullValue() && /* FIXME: Verify correct */ if (C->isNullValue() && /* FIXME: Verify correct */
(I->hasInternalLinkage() || I->hasWeakLinkage() || (I->hasInternalLinkage() || I->hasWeakLinkage() ||
I->hasLinkOnceLinkage() || I->hasLinkOnceLinkage() ||
(Subtarget->TargetType == X86Subtarget::isDarwin && (Subtarget->isTargetDarwin() &&
I->hasExternalLinkage() && !I->hasSection()))) { I->hasExternalLinkage() && !I->hasSection()))) {
if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it.
if (I->hasExternalLinkage()) { if (I->hasExternalLinkage()) {
@@ -130,7 +130,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
if (LCOMMDirective != NULL) { if (LCOMMDirective != NULL) {
if (I->hasInternalLinkage()) { if (I->hasInternalLinkage()) {
O << LCOMMDirective << name << "," << Size; O << LCOMMDirective << name << "," << Size;
if (Subtarget->TargetType == X86Subtarget::isDarwin) if (Subtarget->isTargetDarwin())
O << "," << (AlignmentIsInBytes ? (1 << Align) : Align); O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
} else } else
O << COMMDirective << name << "," << Size; O << COMMDirective << name << "," << Size;
@@ -149,7 +149,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
switch (I->getLinkage()) { switch (I->getLinkage()) {
case GlobalValue::LinkOnceLinkage: case GlobalValue::LinkOnceLinkage:
case GlobalValue::WeakLinkage: case GlobalValue::WeakLinkage:
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
O << "\t.globl " << name << "\n" O << "\t.globl " << name << "\n"
<< "\t.weak_definition " << name << "\n"; << "\t.weak_definition " << name << "\n";
SwitchToDataSection(".section __DATA,__const_coal,coalesced", I); SwitchToDataSection(".section __DATA,__const_coal,coalesced", I);
@@ -186,7 +186,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
} }
} }
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
SwitchToDataSection("", 0); SwitchToDataSection("", 0);
// Output stubs for dynamically-linked functions // Output stubs for dynamically-linked functions

View File

@@ -64,7 +64,7 @@ struct X86SharedAsmPrinter : public AsmPrinter {
void getAnalysisUsage(AnalysisUsage &AU) const { void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll(); AU.setPreservesAll();
if (Subtarget->TargetType == X86Subtarget::isDarwin) { if (Subtarget->isTargetDarwin()) {
AU.addRequired<MachineDebugInfo>(); AU.addRequired<MachineDebugInfo>();
} }
MachineFunctionPass::getAnalysisUsage(AU); MachineFunctionPass::getAnalysisUsage(AU);