1 //===-- SparcTargetMachine.h - Define TargetMachine for Sparc ---*- 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 Sparc specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef SPARCTARGETMACHINE_H
15 #define SPARCTARGETMACHINE_H
16 
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetData.h"
19 #include "llvm/Target/TargetFrameInfo.h"
20 #include "SparcInstrInfo.h"
21 #include "SparcSubtarget.h"
22 #include "SparcISelLowering.h"
23 
24 namespace llvm {
25 
26 class SparcTargetMachine : public LLVMTargetMachine {
27   const TargetData DataLayout;       // Calculates type size & alignment
28   SparcSubtarget Subtarget;
29   SparcTargetLowering TLInfo;
30   SparcInstrInfo InstrInfo;
31   TargetFrameInfo FrameInfo;
32 
33 protected:
34   virtual const TargetAsmInfo *createTargetAsmInfo() const;
35 
36 public:
37   SparcTargetMachine(const Target &T, const std::string &TT,
38                      const std::string &FS);
39 
40   virtual const SparcInstrInfo *getInstrInfo() const { return &InstrInfo; }
41   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
42   virtual const SparcSubtarget   *getSubtargetImpl() const{ return &Subtarget; }
43   virtual const SparcRegisterInfo *getRegisterInfo() const {
44     return &InstrInfo.getRegisterInfo();
45   }
46   virtual SparcTargetLowering* getTargetLowering() const {
47     return const_cast<SparcTargetLowering*>(&TLInfo);
48   }
49   virtual const TargetData       *getTargetData() const { return &DataLayout; }
50 
51   // Pass Pipeline Configuration
52   virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
53   virtual bool addPreEmitPass(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
54 };
55 
56 } // end namespace llvm
57 
58 #endif
59