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" |
Chris Lattner | 0cf0c37 | 2004-07-11 04:17:10 +0000 | [diff] [blame] | 17 | #include "llvm/Target/TargetOptions.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. |
Chris Lattner | 71d24aa | 2004-07-11 03:27:42 +0000 | [diff] [blame] | 25 | RegisterTarget<PowerPCTargetMachine> X("powerpc", " PowerPC (experimental)"); |
Chris Lattner | d36c970 | 2004-07-11 02:48:49 +0000 | [diff] [blame] | 26 | } |
| 27 | |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 28 | /// PowerPCTargetMachine ctor - Create an ILP32 architecture model |
| 29 | /// |
| 30 | PowerPCTargetMachine::PowerPCTargetMachine(const Module &M, |
| 31 | IntrinsicLowering *IL) |
| 32 | : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4), |
Chris Lattner | 32305f7 | 2004-06-10 06:19:25 +0000 | [diff] [blame] | 33 | FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), JITInfo(*this) { |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 36 | /// addPassesToEmitAssembly - Add passes to the specified pass manager |
| 37 | /// to implement a static compiler for this target. |
| 38 | /// |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 39 | bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM, |
| 40 | std::ostream &Out) { |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 41 | // <insert instruction selector passes here> |
| 42 | PM.add(createRegisterAllocator()); |
| 43 | PM.add(createPrologEpilogCodeInserter()); |
| 44 | // <insert assembly code output passes here> |
Alkis Evlogimenos | c81efdc | 2004-02-15 00:03:15 +0000 | [diff] [blame] | 45 | PM.add(createMachineCodeDeleter()); |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 46 | return true; // change to `return false' when this actually works. |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | /// addPassesToJITCompile - Add passes to the specified pass manager to |
Brian Gaeke | 7b0cd6d | 2004-01-23 06:35:43 +0000 | [diff] [blame] | 50 | /// implement a fast dynamic compiler for this target. |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 51 | /// |
Brian Gaeke | 7b0cd6d | 2004-01-23 06:35:43 +0000 | [diff] [blame] | 52 | void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { |
Brian Gaeke | 03f84a9 | 2004-02-02 19:06:36 +0000 | [diff] [blame] | 53 | // <insert instruction selector passes here> |
| 54 | PM.add(createRegisterAllocator()); |
| 55 | PM.add(createPrologEpilogCodeInserter()); |
Brian Gaeke | ca78f49 | 2004-01-21 21:13:19 +0000 | [diff] [blame] | 56 | } |
| 57 | |