Misha Brukman | bc9ccf6 | 2005-02-04 20:25:52 +0000 | [diff] [blame] | 1 | //===-- AlphaTargetMachine.h - Define TargetMachine for Alpha ---*- C++ -*-===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 2 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 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. |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 7 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 9 | // |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 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" |
Owen Anderson | 07000c6 | 2006-05-12 06:33:49 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetData.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetFrameInfo.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 20 | #include "AlphaInstrInfo.h" |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 21 | #include "AlphaJITInfo.h" |
Andrew Lenharth | 120ab48 | 2005-09-29 22:54:56 +0000 | [diff] [blame] | 22 | #include "AlphaSubtarget.h" |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 23 | #include "AlphaTargetAsmInfo.h" |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 24 | |
| 25 | namespace llvm { |
| 26 | |
| 27 | class GlobalValue; |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 28 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 29 | class AlphaTargetMachine : public LLVMTargetMachine { |
Owen Anderson | a69571c | 2006-05-03 01:29:57 +0000 | [diff] [blame] | 30 | const TargetData DataLayout; // Calculates type size & alignment |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 31 | AlphaInstrInfo InstrInfo; |
| 32 | TargetFrameInfo FrameInfo; |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 33 | AlphaJITInfo JITInfo; |
Andrew Lenharth | 120ab48 | 2005-09-29 22:54:56 +0000 | [diff] [blame] | 34 | AlphaSubtarget Subtarget; |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 35 | AlphaTargetAsmInfo *AsmInfo; |
Owen Anderson | a69571c | 2006-05-03 01:29:57 +0000 | [diff] [blame] | 36 | |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 37 | public: |
Chris Lattner | bc641b9 | 2006-03-23 05:43:16 +0000 | [diff] [blame] | 38 | AlphaTargetMachine(const Module &M, const std::string &FS); |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 39 | ~AlphaTargetMachine() { |
| 40 | if (AsmInfo) delete AsmInfo; |
| 41 | } |
Misha Brukman | 4633f1c | 2005-04-21 23:13:11 +0000 | [diff] [blame] | 42 | |
| 43 | virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 44 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
Andrew Lenharth | 120ab48 | 2005-09-29 22:54:56 +0000 | [diff] [blame] | 45 | virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; } |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 46 | virtual const MRegisterInfo *getRegisterInfo() const { |
| 47 | return &InstrInfo.getRegisterInfo(); |
| 48 | } |
Owen Anderson | a69571c | 2006-05-03 01:29:57 +0000 | [diff] [blame] | 49 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 50 | virtual TargetJITInfo* getJITInfo() { |
| 51 | return &JITInfo; |
| 52 | } |
| 53 | |
Jim Laskey | a0f3d17 | 2006-09-07 22:06:40 +0000 | [diff] [blame] | 54 | virtual const TargetAsmInfo *createTargetAsmInfo() const { |
| 55 | return static_cast<const TargetAsmInfo *>(new AlphaTargetAsmInfo(*this)); |
| 56 | } |
| 57 | |
Andrew Lenharth | 0934ae0 | 2005-07-22 20:52:16 +0000 | [diff] [blame] | 58 | static unsigned getJITMatchQuality(); |
Andrew Lenharth | 2f40163 | 2005-02-01 20:35:11 +0000 | [diff] [blame] | 59 | static unsigned getModuleMatchQuality(const Module &M); |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 60 | |
| 61 | // Pass Pipeline Configuration |
| 62 | virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); |
| 63 | virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); |
| 64 | virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, |
| 65 | std::ostream &Out); |
| 66 | virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast, |
| 67 | MachineCodeEmitter &MCE); |
Andrew Lenharth | 304d0f3 | 2005-01-22 23:41:55 +0000 | [diff] [blame] | 68 | }; |
| 69 | |
| 70 | } // end namespace llvm |
| 71 | |
| 72 | #endif |