mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Initial checkin of the Mach-O emitter. There's plenty of fixmes, but it
does emit linkable .o files in very simple cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29850 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -109,11 +109,11 @@ PPC64TargetMachine::PPC64TargetMachine(const Module &M, const std::string &FS)
|
||||
/// addPassesToEmitFile - Add passes to the specified pass manager to implement
|
||||
/// a static compiler for this target.
|
||||
///
|
||||
bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
|
||||
std::ostream &Out,
|
||||
bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out,
|
||||
CodeGenFileType FileType,
|
||||
bool Fast) {
|
||||
if (FileType != TargetMachine::AssemblyFile) return true;
|
||||
if (FileType != TargetMachine::AssemblyFile &&
|
||||
FileType != TargetMachine::ObjectFile) return true;
|
||||
|
||||
// Run loop strength reduction before anything else.
|
||||
if (!Fast) PM.add(createLoopStrengthReducePass(&TLInfo));
|
||||
@@ -146,7 +146,11 @@ bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
|
||||
// Must run branch selection immediately preceding the asm printer
|
||||
PM.add(createPPCBranchSelectionPass());
|
||||
|
||||
PM.add(createDarwinAsmPrinter(Out, *this));
|
||||
if (FileType == TargetMachine::AssemblyFile)
|
||||
PM.add(createDarwinAsmPrinter(Out, *this));
|
||||
else
|
||||
// FIXME: support PPC ELF files at some point
|
||||
addPPCMachOObjectWriterPass(PM, Out, *this);
|
||||
|
||||
PM.add(createMachineCodeDeleter());
|
||||
return false;
|
||||
@@ -184,3 +188,17 @@ void PPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
|
||||
PM.add(createMachineFunctionPrinterPass(&std::cerr));
|
||||
}
|
||||
|
||||
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to get
|
||||
/// machine code emitted. This uses a MachineCodeEmitter object to handle
|
||||
/// actually outputting the machine code and resolving things like the address
|
||||
/// of functions. This method should returns true if machine code emission is
|
||||
/// not supported.
|
||||
///
|
||||
bool PPCTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
|
||||
MachineCodeEmitter &MCE) {
|
||||
// Machine code emitter pass for PowerPC
|
||||
PM.add(createPPCCodeEmitterPass(*this, MCE));
|
||||
// Delete machine code for this function after emitting it
|
||||
PM.add(createMachineCodeDeleter());
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user