eliminate FileModel::Model, just use CodeGenFileType. The client

of the code generator shouldn't care what object format a target
uses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95124 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-02-02 21:06:45 +00:00
parent 1de46a4ab5
commit 211edae484
7 changed files with 42 additions and 50 deletions

View File

@ -96,28 +96,25 @@ LLVMTargetMachine::setCodeModelForStatic() {
setCodeModel(CodeModel::Small);
}
FileModel::Model
TargetMachine::CodeGenFileType
LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
formatted_raw_ostream &Out,
CodeGenFileType FileType,
CodeGenOpt::Level OptLevel) {
// Add common CodeGen passes.
if (addCommonCodeGenPasses(PM, OptLevel))
return FileModel::Error;
return CGFT_ErrorOccurred;
FileModel::Model ResultTy;
switch (FileType) {
default:
return FileModel::Error;
case TargetMachine::ObjectFile:
return FileModel::Error;
case TargetMachine::AssemblyFile: {
case CGFT_ObjectFile:
return CGFT_ErrorOccurred;
case CGFT_AssemblyFile: {
FunctionPass *Printer =
getTarget().createAsmPrinter(Out, *this, getMCAsmInfo(),
getAsmVerbosityDefault());
if (Printer == 0) return FileModel::Error;
if (Printer == 0) return CGFT_ErrorOccurred;
PM.add(Printer);
ResultTy = FileModel::AsmFile;
break;
}
}
@ -125,7 +122,7 @@ LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
// Make sure the code model is set.
setCodeModelForStatic();
PM.add(createGCInfoDeleter());
return ResultTy;
return FileType;
}
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to