Refactor the addPassesToEmitAssembly interface into a addPassesToEmitFile

interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22282 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2005-06-25 02:48:37 +00:00
parent 11f14c8be0
commit 0431c96cec
19 changed files with 72 additions and 41 deletions

View File

@@ -1725,7 +1725,10 @@ void CWriter::visitVAArgInst(VAArgInst &I) {
// External Interface declaration
//===----------------------------------------------------------------------===//
bool CTargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &o) {
bool CTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &o,
CodeGenFileType FileType) {
if (FileType != TargetMachine::AssemblyFile) return true;
PM.add(createLowerGCPass());
PM.add(createLowerAllocationsPass(true));
PM.add(createLowerInvokePass());
@@ -1733,5 +1736,3 @@ bool CTargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &o) {
PM.add(new CWriter(o, getIntrinsicLowering()));
return false;
}
// vim: sw=2

View File

@@ -24,7 +24,8 @@ struct CTargetMachine : public TargetMachine {
TargetMachine("CBackend", IL, M) {}
// This is the only thing that actually does anything here.
virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
CodeGenFileType FileType);
// This class always works, but shouldn't be the default in most cases.
static unsigned getModuleMatchQuality(const Module &M) { return 1; }

View File

@@ -1725,7 +1725,10 @@ void CWriter::visitVAArgInst(VAArgInst &I) {
// External Interface declaration
//===----------------------------------------------------------------------===//
bool CTargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &o) {
bool CTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &o,
CodeGenFileType FileType) {
if (FileType != TargetMachine::AssemblyFile) return true;
PM.add(createLowerGCPass());
PM.add(createLowerAllocationsPass(true));
PM.add(createLowerInvokePass());
@@ -1733,5 +1736,3 @@ bool CTargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &o) {
PM.add(new CWriter(o, getIntrinsicLowering()));
return false;
}
// vim: sw=2