1 //===-- AlphaTargetMachine.h - Define TargetMachine for Alpha ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the Alpha-specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef ALPHA_TARGETMACHINE_H
15 #define ALPHA_TARGETMACHINE_H
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"
29 class AlphaTargetMachine : public LLVMTargetMachine {
30 const TargetData DataLayout; // Calculates type size & alignment
31 AlphaInstrInfo InstrInfo;
32 TargetFrameInfo FrameInfo;
34 AlphaSubtarget Subtarget;
35 AlphaTargetLowering TLInfo;
38 virtual const TargetAsmInfo *createTargetAsmInfo() const;
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.
42 typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
44 CodeGenOpt::Level OptLevel,
46 static AsmPrinterCtorFn AsmPrinterCtor;
49 AlphaTargetMachine(const Module &M, const std::string &FS);
51 virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
52 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
53 virtual const AlphaSubtarget *getSubtargetImpl() const{ return &Subtarget; }
54 virtual const AlphaRegisterInfo *getRegisterInfo() const {
55 return &InstrInfo.getRegisterInfo();
57 virtual AlphaTargetLowering* getTargetLowering() const {
58 return const_cast<AlphaTargetLowering*>(&TLInfo);
60 virtual const TargetData *getTargetData() const { return &DataLayout; }
61 virtual AlphaJITInfo* getJITInfo() {
65 static unsigned getJITMatchQuality();
66 static unsigned getModuleMatchQuality(const Module &M);
68 // Pass Pipeline Configuration
69 virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
70 virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
71 virtual bool addAssemblyEmitter(PassManagerBase &PM,
72 CodeGenOpt::Level OptLevel,
73 bool Verbose, raw_ostream &Out);
74 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
75 bool DumpAsm, MachineCodeEmitter &MCE);
76 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
77 bool DumpAsm, JITCodeEmitter &JCE);
78 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
79 CodeGenOpt::Level OptLevel,
81 MachineCodeEmitter &MCE);
82 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
83 CodeGenOpt::Level OptLevel,
87 static void registerAsmPrinter(AsmPrinterCtorFn F) {
92 } // end namespace llvm