Delete the allocate*TargetMachine function, which is now dead.
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetMachine.cpp
1 //===-- PowerPCTargetMachine.cpp - Define TargetMachine for PowerPC -------===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 // 
8 //===----------------------------------------------------------------------===//
9 // 
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "PowerPCTargetMachine.h"
14 #include "PowerPC.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"
23 #include <iostream>
24 using namespace llvm;
25
26 namespace {
27   // Register the target.
28   RegisterTarget<PowerPCTargetMachine> X("powerpc", "  PowerPC (experimental)");
29 }
30
31 /// PowerPCTargetMachine ctor - Create an ILP32 architecture model
32 ///
33 /// FIXME: Should double alignment be 8 bytes?  Then we get a PtrAl != DoubleAl
34 /// abort
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) {
39 }
40
41 /// addPassesToEmitAssembly - Add passes to the specified pass manager
42 /// to implement a static compiler for this target.
43 ///
44 bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
45                                                std::ostream &Out) {
46   // FIXME: Implement efficient support for garbage collection intrinsics.
47   PM.add(createLowerGCPass());
48
49   // FIXME: Implement the invoke/unwind instructions!
50   PM.add(createLowerInvokePass());
51
52   // FIXME: Implement the switch instruction in the instruction selector!
53   PM.add(createLowerSwitchPass());
54
55   PM.add(createLowerConstantExpressionsPass());
56
57   // Make sure that no unreachable blocks are instruction selected.
58   PM.add(createUnreachableBlockEliminationPass());
59
60   PM.add(createPPCSimpleInstructionSelector(*this));
61
62   if (PrintMachineCode)
63     PM.add(createMachineFunctionPrinterPass(&std::cerr));
64
65   PM.add(createRegisterAllocator());
66
67   if (PrintMachineCode)
68     PM.add(createMachineFunctionPrinterPass(&std::cerr));
69
70   PM.add(createPrologEpilogCodeInserter());
71   PM.add(createPPCCodePrinterPass(Out, *this));
72   PM.add(createMachineCodeDeleter());
73   return false;
74 }
75
76 /// addPassesToJITCompile - Add passes to the specified pass manager to
77 /// implement a fast dynamic compiler for this target.
78 ///
79 void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
80   // FIXME: Implement efficient support for garbage collection intrinsics.
81   PM.add(createLowerGCPass());
82
83   // FIXME: Implement the invoke/unwind instructions!
84   PM.add(createLowerInvokePass());
85
86   // FIXME: Implement the switch instruction in the instruction selector!
87   PM.add(createLowerSwitchPass());
88
89   PM.add(createLowerConstantExpressionsPass());
90
91   // Make sure that no unreachable blocks are instruction selected.
92   PM.add(createUnreachableBlockEliminationPass());
93
94   PM.add(createPPCSimpleInstructionSelector(TM));
95   PM.add(createRegisterAllocator());
96   PM.add(createPrologEpilogCodeInserter());
97 }
98