blob: a8389fa96d8e77609b25398c6e9869ee0d28196a [file] [log] [blame]
Brian Gaekee785e532004-02-25 19:28:19 +00001//===-- SparcV8TargetMachine.cpp - Define TargetMachine for SparcV8 -------===//
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 "SparcV8TargetMachine.h"
14#include "SparcV8.h"
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
21namespace llvm {
22
23// allocateSparcV8TargetMachine - Allocate and return a subclass of
24// TargetMachine that implements the SparcV8 backend.
25//
26TargetMachine *allocateSparcV8TargetMachine(const Module &M,
27 IntrinsicLowering *IL) {
28 return new SparcV8TargetMachine(M, IL);
29}
30
31/// SparcV8TargetMachine ctor - Create an ILP32 architecture model
32///
33SparcV8TargetMachine::SparcV8TargetMachine(const Module &M,
34 IntrinsicLowering *IL)
35 : TargetMachine("SparcV8", IL, true, 4, 4, 4, 4, 4),
36 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 4), JITInfo(*this) {
37}
38
39/// addPassesToEmitAssembly - Add passes to the specified pass manager
40/// to implement a static compiler for this target.
41///
42bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM,
43 std::ostream &Out) {
44 // <insert instruction selector passes here>
45 PM.add(createRegisterAllocator());
46 PM.add(createPrologEpilogCodeInserter());
47 // <insert assembly code output passes here>
48 PM.add(createMachineCodeDeleter());
49 return true; // change to `return false' when this actually works.
50}
51
52/// addPassesToJITCompile - Add passes to the specified pass manager to
53/// implement a fast dynamic compiler for this target.
54///
55void SparcV8JITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
56 // <insert instruction selector passes here>
57 PM.add(createRegisterAllocator());
58 PM.add(createPrologEpilogCodeInserter());
59}
60
61} // end namespace llvm