Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 1 | //===-- MipsTargetMachine.h - Define TargetMachine for Mips -00--*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file declares the Mips specific subclass of TargetMachine. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef MIPSTARGETMACHINE_H |
| 15 | #define MIPSTARGETMACHINE_H |
| 16 | |
| 17 | #include "MipsSubtarget.h" |
| 18 | #include "MipsInstrInfo.h" |
| 19 | #include "MipsISelLowering.h" |
| 20 | #include "llvm/Target/TargetMachine.h" |
| 21 | #include "llvm/Target/TargetData.h" |
| 22 | #include "llvm/Target/TargetFrameInfo.h" |
| 23 | |
| 24 | namespace llvm { |
| 25 | class MipsTargetMachine : public LLVMTargetMachine { |
| 26 | MipsSubtarget Subtarget; |
| 27 | const TargetData DataLayout; // Calculates type size & alignment |
| 28 | MipsInstrInfo InstrInfo; |
| 29 | TargetFrameInfo FrameInfo; |
| 30 | MipsTargetLowering TLInfo; |
| 31 | |
| 32 | protected: |
| 33 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 34 | |
| 35 | public: |
Bruno Cardoso Lopes | d2947ee | 2008-06-04 01:45:25 +0000 | [diff] [blame^] | 36 | MipsTargetMachine(const Module &M, const std::string &FS, bool isLittle); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 37 | |
| 38 | virtual const MipsInstrInfo *getInstrInfo() const |
| 39 | { return &InstrInfo; } |
| 40 | virtual const TargetFrameInfo *getFrameInfo() const |
| 41 | { return &FrameInfo; } |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 42 | virtual const MipsSubtarget *getSubtargetImpl() const |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 43 | { return &Subtarget; } |
| 44 | virtual const TargetData *getTargetData() const |
| 45 | { return &DataLayout;} |
| 46 | |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 47 | virtual const MipsRegisterInfo *getRegisterInfo() const { |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 48 | return &InstrInfo.getRegisterInfo(); |
| 49 | } |
| 50 | |
| 51 | virtual MipsTargetLowering *getTargetLowering() const { |
| 52 | return const_cast<MipsTargetLowering*>(&TLInfo); |
| 53 | } |
| 54 | |
| 55 | static unsigned getModuleMatchQuality(const Module &M); |
| 56 | |
| 57 | // Pass Pipeline Configuration |
Dan Gohman | bfae831 | 2008-03-11 22:29:46 +0000 | [diff] [blame] | 58 | virtual bool addInstSelector(PassManagerBase &PM, bool Fast); |
| 59 | virtual bool addPreEmitPass(PassManagerBase &PM, bool Fast); |
| 60 | virtual bool addAssemblyEmitter(PassManagerBase &PM, bool Fast, |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 61 | std::ostream &Out); |
| 62 | }; |
Bruno Cardoso Lopes | d2947ee | 2008-06-04 01:45:25 +0000 | [diff] [blame^] | 63 | |
| 64 | /// MipselTargetMachine - Mipsel target machine. |
| 65 | /// |
| 66 | class MipselTargetMachine : public MipsTargetMachine { |
| 67 | public: |
| 68 | MipselTargetMachine(const Module &M, const std::string &FS); |
| 69 | |
| 70 | static unsigned getModuleMatchQuality(const Module &M); |
| 71 | }; |
| 72 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 73 | } // End llvm namespace |
| 74 | |
| 75 | #endif |