LLVM  6.0.0svn
AVRSubtarget.h
Go to the documentation of this file.
1 //===-- AVRSubtarget.h - Define Subtarget for the AVR -----------*- 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 AVR specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_AVR_SUBTARGET_H
15 #define LLVM_AVR_SUBTARGET_H
16 
18 #include "llvm/IR/DataLayout.h"
20 
21 #include "AVRFrameLowering.h"
22 #include "AVRISelLowering.h"
23 #include "AVRInstrInfo.h"
24 #include "AVRSelectionDAGInfo.h"
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "AVRGenSubtargetInfo.inc"
28 
29 namespace llvm {
30 
31 /// A specific AVR target MCU.
33 public:
34  //! Creates an AVR subtarget.
35  //! \param TT The target triple.
36  //! \param CPU The CPU to target.
37  //! \param FS The feature string.
38  //! \param TM The target machine.
39  AVRSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
41 
42  const AVRInstrInfo *getInstrInfo() const override { return &InstrInfo; }
43  const TargetFrameLowering *getFrameLowering() const override { return &FrameLowering; }
44  const AVRTargetLowering *getTargetLowering() const override { return &TLInfo; }
45  const AVRSelectionDAGInfo *getSelectionDAGInfo() const override { return &TSInfo; }
46  const AVRRegisterInfo *getRegisterInfo() const override { return &InstrInfo.getRegisterInfo(); }
47 
48  /// Parses a subtarget feature string, setting appropriate options.
49  /// \note Definition of function is auto generated by `tblgen`.
51 
52  // Subtarget feature getters.
53  // See AVR.td for details.
54  bool hasSRAM() const { return m_hasSRAM; }
55  bool hasJMPCALL() const { return m_hasJMPCALL; }
56  bool hasIJMPCALL() const { return m_hasIJMPCALL; }
57  bool hasEIJMPCALL() const { return m_hasEIJMPCALL; }
58  bool hasADDSUBIW() const { return m_hasADDSUBIW; }
59  bool hasSmallStack() const { return m_hasSmallStack; }
60  bool hasMOVW() const { return m_hasMOVW; }
61  bool hasLPM() const { return m_hasLPM; }
62  bool hasLPMX() const { return m_hasLPMX; }
63  bool hasELPM() const { return m_hasELPM; }
64  bool hasELPMX() const { return m_hasELPMX; }
65  bool hasSPM() const { return m_hasSPM; }
66  bool hasSPMX() const { return m_hasSPMX; }
67  bool hasDES() const { return m_hasDES; }
68  bool supportsRMW() const { return m_supportsRMW; }
69  bool supportsMultiplication() const { return m_supportsMultiplication; }
70  bool hasBREAK() const { return m_hasBREAK; }
71  bool hasTinyEncoding() const { return m_hasTinyEncoding; }
72 
73  /// Gets the ELF architecture for the e_flags field
74  /// of an ELF object file.
75  unsigned getELFArch() const {
76  assert(ELFArch != 0 &&
77  "every device must have an associate ELF architecture");
78  return ELFArch;
79  }
80 
81 private:
82  AVRInstrInfo InstrInfo;
83  AVRFrameLowering FrameLowering;
84  AVRTargetLowering TLInfo;
85  AVRSelectionDAGInfo TSInfo;
86 
87  // Subtarget feature settings
88  // See AVR.td for details.
89  bool m_hasSRAM;
90  bool m_hasJMPCALL;
91  bool m_hasIJMPCALL;
92  bool m_hasEIJMPCALL;
93  bool m_hasADDSUBIW;
94  bool m_hasSmallStack;
95  bool m_hasMOVW;
96  bool m_hasLPM;
97  bool m_hasLPMX;
98  bool m_hasELPM;
99  bool m_hasELPMX;
100  bool m_hasSPM;
101  bool m_hasSPMX;
102  bool m_hasDES;
103  bool m_supportsRMW;
104  bool m_supportsMultiplication;
105  bool m_hasBREAK;
106  bool m_hasTinyEncoding;
107 
108  /// The ELF e_flags architecture.
109  unsigned ELFArch;
110 
111  // Dummy member, used by FeatureSet's. We cannot have a SubtargetFeature with
112  // no variable, so we instead bind pseudo features to this variable.
113  bool m_FeatureSetDummy;
114 };
115 
116 } // end namespace llvm
117 
118 #endif // LLVM_AVR_SUBTARGET_H
const AVRInstrInfo * getInstrInfo() const override
Definition: AVRSubtarget.h:42
unsigned getELFArch() const
Gets the ELF architecture for the e_flags field of an ELF object file.
Definition: AVRSubtarget.h:75
bool hasELPMX() const
Definition: AVRSubtarget.h:64
bool hasSPMX() const
Definition: AVRSubtarget.h:66
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
bool hasLPMX() const
Definition: AVRSubtarget.h:62
const AVRSelectionDAGInfo * getSelectionDAGInfo() const override
Definition: AVRSubtarget.h:45
bool hasDES() const
Definition: AVRSubtarget.h:67
Utilities relating to AVR registers.
const AVRTargetLowering * getTargetLowering() const override
Definition: AVRSubtarget.h:44
bool hasSPM() const
Definition: AVRSubtarget.h:65
A generic AVR implementation.
Utilities related to the AVR instruction set.
Definition: AVRInstrInfo.h:65
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
Parses a subtarget feature string, setting appropriate options.
bool hasMOVW() const
Definition: AVRSubtarget.h:60
bool hasADDSUBIW() const
Definition: AVRSubtarget.h:58
bool hasTinyEncoding() const
Definition: AVRSubtarget.h:71
bool hasJMPCALL() const
Definition: AVRSubtarget.h:55
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Holds information about the AVR instruction selection DAG.
bool hasBREAK() const
Definition: AVRSubtarget.h:70
bool hasSmallStack() const
Definition: AVRSubtarget.h:59
Performs target lowering for the AVR.
Information about stack frame layout on the target.
bool hasLPM() const
Definition: AVRSubtarget.h:61
A specific AVR target MCU.
Definition: AVRSubtarget.h:32
AVRSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, AVRTargetMachine &TM)
Creates an AVR subtarget.
Utilities for creating function call frames.
bool hasSRAM() const
Definition: AVRSubtarget.h:54
bool supportsRMW() const
Definition: AVRSubtarget.h:68
const AVRRegisterInfo & getRegisterInfo() const
Definition: AVRInstrInfo.h:69
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
const TargetFrameLowering * getFrameLowering() const override
Definition: AVRSubtarget.h:43
const AVRRegisterInfo * getRegisterInfo() const override
Definition: AVRSubtarget.h:46
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool hasIJMPCALL() const
Definition: AVRSubtarget.h:56
bool supportsMultiplication() const
Definition: AVRSubtarget.h:69
bool hasEIJMPCALL() const
Definition: AVRSubtarget.h:57
bool hasELPM() const
Definition: AVRSubtarget.h:63