1 //===-- PowerPCTargetMachine.cpp - Define TargetMachine for PowerPC -------===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
13 #include "PowerPCTargetMachine.h"
15 #include "llvm/Module.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/Target/TargetMachineImpls.h"
18 #include "llvm/Target/TargetMachineRegistry.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/CodeGen/Passes.h"
24 // Register the target.
25 RegisterTarget<PowerPCTargetMachine> X("powerpc", "PowerPC (experimental)");
28 // allocatePowerPCTargetMachine - Allocate and return a subclass of
29 // TargetMachine that implements the PowerPC backend.
31 TargetMachine *llvm::allocatePowerPCTargetMachine(const Module &M,
32 IntrinsicLowering *IL) {
33 return new PowerPCTargetMachine(M, IL);
36 /// PowerPCTargetMachine ctor - Create an ILP32 architecture model
38 PowerPCTargetMachine::PowerPCTargetMachine(const Module &M,
39 IntrinsicLowering *IL)
40 : TargetMachine("PowerPC", IL, true, 4, 4, 4, 4, 4),
41 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), JITInfo(*this) {
44 /// addPassesToEmitAssembly - Add passes to the specified pass manager
45 /// to implement a static compiler for this target.
47 bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
49 // <insert instruction selector passes here>
50 PM.add(createRegisterAllocator());
51 PM.add(createPrologEpilogCodeInserter());
52 // <insert assembly code output passes here>
53 PM.add(createMachineCodeDeleter());
54 return true; // change to `return false' when this actually works.
57 /// addPassesToJITCompile - Add passes to the specified pass manager to
58 /// implement a fast dynamic compiler for this target.
60 void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
61 // <insert instruction selector passes here>
62 PM.add(createRegisterAllocator());
63 PM.add(createPrologEpilogCodeInserter());