1 //===-- PowerPCTargetMachine.cpp - Define TargetMachine for PowerPC -------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #include "PowerPCTargetMachine.h"
15 #include "llvm/Module.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/CodeGen/IntrinsicLowering.h"
18 #include "llvm/CodeGen/MachineFunction.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/Target/TargetOptions.h"
21 #include "llvm/Target/TargetMachineRegistry.h"
22 #include "llvm/Transforms/Scalar.h"
27 // Register the target.
28 RegisterTarget<PowerPCTargetMachine> X("powerpc", " PowerPC (experimental)");
31 /// PowerPCTargetMachine ctor - Create an ILP32 architecture model
33 /// FIXME: Should double alignment be 8 bytes? Then we get a PtrAl != DoubleAl
35 PowerPCTargetMachine::PowerPCTargetMachine(const Module &M,
36 IntrinsicLowering *IL)
37 : TargetMachine("PowerPC", IL, false, 4, 4, 4, 4, 4, 4, 4, 4),
38 FrameInfo(TargetFrameInfo::StackGrowsDown, 16, -4), JITInfo(*this) {
41 /// addPassesToEmitAssembly - Add passes to the specified pass manager
42 /// to implement a static compiler for this target.
44 bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
46 // FIXME: Implement efficient support for garbage collection intrinsics.
47 PM.add(createLowerGCPass());
49 // FIXME: Implement the invoke/unwind instructions!
50 PM.add(createLowerInvokePass());
52 // FIXME: Implement the switch instruction in the instruction selector!
53 PM.add(createLowerSwitchPass());
55 PM.add(createLowerConstantExpressionsPass());
57 // Make sure that no unreachable blocks are instruction selected.
58 PM.add(createUnreachableBlockEliminationPass());
60 PM.add(createPPCSimpleInstructionSelector(*this));
63 PM.add(createMachineFunctionPrinterPass(&std::cerr));
65 PM.add(createRegisterAllocator());
68 PM.add(createMachineFunctionPrinterPass(&std::cerr));
70 PM.add(createPrologEpilogCodeInserter());
71 PM.add(createPPCCodePrinterPass(Out, *this));
72 PM.add(createMachineCodeDeleter());
76 /// addPassesToJITCompile - Add passes to the specified pass manager to
77 /// implement a fast dynamic compiler for this target.
79 void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
80 // FIXME: Implement efficient support for garbage collection intrinsics.
81 PM.add(createLowerGCPass());
83 // FIXME: Implement the invoke/unwind instructions!
84 PM.add(createLowerInvokePass());
86 // FIXME: Implement the switch instruction in the instruction selector!
87 PM.add(createLowerSwitchPass());
89 PM.add(createLowerConstantExpressionsPass());
91 // Make sure that no unreachable blocks are instruction selected.
92 PM.add(createUnreachableBlockEliminationPass());
94 PM.add(createPPCSimpleInstructionSelector(TM));
95 PM.add(createRegisterAllocator());
96 PM.add(createPrologEpilogCodeInserter());