blob: 75468923d886c31743b6d0f2dfe1e74086169059 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- AlphaTargetMachine.h - Define TargetMachine for Alpha ---*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file declares the Alpha-specific subclass of TargetMachine.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef ALPHA_TARGETMACHINE_H
15#define ALPHA_TARGETMACHINE_H
16
17#include "llvm/Target/TargetMachine.h"
18#include "llvm/Target/TargetData.h"
19#include "llvm/Target/TargetFrameInfo.h"
20#include "AlphaInstrInfo.h"
21#include "AlphaJITInfo.h"
22#include "AlphaISelLowering.h"
23#include "AlphaSubtarget.h"
24
25namespace llvm {
26
27class GlobalValue;
28
29class AlphaTargetMachine : public LLVMTargetMachine {
30 const TargetData DataLayout; // Calculates type size & alignment
31 AlphaInstrInfo InstrInfo;
32 TargetFrameInfo FrameInfo;
33 AlphaJITInfo JITInfo;
34 AlphaSubtarget Subtarget;
35 AlphaTargetLowering TLInfo;
Anton Korobeynikovbab832e2009-06-19 19:36:55 +000036
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037protected:
38 virtual const TargetAsmInfo *createTargetAsmInfo() const;
Anton Korobeynikovbab832e2009-06-19 19:36:55 +000039
40 // To avoid having target depend on the asmprinter stuff libraries, asmprinter
41 // set this functions to ctor pointer at startup time if they are linked in.
David Greene302008d2009-07-14 20:18:05 +000042 typedef FunctionPass *(*AsmPrinterCtorFn)(formatted_raw_ostream &o,
Anton Korobeynikovbab832e2009-06-19 19:36:55 +000043 TargetMachine &tm,
Anton Korobeynikovbab832e2009-06-19 19:36:55 +000044 bool verbose);
45 static AsmPrinterCtorFn AsmPrinterCtor;
46
Dan Gohmanf17a25c2007-07-18 16:29:46 +000047public:
Stuart Hastings1721b8d2009-07-15 17:27:11 +000048 AlphaTargetMachine(const Module &M, const std::string &FS);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000049
50 virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
51 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Dan Gohmanb41dfba2008-05-14 01:58:56 +000052 virtual const AlphaSubtarget *getSubtargetImpl() const{ return &Subtarget; }
53 virtual const AlphaRegisterInfo *getRegisterInfo() const {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000054 return &InstrInfo.getRegisterInfo();
55 }
Anton Korobeynikovbab832e2009-06-19 19:36:55 +000056 virtual AlphaTargetLowering* getTargetLowering() const {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000057 return const_cast<AlphaTargetLowering*>(&TLInfo);
58 }
59 virtual const TargetData *getTargetData() const { return &DataLayout; }
Dan Gohmanb41dfba2008-05-14 01:58:56 +000060 virtual AlphaJITInfo* getJITInfo() {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000061 return &JITInfo;
62 }
63
Stuart Hastings1721b8d2009-07-15 17:27:11 +000064 static unsigned getJITMatchQuality();
65 static unsigned getModuleMatchQuality(const Module &M);
66
Dan Gohmanf17a25c2007-07-18 16:29:46 +000067 // Pass Pipeline Configuration
Bill Wendling5ed22ac2009-04-29 23:29:43 +000068 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
69 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
70 virtual bool addAssemblyEmitter(PassManagerBase &PM,
71 CodeGenOpt::Level OptLevel,
David Greene302008d2009-07-14 20:18:05 +000072 bool Verbose, formatted_raw_ostream &Out);
Bill Wendling5ed22ac2009-04-29 23:29:43 +000073 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
Evan Cheng77547212007-07-20 21:56:13 +000074 bool DumpAsm, MachineCodeEmitter &MCE);
Bruno Cardoso Lopes1ea31ff2009-05-30 20:51:52 +000075 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
76 bool DumpAsm, JITCodeEmitter &JCE);
Bruno Cardoso Lopesaabb9a52009-07-06 05:09:34 +000077 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
78 bool DumpAsm, ObjectCodeEmitter &JCE);
Bill Wendling5ed22ac2009-04-29 23:29:43 +000079 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
80 CodeGenOpt::Level OptLevel,
81 bool DumpAsm,
82 MachineCodeEmitter &MCE);
Bruno Cardoso Lopes1ea31ff2009-05-30 20:51:52 +000083 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
84 CodeGenOpt::Level OptLevel,
85 bool DumpAsm,
86 JITCodeEmitter &JCE);
Bruno Cardoso Lopesaabb9a52009-07-06 05:09:34 +000087 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
88 CodeGenOpt::Level OptLevel,
89 bool DumpAsm,
90 ObjectCodeEmitter &OCE);
Anton Korobeynikovbab832e2009-06-19 19:36:55 +000091
92 static void registerAsmPrinter(AsmPrinterCtorFn F) {
93 AsmPrinterCtor = F;
94 }
Dan Gohmanf17a25c2007-07-18 16:29:46 +000095};
96
97} // end namespace llvm
98
99#endif