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 { |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame] | 25 | class raw_ostream; |
| 26 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 27 | class MipsTargetMachine : public LLVMTargetMachine { |
| 28 | MipsSubtarget Subtarget; |
| 29 | const TargetData DataLayout; // Calculates type size & alignment |
| 30 | MipsInstrInfo InstrInfo; |
| 31 | TargetFrameInfo FrameInfo; |
| 32 | MipsTargetLowering TLInfo; |
| 33 | |
| 34 | protected: |
| 35 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 36 | |
| 37 | public: |
Bruno Cardoso Lopes | d2947ee | 2008-06-04 01:45:25 +0000 | [diff] [blame] | 38 | MipsTargetMachine(const Module &M, const std::string &FS, bool isLittle); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 39 | |
| 40 | virtual const MipsInstrInfo *getInstrInfo() const |
| 41 | { return &InstrInfo; } |
| 42 | virtual const TargetFrameInfo *getFrameInfo() const |
| 43 | { return &FrameInfo; } |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 44 | virtual const MipsSubtarget *getSubtargetImpl() const |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 45 | { return &Subtarget; } |
| 46 | virtual const TargetData *getTargetData() const |
| 47 | { return &DataLayout;} |
| 48 | |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 49 | virtual const MipsRegisterInfo *getRegisterInfo() const { |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 50 | return &InstrInfo.getRegisterInfo(); |
| 51 | } |
| 52 | |
| 53 | virtual MipsTargetLowering *getTargetLowering() const { |
| 54 | return const_cast<MipsTargetLowering*>(&TLInfo); |
| 55 | } |
| 56 | |
| 57 | static unsigned getModuleMatchQuality(const Module &M); |
| 58 | |
| 59 | // Pass Pipeline Configuration |
Bill Wendling | 98a366d | 2009-04-29 23:29:43 +0000 | [diff] [blame^] | 60 | virtual bool addInstSelector(PassManagerBase &PM, |
| 61 | CodeGenOpt::Level OptLevel); |
| 62 | virtual bool addPreEmitPass(PassManagerBase &PM, |
| 63 | CodeGenOpt::Level OptLevel); |
| 64 | virtual bool addAssemblyEmitter(PassManagerBase &PM, |
| 65 | CodeGenOpt::Level OptLevel, |
Evan Cheng | 42bf74b | 2009-03-25 01:47:28 +0000 | [diff] [blame] | 66 | bool Verbose, raw_ostream &Out); |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 67 | }; |
Bruno Cardoso Lopes | d2947ee | 2008-06-04 01:45:25 +0000 | [diff] [blame] | 68 | |
| 69 | /// MipselTargetMachine - Mipsel target machine. |
| 70 | /// |
| 71 | class MipselTargetMachine : public MipsTargetMachine { |
| 72 | public: |
| 73 | MipselTargetMachine(const Module &M, const std::string &FS); |
| 74 | |
| 75 | static unsigned getModuleMatchQuality(const Module &M); |
| 76 | }; |
| 77 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 78 | } // End llvm namespace |
| 79 | |
| 80 | #endif |