Lift DumpAsm / -print-emitted-asm functionality into LLVMTargetMachine.

- No intended functionality change.

llvm-svn: 75848
This commit is contained in:
Daniel Dunbar 2009-07-15 22:33:19 +00:00
parent 41ed90f03e
commit c901392ba4
10 changed files with 52 additions and 124 deletions

View File

@ -413,44 +413,41 @@ public:
/// addCodeEmitter - This pass should be overridden by the target to add a
/// code emitter, if supported. If this is not supported, 'true' should be
/// returned. If DumpAsm is true, the generated assembly is printed to cerr.
/// returned.
virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
bool /*DumpAsm*/, MachineCodeEmitter &) {
MachineCodeEmitter &) {
return true;
}
/// addCodeEmitter - This pass should be overridden by the target to add a
/// code emitter, if supported. If this is not supported, 'true' should be
/// returned. If DumpAsm is true, the generated assembly is printed to cerr.
/// returned.
virtual bool addCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
bool /*DumpAsm*/, JITCodeEmitter &) {
JITCodeEmitter &) {
return true;
}
/// addSimpleCodeEmitter - This pass should be overridden by the target to add
/// a code emitter (without setting flags), if supported. If this is not
/// supported, 'true' should be returned. If DumpAsm is true, the generated
/// assembly is printed to cerr.
/// supported, 'true' should be returned.
virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
bool /*DumpAsm*/, MachineCodeEmitter &) {
MachineCodeEmitter &) {
return true;
}
/// addSimpleCodeEmitter - This pass should be overridden by the target to add
/// a code emitter (without setting flags), if supported. If this is not
/// supported, 'true' should be returned. If DumpAsm is true, the generated
/// assembly is printed to cerr.
/// supported, 'true' should be returned.
virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
bool /*DumpAsm*/, JITCodeEmitter &) {
JITCodeEmitter &) {
return true;
}
/// addSimpleCodeEmitter - This pass should be overridden by the target to add
/// a code emitter (without setting flags), if supported. If this is not
/// supported, 'true' should be returned. If DumpAsm is true, the generated
/// assembly is printed to cerr.
/// supported, 'true' should be returned.
virtual bool addSimpleCodeEmitter(PassManagerBase &, CodeGenOpt::Level,
bool /*DumpAsm*/, ObjectCodeEmitter &) {
ObjectCodeEmitter &) {
return true;
}

View File

@ -99,7 +99,9 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM,
MachineCodeEmitter *MCE,
CodeGenOpt::Level OptLevel) {
if (MCE)
addSimpleCodeEmitter(PM, OptLevel, PrintEmittedAsm, *MCE);
addSimpleCodeEmitter(PM, OptLevel, *MCE);
if (PrintEmittedAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
PM.add(createGCInfoDeleter());
@ -116,7 +118,9 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM,
JITCodeEmitter *JCE,
CodeGenOpt::Level OptLevel) {
if (JCE)
addSimpleCodeEmitter(PM, OptLevel, PrintEmittedAsm, *JCE);
addSimpleCodeEmitter(PM, OptLevel, *JCE);
if (PrintEmittedAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
PM.add(createGCInfoDeleter());
@ -133,7 +137,9 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(PassManagerBase &PM,
ObjectCodeEmitter *OCE,
CodeGenOpt::Level OptLevel) {
if (OCE)
addSimpleCodeEmitter(PM, OptLevel, PrintEmittedAsm, *OCE);
addSimpleCodeEmitter(PM, OptLevel, *OCE);
if (PrintEmittedAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
PM.add(createGCInfoDeleter());
@ -159,7 +165,9 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
if (addPreEmitPass(PM, OptLevel) && PrintMachineCode)
PM.add(createMachineFunctionPrinterPass(cerr));
addCodeEmitter(PM, OptLevel, PrintEmittedAsm, MCE);
addCodeEmitter(PM, OptLevel, MCE);
if (PrintEmittedAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
PM.add(createGCInfoDeleter());
@ -185,7 +193,9 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(PassManagerBase &PM,
if (addPreEmitPass(PM, OptLevel) && PrintMachineCode)
PM.add(createMachineFunctionPrinterPass(cerr));
addCodeEmitter(PM, OptLevel, PrintEmittedAsm, JCE);
addCodeEmitter(PM, OptLevel, JCE);
if (PrintEmittedAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
PM.add(createGCInfoDeleter());

View File

@ -143,7 +143,6 @@ bool ARMBaseTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE) {
// FIXME: Move this to TargetJITInfo!
if (DefRelocModel == Reloc::Default)
@ -151,15 +150,11 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
// Machine code emitter pass for ARM.
PM.add(createARMCodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE) {
// FIXME: Move this to TargetJITInfo!
if (DefRelocModel == Reloc::Default)
@ -167,15 +162,11 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
// Machine code emitter pass for ARM.
PM.add(createARMJITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE) {
// FIXME: Move this to TargetJITInfo!
if (DefRelocModel == Reloc::Default)
@ -183,45 +174,30 @@ bool ARMBaseTargetMachine::addCodeEmitter(PassManagerBase &PM,
// Machine code emitter pass for ARM.
PM.add(createARMObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE) {
// Machine code emitter pass for ARM.
PM.add(createARMCodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE) {
// Machine code emitter pass for ARM.
PM.add(createARMJITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool ARMBaseTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE) {
// Machine code emitter pass for ARM.
PM.add(createARMObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}

View File

@ -59,22 +59,19 @@ public:
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE);
MachineCodeEmitter &MCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &MCE);
JITCodeEmitter &MCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE);
ObjectCodeEmitter &OCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &MCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE);
};

View File

@ -73,44 +73,35 @@ bool AlphaTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE) {
MachineCodeEmitter &MCE) {
PM.add(createAlphaCodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE) {
JITCodeEmitter &JCE) {
PM.add(createAlphaJITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool AlphaTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE) {
ObjectCodeEmitter &OCE) {
PM.add(createAlphaObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE) {
return addCodeEmitter(PM, OptLevel, DumpAsm, MCE);
return addCodeEmitter(PM, OptLevel, MCE);
}
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE) {
return addCodeEmitter(PM, OptLevel, DumpAsm, JCE);
return addCodeEmitter(PM, OptLevel, JCE);
}
bool AlphaTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE) {
return addCodeEmitter(PM, OptLevel, DumpAsm, OCE);
return addCodeEmitter(PM, OptLevel, OCE);
}

View File

@ -61,22 +61,19 @@ public:
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE);
MachineCodeEmitter &MCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE);
JITCodeEmitter &JCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &JCE);
ObjectCodeEmitter &JCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE);
};

View File

@ -111,7 +111,7 @@ bool PPCTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE) {
MachineCodeEmitter &MCE) {
// The JIT should use the static relocation model in ppc32 mode, PIC in ppc64.
// FIXME: This should be moved to TargetJITInfo!!
if (Subtarget.isPPC64()) {
@ -132,15 +132,13 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
// Machine code emitter pass for PowerPC.
PM.add(createPPCCodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE) {
JITCodeEmitter &JCE) {
// The JIT should use the static relocation model in ppc32 mode, PIC in ppc64.
// FIXME: This should be moved to TargetJITInfo!!
if (Subtarget.isPPC64()) {
@ -161,15 +159,13 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
// Machine code emitter pass for PowerPC.
PM.add(createPPCJITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE) {
ObjectCodeEmitter &OCE) {
// The JIT should use the static relocation model in ppc32 mode, PIC in ppc64.
// FIXME: This should be moved to TargetJITInfo!!
if (Subtarget.isPPC64()) {
@ -190,45 +186,31 @@ bool PPCTargetMachine::addCodeEmitter(PassManagerBase &PM,
// Machine code emitter pass for PowerPC.
PM.add(createPPCObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE) {
// Machine code emitter pass for PowerPC.
PM.add(createPPCCodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE) {
// Machine code emitter pass for PowerPC.
PM.add(createPPCJITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool PPCTargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE) {
// Machine code emitter pass for PowerPC.
PM.add(createPPCObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}

View File

@ -72,20 +72,20 @@ public:
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE);
MachineCodeEmitter &MCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE);
JITCodeEmitter &JCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE);
ObjectCodeEmitter &OCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE);
MachineCodeEmitter &MCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE);
JITCodeEmitter &JCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE);
ObjectCodeEmitter &OCE);
virtual bool getEnableTailMergeDefault() const;
};

View File

@ -194,7 +194,6 @@ bool X86TargetMachine::addAssemblyEmitter(PassManagerBase &PM,
bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE) {
// FIXME: Move this to TargetJITInfo!
// On Darwin, do not override 64-bit setting made in X86TargetMachine().
@ -215,15 +214,12 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
}
PM.add(createX86CodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE) {
// FIXME: Move this to TargetJITInfo!
// On Darwin, do not override 64-bit setting made in X86TargetMachine().
@ -244,52 +240,34 @@ bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
}
PM.add(createX86JITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool X86TargetMachine::addCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE) {
PM.add(createX86ObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
MachineCodeEmitter &MCE) {
PM.add(createX86CodeEmitterPass(*this, MCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
JITCodeEmitter &JCE) {
PM.add(createX86JITCodeEmitterPass(*this, JCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}
bool X86TargetMachine::addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm,
ObjectCodeEmitter &OCE) {
PM.add(createX86ObjectCodeEmitterPass(*this, OCE));
if (DumpAsm)
addAssemblyEmitter(PM, OptLevel, true, ferrs());
return false;
}

View File

@ -68,20 +68,20 @@ public:
CodeGenOpt::Level OptLevel,
bool Verbose, formatted_raw_ostream &Out);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE);
MachineCodeEmitter &MCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE);
JITCodeEmitter &JCE);
virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE);
ObjectCodeEmitter &OCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, MachineCodeEmitter &MCE);
MachineCodeEmitter &MCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, JITCodeEmitter &JCE);
JITCodeEmitter &JCE);
virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool DumpAsm, ObjectCodeEmitter &OCE);
ObjectCodeEmitter &OCE);
};
/// X86_32TargetMachine - X86 32-bit target machine.