mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-19 19:25:40 +00:00
Hook up llc's -filetype=obj to use MCStreamer if an MCCodeEmitter is available.
Remove most of old Mach-O Writer support, it has been replaced by MCMachOStreamer Further refactoring to completely remove MachOWriter and drive the object file writer with the AsmPrinter MCInst/MCSection logic is forthcoming. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "llvm/Assembly/PrintModulePass.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/CodeGen/FileWriters.h"
|
||||
#include "llvm/CodeGen/GCStrategy.h"
|
||||
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
@@ -115,12 +116,11 @@ LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||
return FileModel::Error;
|
||||
return FileModel::AsmFile;
|
||||
case TargetMachine::ObjectFile:
|
||||
if (getMachOWriterInfo())
|
||||
if (!addObjectFileEmitter(PM, OptLevel, Out))
|
||||
return FileModel::MachOFile;
|
||||
else if (getELFWriterInfo())
|
||||
return FileModel::ElfFile;
|
||||
return FileModel::ElfFile;
|
||||
}
|
||||
|
||||
return FileModel::Error;
|
||||
}
|
||||
|
||||
@@ -137,6 +137,17 @@ bool LLVMTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LLVMTargetMachine::addObjectFileEmitter(PassManagerBase &PM,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
formatted_raw_ostream &Out) {
|
||||
MCCodeEmitter *Emitter = getTarget().createCodeEmitter(*this);
|
||||
if (!Emitter)
|
||||
return true;
|
||||
|
||||
PM.add(createMachOWriter(Out, *this, getMCAsmInfo(), Emitter));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// addPassesToEmitFileFinish - If the passes to emit the specified file had to
|
||||
/// be split up (e.g., to add an object writer pass), this method can be used to
|
||||
/// finish up adding passes to emit the file, if necessary.
|
||||
|
Reference in New Issue
Block a user