blob: 40ba4b33af60408a4ba8b928efb82cbbfd69a2c0 [file] [log] [blame]
Misha Brukman076b9f42005-02-04 20:25:52 +00001//===-- AlphaTargetMachine.h - Define TargetMachine for Alpha ---*- C++ -*-===//
Misha Brukman89b8c8d2005-04-21 23:13:11 +00002//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman89b8c8d2005-04-21 23:13:11 +00007//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +00008//===----------------------------------------------------------------------===//
Misha Brukman89b8c8d2005-04-21 23:13:11 +00009//
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000010// 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"
Owen Anderson8c2c1e92006-05-12 06:33:49 +000018#include "llvm/Target/TargetData.h"
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000019#include "llvm/Target/TargetFrameInfo.h"
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000020#include "AlphaInstrInfo.h"
Andrew Lenharth55d04512005-07-22 20:52:16 +000021#include "AlphaJITInfo.h"
Andrew Lenhartha6bbf332006-10-11 04:29:42 +000022#include "AlphaISelLowering.h"
Andrew Lenhartha7a83b92005-09-29 22:54:56 +000023#include "AlphaSubtarget.h"
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000024
25namespace llvm {
26
27class GlobalValue;
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000028
Chris Lattner12e97302006-09-04 04:14:57 +000029class AlphaTargetMachine : public LLVMTargetMachine {
Owen Anderson20a631f2006-05-03 01:29:57 +000030 const TargetData DataLayout; // Calculates type size & alignment
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000031 AlphaInstrInfo InstrInfo;
32 TargetFrameInfo FrameInfo;
Andrew Lenharth55d04512005-07-22 20:52:16 +000033 AlphaJITInfo JITInfo;
Andrew Lenhartha7a83b92005-09-29 22:54:56 +000034 AlphaSubtarget Subtarget;
Andrew Lenhartha6bbf332006-10-11 04:29:42 +000035 AlphaTargetLowering TLInfo;
Anton Korobeynikov2028e252009-06-19 19:36:55 +000036
Jim Laskeyae92ce82006-09-07 23:39:26 +000037protected:
38 virtual const TargetAsmInfo *createTargetAsmInfo() const;
Anton Korobeynikov2028e252009-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.
42 typedef FunctionPass *(*AsmPrinterCtorFn)(raw_ostream &o,
43 TargetMachine &tm,
Anton Korobeynikov2028e252009-06-19 19:36:55 +000044 bool verbose);
45 static AsmPrinterCtorFn AsmPrinterCtor;
46
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000047public:
Chris Lattner6f95ab72006-03-23 05:43:16 +000048 AlphaTargetMachine(const Module &M, const std::string &FS);
Misha Brukman89b8c8d2005-04-21 23:13:11 +000049
50 virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000051 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Dan Gohmaneabd6472008-05-14 01:58:56 +000052 virtual const AlphaSubtarget *getSubtargetImpl() const{ return &Subtarget; }
53 virtual const AlphaRegisterInfo *getRegisterInfo() const {
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000054 return &InstrInfo.getRegisterInfo();
55 }
Anton Korobeynikov2028e252009-06-19 19:36:55 +000056 virtual AlphaTargetLowering* getTargetLowering() const {
Andrew Lenhartha6bbf332006-10-11 04:29:42 +000057 return const_cast<AlphaTargetLowering*>(&TLInfo);
58 }
Owen Anderson20a631f2006-05-03 01:29:57 +000059 virtual const TargetData *getTargetData() const { return &DataLayout; }
Dan Gohmaneabd6472008-05-14 01:58:56 +000060 virtual AlphaJITInfo* getJITInfo() {
Andrew Lenharth55d04512005-07-22 20:52:16 +000061 return &JITInfo;
62 }
63
64 static unsigned getJITMatchQuality();
Andrew Lenharth8fb0d502005-02-01 20:35:11 +000065 static unsigned getModuleMatchQuality(const Module &M);
Anton Korobeynikov2028e252009-06-19 19:36:55 +000066
Chris Lattner12e97302006-09-04 04:14:57 +000067 // Pass Pipeline Configuration
Bill Wendling026e5d72009-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,
Evan Cheng5e5a63c2009-03-25 01:47:28 +000072 bool Verbose, raw_ostream &Out);
Bill Wendling026e5d72009-04-29 23:29:43 +000073 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
Evan Cheng9d5df0a2007-07-20 21:56:13 +000074 bool DumpAsm, MachineCodeEmitter &MCE);
Bruno Cardoso Lopesa194c3a2009-05-30 20:51:52 +000075 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
76 bool DumpAsm, JITCodeEmitter &JCE);
Bruno Cardoso Lopes5661ea62009-07-06 05:09:34 +000077 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
78 bool DumpAsm, ObjectCodeEmitter &JCE);
Bill Wendling026e5d72009-04-29 23:29:43 +000079 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
80 CodeGenOpt::Level OptLevel,
81 bool DumpAsm,
82 MachineCodeEmitter &MCE);
Bruno Cardoso Lopesa194c3a2009-05-30 20:51:52 +000083 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
84 CodeGenOpt::Level OptLevel,
85 bool DumpAsm,
86 JITCodeEmitter &JCE);
Bruno Cardoso Lopes5661ea62009-07-06 05:09:34 +000087 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
88 CodeGenOpt::Level OptLevel,
89 bool DumpAsm,
90 ObjectCodeEmitter &OCE);
Anton Korobeynikov2028e252009-06-19 19:36:55 +000091
92 static void registerAsmPrinter(AsmPrinterCtorFn F) {
93 AsmPrinterCtor = F;
94 }
Andrew Lenhartha1b5ca22005-01-22 23:41:55 +000095};
96
97} // end namespace llvm
98
99#endif