blob: 54d0734fb97596341bbbc5b14176dcc304885230 [file] [log] [blame]
Brian Gaekeca78f492004-01-21 21:13:19 +00001//===-- 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 Gaeke03f84a92004-02-02 19:06:36 +000014#include "PowerPC.h"
Brian Gaekeca78f492004-01-21 21:13:19 +000015#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
21namespace llvm {
22
23// allocatePowerPCTargetMachine - Allocate and return a subclass of
24// TargetMachine that implements the PowerPC backend.
25//
26TargetMachine *allocatePowerPCTargetMachine(const Module &M,
27 IntrinsicLowering *IL) {
28 return new PowerPCTargetMachine(M, IL);
29}
30
31/// PowerPCTargetMachine ctor - Create an ILP32 architecture model
32///
33PowerPCTargetMachine::PowerPCTargetMachine(const Module &M,
34 IntrinsicLowering *IL)
35 : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4),
Brian Gaeke954e3162004-01-23 06:39:30 +000036 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 4), JITInfo(*this) {
Brian Gaekeca78f492004-01-21 21:13:19 +000037}
38
Brian Gaeke03f84a92004-02-02 19:06:36 +000039/// addPassesToEmitAssembly - Add passes to the specified pass manager
40/// to implement a static compiler for this target.
41///
Brian Gaekeca78f492004-01-21 21:13:19 +000042bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
43 std::ostream &Out) {
Brian Gaeke03f84a92004-02-02 19:06:36 +000044 // <insert instruction selector passes here>
45 PM.add(createRegisterAllocator());
46 PM.add(createPrologEpilogCodeInserter());
47 // <insert assembly code output passes here>
Brian Gaeke03f84a92004-02-02 19:06:36 +000048 return true; // change to `return false' when this actually works.
Brian Gaekeca78f492004-01-21 21:13:19 +000049}
50
51/// addPassesToJITCompile - Add passes to the specified pass manager to
Brian Gaeke7b0cd6d2004-01-23 06:35:43 +000052/// implement a fast dynamic compiler for this target.
Brian Gaekeca78f492004-01-21 21:13:19 +000053///
Brian Gaeke7b0cd6d2004-01-23 06:35:43 +000054void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
Brian Gaeke03f84a92004-02-02 19:06:36 +000055 // <insert instruction selector passes here>
56 PM.add(createRegisterAllocator());
57 PM.add(createPrologEpilogCodeInserter());
Brian Gaekeca78f492004-01-21 21:13:19 +000058}
59
60} // end namespace llvm