• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- SystemZSubtarget.h - SystemZ subtarget information -----*- 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 SystemZ specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef SYSTEMZSUBTARGET_H
15 #define SYSTEMZSUBTARGET_H
16 
17 #include "SystemZFrameLowering.h"
18 #include "SystemZISelLowering.h"
19 #include "SystemZInstrInfo.h"
20 #include "SystemZRegisterInfo.h"
21 #include "SystemZSelectionDAGInfo.h"
22 #include "llvm/IR/DataLayout.h"
23 #include "llvm/ADT/Triple.h"
24 #include "llvm/Target/TargetSubtargetInfo.h"
25 #include <string>
26 
27 #define GET_SUBTARGETINFO_HEADER
28 #include "SystemZGenSubtargetInfo.inc"
29 
30 namespace llvm {
31 class GlobalValue;
32 class StringRef;
33 
34 class SystemZSubtarget : public SystemZGenSubtargetInfo {
35   virtual void anchor();
36 protected:
37   bool HasDistinctOps;
38   bool HasLoadStoreOnCond;
39   bool HasHighWord;
40   bool HasFPExtension;
41   bool HasFastSerialization;
42   bool HasInterlockedAccess1;
43 
44 private:
45   Triple TargetTriple;
46   const DataLayout DL;
47   SystemZInstrInfo InstrInfo;
48   SystemZTargetLowering TLInfo;
49   SystemZSelectionDAGInfo TSInfo;
50   SystemZFrameLowering FrameLowering;
51 
52   SystemZSubtarget &initializeSubtargetDependencies(StringRef CPU,
53                                                     StringRef FS);
54 public:
55   SystemZSubtarget(const std::string &TT, const std::string &CPU,
56                    const std::string &FS, const TargetMachine &TM);
57 
getFrameLowering()58   const TargetFrameLowering *getFrameLowering() const { return &FrameLowering; }
getInstrInfo()59   const SystemZInstrInfo *getInstrInfo() const { return &InstrInfo; }
getDataLayout()60   const DataLayout *getDataLayout() const { return &DL; }
getRegisterInfo()61   const SystemZRegisterInfo *getRegisterInfo() const {
62     return &InstrInfo.getRegisterInfo();
63   }
getTargetLowering()64   const SystemZTargetLowering *getTargetLowering() const { return &TLInfo; }
getSelectionDAGInfo()65   const TargetSelectionDAGInfo *getSelectionDAGInfo() const { return &TSInfo; }
66 
67   // This is important for reducing register pressure in vector code.
useAA()68   bool useAA() const override { return true; }
69 
70   // Automatically generated by tblgen.
71   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
72 
73   // Return true if the target has the distinct-operands facility.
hasDistinctOps()74   bool hasDistinctOps() const { return HasDistinctOps; }
75 
76   // Return true if the target has the load/store-on-condition facility.
hasLoadStoreOnCond()77   bool hasLoadStoreOnCond() const { return HasLoadStoreOnCond; }
78 
79   // Return true if the target has the high-word facility.
hasHighWord()80   bool hasHighWord() const { return HasHighWord; }
81 
82   // Return true if the target has the floating-point extension facility.
hasFPExtension()83   bool hasFPExtension() const { return HasFPExtension; }
84 
85   // Return true if the target has the fast-serialization facility.
hasFastSerialization()86   bool hasFastSerialization() const { return HasFastSerialization; }
87 
88   // Return true if the target has interlocked-access facility 1.
hasInterlockedAccess1()89   bool hasInterlockedAccess1() const { return HasInterlockedAccess1; }
90 
91   // Return true if GV can be accessed using LARL for reloc model RM
92   // and code model CM.
93   bool isPC32DBLSymbol(const GlobalValue *GV, Reloc::Model RM,
94                        CodeModel::Model CM) const;
95 
isTargetELF()96   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
97 };
98 } // end namespace llvm
99 
100 #endif
101