0538c9a1a586916fc162de794038d99063ac50c4
[oota-llvm.git] / lib / Target / Blackfin / BlackfinTargetMachine.h
1 //===-- BlackfinTargetMachine.h - TargetMachine for Blackfin ----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the Blackfin specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef BLACKFINTARGETMACHINE_H
15 #define BLACKFINTARGETMACHINE_H
16
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetData.h"
19 #include "llvm/Target/TargetFrameInfo.h"
20 #include "BlackfinInstrInfo.h"
21 #include "BlackfinSubtarget.h"
22 #include "BlackfinISelLowering.h"
23
24 namespace llvm {
25
26   class Module;
27
28   class BlackfinTargetMachine : public LLVMTargetMachine {
29     const TargetData DataLayout;
30     BlackfinSubtarget Subtarget;
31     BlackfinTargetLowering TLInfo;
32     BlackfinInstrInfo InstrInfo;
33     TargetFrameInfo FrameInfo;
34
35   protected:
36     virtual const TargetAsmInfo *createTargetAsmInfo() const;
37
38   public:
39     BlackfinTargetMachine(const Target &T, const Module &M,
40                           const std::string &FS);
41
42     virtual const BlackfinInstrInfo *getInstrInfo() const { return &InstrInfo; }
43     virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
44     virtual const BlackfinSubtarget *getSubtargetImpl() const {
45       return &Subtarget;
46     }
47     virtual const BlackfinRegisterInfo *getRegisterInfo() const {
48       return &InstrInfo.getRegisterInfo();
49     }
50     virtual BlackfinTargetLowering* getTargetLowering() const {
51       return const_cast<BlackfinTargetLowering*>(&TLInfo);
52     }
53     virtual const TargetData *getTargetData() const { return &DataLayout; }
54     static unsigned getModuleMatchQuality(const Module &M);
55     virtual bool addInstSelector(PassManagerBase &PM,
56                                  CodeGenOpt::Level OptLevel);
57   };
58
59 } // end namespace llvm
60
61 #endif