Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 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" |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 14 | #include "PowerPC.h" |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 15 | #include "llvm/Module.h" |
| 16 | #include "llvm/PassManager.h" |
| 17 | #include "llvm/Target/TargetMachineImpls.h" |
Chris Lattner | d36c970 | 2004-07-11 02:48:49 +0000 | [diff] [blame^] | 18 | #include "llvm/Target/TargetMachineRegistry.h" |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 19 | #include "llvm/CodeGen/MachineFunction.h" |
| 20 | #include "llvm/CodeGen/Passes.h" |
Chris Lattner | 9a89f37 | 2004-02-28 19:53:18 +0000 | [diff] [blame] | 21 | using namespace llvm; |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 22 | |
Chris Lattner | d36c970 | 2004-07-11 02:48:49 +0000 | [diff] [blame^] | 23 | namespace { |
| 24 | // Register the target. |
| 25 | RegisterTarget<PowerPCTargetMachine> X("powerpc", "PowerPC (experimental)"); |
| 26 | } |
| 27 | |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 28 | // allocatePowerPCTargetMachine - Allocate and return a subclass of |
| 29 | // TargetMachine that implements the PowerPC backend. |
| 30 | // |
Chris Lattner | 9a89f37 | 2004-02-28 19:53:18 +0000 | [diff] [blame] | 31 | TargetMachine *llvm::allocatePowerPCTargetMachine(const Module &M, |
| 32 | IntrinsicLowering *IL) { |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 33 | return new PowerPCTargetMachine(M, IL); |
| 34 | } |
| 35 | |
| 36 | /// PowerPCTargetMachine ctor - Create an ILP32 architecture model |
| 37 | /// |
| 38 | PowerPCTargetMachine::PowerPCTargetMachine(const Module &M, |
| 39 | IntrinsicLowering *IL) |
| 40 | : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4), |
Chris Lattner | 32305f7 | 2004-06-10 06:19:25 +0000 | [diff] [blame] | 41 | FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), JITInfo(*this) { |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 42 | } |
| 43 | |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 44 | /// addPassesToEmitAssembly - Add passes to the specified pass manager |
| 45 | /// to implement a static compiler for this target. |
| 46 | /// |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 47 | bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM, |
| 48 | std::ostream &Out) { |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 49 | // <insert instruction selector passes here> |
| 50 | PM.add(createRegisterAllocator()); |
| 51 | PM.add(createPrologEpilogCodeInserter()); |
| 52 | // <insert assembly code output passes here> |
Alkis Evlogimenos | c81efdc | 2004-02-15 00:03:15 +0000 | [diff] [blame] | 53 | PM.add(createMachineCodeDeleter()); |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 54 | return true; // change to `return false' when this actually works. |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | /// addPassesToJITCompile - Add passes to the specified pass manager to |
Brian Gaeke | 7b0cd6d | 2004-01-23 06:35:43 +0000 | [diff] [blame] | 58 | /// implement a fast dynamic compiler for this target. |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 59 | /// |
Brian Gaeke | 7b0cd6d | 2004-01-23 06:35:43 +0000 | [diff] [blame] | 60 | void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 61 | // <insert instruction selector passes here> |
| 62 | PM.add(createRegisterAllocator()); |
| 63 | PM.add(createPrologEpilogCodeInserter()); |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 64 | } |
| 65 | |