1 //===-- PPCMachOWriter.cpp - Emit a Mach-O file for the PowerPC backend ---===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Nate Begeman and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements a Mach-O writer for the PowerPC backend. The public
11 // interface to this file is the createPPCMachOObjectWriterPass function.
13 //===----------------------------------------------------------------------===//
15 #include "PPCTargetMachine.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/CodeGen/MachOWriter.h"
18 #include "llvm/Support/Compiler.h"
22 class VISIBILITY_HIDDEN PPCMachOWriter : public MachOWriter {
24 PPCMachOWriter(std::ostream &O, PPCTargetMachine &TM) : MachOWriter(O, TM) {
25 // FIMXE: choose ppc64 when appropriate
26 Header.cputype = MachOHeader::CPU_TYPE_POWERPC;
27 Header.cpusubtype = MachOHeader::CPU_SUBTYPE_POWERPC_ALL;
33 /// addPPCMachOObjectWriterPass - Returns a pass that outputs the generated code
34 /// as a Mach-O object file.
36 void llvm::addPPCMachOObjectWriterPass(FunctionPassManager &FPM,
37 std::ostream &O, PPCTargetMachine &TM) {
38 PPCMachOWriter *EW = new PPCMachOWriter(O, TM);
40 FPM.add(createPPCCodeEmitterPass(TM, EW->getMachineCodeEmitter()));