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