blob: 9a9a020b64803cab1e88a25efce2b3011fc05752 [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"
Chris Lattner9a89f372004-02-28 19:53:18 +000020using namespace llvm;
Brian Gaekeca78f492004-01-21 21:13:19 +000021
22// allocatePowerPCTargetMachine - Allocate and return a subclass of
23// TargetMachine that implements the PowerPC backend.
24//
Chris Lattner9a89f372004-02-28 19:53:18 +000025TargetMachine *llvm::allocatePowerPCTargetMachine(const Module &M,
26 IntrinsicLowering *IL) {
Brian Gaekeca78f492004-01-21 21:13:19 +000027 return new PowerPCTargetMachine(M, IL);
28}
29
30/// PowerPCTargetMachine ctor - Create an ILP32 architecture model
31///
32PowerPCTargetMachine::PowerPCTargetMachine(const Module &M,
33 IntrinsicLowering *IL)
34 : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4),
Brian Gaeke954e3162004-01-23 06:39:30 +000035 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 4), JITInfo(*this) {
Brian Gaekeca78f492004-01-21 21:13:19 +000036}
37
Brian Gaeke03f84a92004-02-02 19:06:36 +000038/// addPassesToEmitAssembly - Add passes to the specified pass manager
39/// to implement a static compiler for this target.
40///
Brian Gaekeca78f492004-01-21 21:13:19 +000041bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
42 std::ostream &Out) {
Brian Gaeke03f84a92004-02-02 19:06:36 +000043 // <insert instruction selector passes here>
44 PM.add(createRegisterAllocator());
45 PM.add(createPrologEpilogCodeInserter());
46 // <insert assembly code output passes here>
Alkis Evlogimenosc81efdc2004-02-15 00:03:15 +000047 PM.add(createMachineCodeDeleter());
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