Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 1 | //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the "Instituto Nokia de Tecnologia" and |
| 6 | // is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | // |
| 11 | // This file declares the ARM specific subclass of TargetMachine. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #ifndef ARMTARGETMACHINE_H |
| 16 | #define ARMTARGETMACHINE_H |
| 17 | |
| 18 | #include "llvm/Target/TargetMachine.h" |
| 19 | #include "llvm/Target/TargetData.h" |
| 20 | #include "llvm/Target/TargetFrameInfo.h" |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 21 | #include "ARMInstrInfo.h" |
Rafael Espindola | ec46ea3 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 22 | #include "ARMFrameInfo.h" |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 23 | #include "ARMSubtarget.h" |
Evan Cheng | e8308df | 2007-03-13 01:20:42 +0000 | [diff] [blame] | 24 | #include "ARMISelLowering.h" |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 25 | |
| 26 | namespace llvm { |
| 27 | |
| 28 | class Module; |
| 29 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 30 | class ARMTargetMachine : public LLVMTargetMachine { |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 31 | ARMSubtarget Subtarget; |
| 32 | const TargetData DataLayout; // Calculates type size & alignment |
| 33 | ARMInstrInfo InstrInfo; |
| 34 | ARMFrameInfo FrameInfo; |
Evan Cheng | e8308df | 2007-03-13 01:20:42 +0000 | [diff] [blame] | 35 | ARMTargetLowering TLInfo; |
| 36 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 37 | public: |
Evan Cheng | 04321f7 | 2007-02-23 03:14:31 +0000 | [diff] [blame] | 38 | ARMTargetMachine(const Module &M, const std::string &FS, bool isThumb = false); |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 39 | |
| 40 | virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; } |
| 41 | virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; } |
| 42 | virtual const MRegisterInfo *getRegisterInfo() const { |
| 43 | return &InstrInfo.getRegisterInfo(); |
| 44 | } |
| 45 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 46 | virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; } |
Evan Cheng | e8308df | 2007-03-13 01:20:42 +0000 | [diff] [blame] | 47 | virtual ARMTargetLowering *getTargetLowering() const { |
| 48 | return const_cast<ARMTargetLowering*>(&TLInfo); |
| 49 | } |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 50 | static unsigned getModuleMatchQuality(const Module &M); |
| 51 | |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 52 | virtual const TargetAsmInfo *createTargetAsmInfo() const; |
| 53 | |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 54 | // Pass Pipeline Configuration |
| 55 | virtual bool addInstSelector(FunctionPassManager &PM, bool Fast); |
Evan Cheng | 9307292 | 2007-05-16 02:01:49 +0000 | [diff] [blame] | 56 | virtual bool addPostRegAlloc(FunctionPassManager &PM, bool Fast); |
Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame] | 57 | virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast); |
Chris Lattner | 1911fd4 | 2006-09-04 04:14:57 +0000 | [diff] [blame] | 58 | virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, |
| 59 | std::ostream &Out); |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
Evan Cheng | 04321f7 | 2007-02-23 03:14:31 +0000 | [diff] [blame] | 62 | /// ThumbTargetMachine - Thumb target machine. |
| 63 | /// |
| 64 | class ThumbTargetMachine : public ARMTargetMachine { |
| 65 | public: |
| 66 | ThumbTargetMachine(const Module &M, const std::string &FS); |
| 67 | |
| 68 | static unsigned getModuleMatchQuality(const Module &M); |
| 69 | }; |
| 70 | |
Rafael Espindola | 7bc59bc | 2006-05-14 22:18:28 +0000 | [diff] [blame] | 71 | } // end namespace llvm |
| 72 | |
| 73 | #endif |