forked from OSchip/llvm-project
Added -print-emitted-asm to print out JIT generated asm to cerr.
llvm-svn: 40123
This commit is contained in:
parent
7a7fd0b533
commit
9d5df0a5f6
|
@ -306,17 +306,18 @@ 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.
|
||||
virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
/// returned. If DumpAsm is true, the generated assembly is printed to cerr.
|
||||
virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, bool DumpAsm,
|
||||
MachineCodeEmitter &MCE) {
|
||||
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.
|
||||
/// supported, 'true' should be returned. If DumpAsm is true, the generated
|
||||
/// assembly is printed to cerr.
|
||||
virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden,
|
|||
cl::desc("Print LLVM IR produced by the loop-reduce pass"));
|
||||
static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden,
|
||||
cl::desc("Print LLVM IR input to isel pass"));
|
||||
static cl::opt<bool> PrintEmittedAsm("print-emitted-asm", cl::Hidden,
|
||||
cl::desc("Dump emitter generated instructions as assembly"));
|
||||
|
||||
FileModel::Model
|
||||
LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
|
||||
|
@ -119,7 +121,7 @@ bool LLVMTargetMachine::addPassesToEmitFileFinish(FunctionPassManager &PM,
|
|||
MachineCodeEmitter *MCE,
|
||||
bool Fast) {
|
||||
if (MCE)
|
||||
addSimpleCodeEmitter(PM, Fast, *MCE);
|
||||
addSimpleCodeEmitter(PM, Fast, PrintEmittedAsm, *MCE);
|
||||
|
||||
// Delete machine code for this function
|
||||
PM.add(createMachineCodeDeleter());
|
||||
|
@ -196,7 +198,7 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
|
|||
if (addPreEmitPass(PM, Fast) && PrintMachineCode)
|
||||
PM.add(createMachineFunctionPrinterPass(cerr));
|
||||
|
||||
addCodeEmitter(PM, Fast, MCE);
|
||||
addCodeEmitter(PM, Fast, PrintEmittedAsm, MCE);
|
||||
|
||||
// Delete machine code for this function
|
||||
PM.add(createMachineCodeDeleter());
|
||||
|
|
|
@ -143,18 +143,22 @@ bool ARMTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
|||
|
||||
|
||||
bool ARMTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
// FIXME: Move this to TargetJITInfo!
|
||||
setRelocationModel(Reloc::Static);
|
||||
|
||||
// Machine code emitter pass for ARM.
|
||||
PM.add(createARMCodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createARMCodePrinterPass(*cerr.stream(), *this));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ARMTargetMachine::addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
// Machine code emitter pass for ARM.
|
||||
PM.add(createARMCodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createARMCodePrinterPass(*cerr.stream(), *this));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -61,9 +61,9 @@ public:
|
|||
virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
||||
std::ostream &Out);
|
||||
virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
};
|
||||
|
||||
/// ThumbTargetMachine - Thumb target machine.
|
||||
|
|
|
@ -86,12 +86,14 @@ bool AlphaTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
|||
return false;
|
||||
}
|
||||
bool AlphaTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
PM.add(createAlphaCodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createAlphaCodePrinterPass(*cerr.stream(), *this));
|
||||
return false;
|
||||
}
|
||||
bool AlphaTargetMachine::addSimpleCodeEmitter(FunctionPassManager &PM,
|
||||
bool Fast,
|
||||
bool Fast, bool DumpAsm,
|
||||
MachineCodeEmitter &MCE) {
|
||||
return addCodeEmitter(PM, Fast, MCE);
|
||||
return addCodeEmitter(PM, Fast, DumpAsm, MCE);
|
||||
}
|
||||
|
|
|
@ -63,9 +63,9 @@ public:
|
|||
virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
||||
std::ostream &Out);
|
||||
virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -137,7 +137,7 @@ bool PPCTargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
|||
}
|
||||
|
||||
bool PPCTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, 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()) {
|
||||
|
@ -155,12 +155,16 @@ bool PPCTargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
|||
|
||||
// Machine code emitter pass for PowerPC.
|
||||
PM.add(createPPCCodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createPPCAsmPrinterPass(*cerr.stream(), *this));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PPCTargetMachine::addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
// Machine code emitter pass for PowerPC.
|
||||
PM.add(createPPCCodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createPPCAsmPrinterPass(*cerr.stream(), *this));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -70,9 +70,9 @@ public:
|
|||
virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
||||
std::ostream &Out);
|
||||
virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
virtual const bool getEnableTailMergeDefault() const;
|
||||
};
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ bool X86TargetMachine::addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
|||
}
|
||||
|
||||
bool X86TargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
// FIXME: Move this to TargetJITInfo!
|
||||
setRelocationModel(Reloc::Static);
|
||||
Subtarget.setPICStyle(PICStyle::None);
|
||||
|
@ -180,11 +180,16 @@ bool X86TargetMachine::addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
|||
setCodeModel(CodeModel::Large);
|
||||
|
||||
PM.add(createX86CodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createX86CodePrinterPass(*cerr.stream(), *this));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool X86TargetMachine::addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE) {
|
||||
bool DumpAsm, MachineCodeEmitter &MCE) {
|
||||
PM.add(createX86CodeEmitterPass(*this, MCE));
|
||||
if (DumpAsm)
|
||||
PM.add(createX86CodePrinterPass(*cerr.stream(), *this));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,9 @@ public:
|
|||
virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast,
|
||||
std::ostream &Out);
|
||||
virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
virtual bool addSimpleCodeEmitter(FunctionPassManager &PM, bool Fast,
|
||||
MachineCodeEmitter &MCE);
|
||||
bool DumpAsm, MachineCodeEmitter &MCE);
|
||||
};
|
||||
|
||||
/// X86_32TargetMachine - X86 32-bit target machine.
|
||||
|
|
Loading…
Reference in New Issue