blob: baf3ca820750157994954b34f6e60f41584ec7a8 [file] [log] [blame]
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +00001//===-- AlphaTargetMachine.cpp - Define TargetMachine for Alpha -------===//
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 "Alpha.h"
14#include "AlphaTargetMachine.h"
15#include "llvm/Module.h"
16#include "llvm/CodeGen/IntrinsicLowering.h"
17#include "llvm/CodeGen/MachineFunction.h"
18#include "llvm/CodeGen/Passes.h"
19#include "llvm/Target/TargetOptions.h"
20#include "llvm/Target/TargetMachineRegistry.h"
21#include "llvm/Transforms/Scalar.h"
22#include "llvm/Support/CommandLine.h"
23#include <iostream>
24using namespace llvm;
25
26namespace {
27 // Register the targets
28 RegisterTarget<AlphaTargetMachine> X("alpha", " Alpha (incomplete)");
29}
30
31AlphaTargetMachine::AlphaTargetMachine( const Module &M, IntrinsicLowering *IL)
32 : TargetMachine("alpha", IL, true),
33 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, 0) //TODO: check these
34 //JITInfo(*this)
35{}
36
37bool AlphaTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
38 MachineCodeEmitter &MCE)
39{
40 assert(0 && "TODO");
41 return false;
42}
43
44
45/// addPassesToEmitAssembly - Add passes to the specified pass manager
46/// to implement a static compiler for this target.
47///
48bool AlphaTargetMachine::addPassesToEmitAssembly(PassManager &PM,
49 std::ostream &Out) {
50
51 // FIXME: Implement efficient support for garbage collection intrinsics.
52 PM.add(createLowerGCPass());
53
54 // FIXME: Implement the invoke/unwind instructions!
55 PM.add(createLowerInvokePass());
56
57 // FIXME: Implement the switch instruction in the instruction selector!
58 PM.add(createLowerSwitchPass());
59
60 PM.add(createLowerConstantExpressionsPass());
61
62 // Make sure that no unreachable blocks are instruction selected.
63 PM.add(createUnreachableBlockEliminationPass());
64
65 PM.add(createAlphaPatternInstructionSelector(*this));
66
67 if (PrintMachineCode)
68 PM.add(createMachineFunctionPrinterPass(&std::cerr));
69
70 PM.add(createRegisterAllocator());
71
72 if (PrintMachineCode)
73 PM.add(createMachineFunctionPrinterPass(&std::cerr));
74
75 PM.add(createPrologEpilogCodeInserter());
76
77 // Must run branch selection immediately preceding the asm printer
78 //PM.add(createAlphaBranchSelectionPass());
79
80 PM.add(createAlphaCodePrinterPass(Out, *this));
81
82 PM.add(createMachineCodeDeleter());
83 return false;
84}
85
86//void AlphaJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
87// // FIXME: Implement efficient support for garbage collection intrinsics.
88// PM.add(createLowerGCPass());
89
90// // FIXME: Implement the invoke/unwind instructions!
91// PM.add(createLowerInvokePass());
92
93// // FIXME: Implement the switch instruction in the instruction selector!
94// PM.add(createLowerSwitchPass());
95
96// PM.add(createLowerConstantExpressionsPass());
97
98// // Make sure that no unreachable blocks are instruction selected.
99// PM.add(createUnreachableBlockEliminationPass());
100
101// PM.add(createPPC32ISelSimple(TM));
102// PM.add(createRegisterAllocator());
103// PM.add(createPrologEpilogCodeInserter());
104
105// // Must run branch selection immediately preceding the asm printer
106// PM.add(createPPCBranchSelectionPass());
107
108// if (PrintMachineCode)
109// PM.add(createMachineFunctionPrinterPass(&std::cerr));
110//}
111