blob: 946ca559ca04812769b41f31c8ddf9d8ecc8cde6 [file] [log] [blame]
Misha Brukmanbc9ccf62005-02-04 20:25:52 +00001//===-- AlphaTargetMachine.h - Define TargetMachine for Alpha ---*- C++ -*-===//
Misha Brukman4633f1c2005-04-21 23:13:11 +00002//
Andrew Lenharth304d0f32005-01-22 23:41:55 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-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 Brukman4633f1c2005-04-21 23:13:11 +00007//
Andrew Lenharth304d0f32005-01-22 23:41:55 +00008//===----------------------------------------------------------------------===//
Misha Brukman4633f1c2005-04-21 23:13:11 +00009//
Andrew Lenharth304d0f32005-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 Anderson07000c62006-05-12 06:33:49 +000018#include "llvm/Target/TargetData.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000019#include "llvm/Target/TargetFrameInfo.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000020#include "AlphaInstrInfo.h"
Andrew Lenharth0934ae02005-07-22 20:52:16 +000021#include "AlphaJITInfo.h"
Andrew Lenharth82c3d8f2006-10-11 04:29:42 +000022#include "AlphaISelLowering.h"
Andrew Lenharth120ab482005-09-29 22:54:56 +000023#include "AlphaSubtarget.h"
Andrew Lenharth304d0f32005-01-22 23:41:55 +000024
25namespace llvm {
26
27class GlobalValue;
Andrew Lenharth304d0f32005-01-22 23:41:55 +000028
Chris Lattner1911fd42006-09-04 04:14:57 +000029class AlphaTargetMachine : public LLVMTargetMachine {
Owen Andersona69571c2006-05-03 01:29:57 +000030 const TargetData DataLayout; // Calculates type size & alignment
Andrew Lenharth304d0f32005-01-22 23:41:55 +000031 AlphaInstrInfo InstrInfo;
32 TargetFrameInfo FrameInfo;
Andrew Lenharth0934ae02005-07-22 20:52:16 +000033 AlphaJITInfo JITInfo;
Andrew Lenharth120ab482005-09-29 22:54:56 +000034 AlphaSubtarget Subtarget;
Andrew Lenharth82c3d8f2006-10-11 04:29:42 +000035 AlphaTargetLowering TLInfo;
Anton Korobeynikove494b9e2009-06-19 19:36:55 +000036
Jim Laskeyfde1b3b2006-09-07 23:39:26 +000037protected:
38 virtual const TargetAsmInfo *createTargetAsmInfo() const;
Anton Korobeynikove494b9e2009-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,
44 CodeGenOpt::Level OptLevel,
45 bool verbose);
46 static AsmPrinterCtorFn AsmPrinterCtor;
47
Andrew Lenharth304d0f32005-01-22 23:41:55 +000048public:
Chris Lattnerbc641b92006-03-23 05:43:16 +000049 AlphaTargetMachine(const Module &M, const std::string &FS);
Misha Brukman4633f1c2005-04-21 23:13:11 +000050
51 virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
Andrew Lenharth304d0f32005-01-22 23:41:55 +000052 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000053 virtual const AlphaSubtarget *getSubtargetImpl() const{ return &Subtarget; }
54 virtual const AlphaRegisterInfo *getRegisterInfo() const {
Andrew Lenharth304d0f32005-01-22 23:41:55 +000055 return &InstrInfo.getRegisterInfo();
56 }
Anton Korobeynikove494b9e2009-06-19 19:36:55 +000057 virtual AlphaTargetLowering* getTargetLowering() const {
Andrew Lenharth82c3d8f2006-10-11 04:29:42 +000058 return const_cast<AlphaTargetLowering*>(&TLInfo);
59 }
Owen Andersona69571c2006-05-03 01:29:57 +000060 virtual const TargetData *getTargetData() const { return &DataLayout; }
Dan Gohmanc9f5f3f2008-05-14 01:58:56 +000061 virtual AlphaJITInfo* getJITInfo() {
Andrew Lenharth0934ae02005-07-22 20:52:16 +000062 return &JITInfo;
63 }
64
65 static unsigned getJITMatchQuality();
Andrew Lenharth2f401632005-02-01 20:35:11 +000066 static unsigned getModuleMatchQuality(const Module &M);
Anton Korobeynikove494b9e2009-06-19 19:36:55 +000067
Chris Lattner1911fd42006-09-04 04:14:57 +000068 // Pass Pipeline Configuration
Bill Wendling98a366d2009-04-29 23:29:43 +000069 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,
Evan Cheng42bf74b2009-03-25 01:47:28 +000073 bool Verbose, raw_ostream &Out);
Bill Wendling98a366d2009-04-29 23:29:43 +000074 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
Evan Cheng8bd60352007-07-20 21:56:13 +000075 bool DumpAsm, MachineCodeEmitter &MCE);
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000076 virtual bool addCodeEmitter(PassManagerBase &PM, CodeGenOpt::Level OptLevel,
77 bool DumpAsm, JITCodeEmitter &JCE);
Bill Wendling98a366d2009-04-29 23:29:43 +000078 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
79 CodeGenOpt::Level OptLevel,
80 bool DumpAsm,
81 MachineCodeEmitter &MCE);
Bruno Cardoso Lopesa3f99f92009-05-30 20:51:52 +000082 virtual bool addSimpleCodeEmitter(PassManagerBase &PM,
83 CodeGenOpt::Level OptLevel,
84 bool DumpAsm,
85 JITCodeEmitter &JCE);
Anton Korobeynikove494b9e2009-06-19 19:36:55 +000086
87 static void registerAsmPrinter(AsmPrinterCtorFn F) {
88 AsmPrinterCtor = F;
89 }
Andrew Lenharth304d0f32005-01-22 23:41:55 +000090};
91
92} // end namespace llvm
93
94#endif