8cd346e839b6686afa27956560c42cd031ea6f9a
[oota-llvm.git] / lib / Target / AArch64 / AArch64Subtarget.h
1 //==-- AArch64Subtarget.h - Define Subtarget for the AArch64 ---*- 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 AArch64 specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TARGET_AARCH64_SUBTARGET_H
15 #define LLVM_TARGET_AARCH64_SUBTARGET_H
16
17 #include "llvm/ADT/Triple.h"
18 #include "llvm/Target/TargetSubtargetInfo.h"
19 #include <string>
20
21 #define GET_SUBTARGETINFO_HEADER
22 #include "AArch64GenSubtargetInfo.inc"
23
24 namespace llvm {
25 class StringRef;
26 class GlobalValue;
27
28 class AArch64Subtarget : public AArch64GenSubtargetInfo {
29   virtual void anchor();
30 protected:
31   enum ARMProcFamilyEnum {Others, CortexA53, CortexA57};
32
33   /// ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
34   ARMProcFamilyEnum ARMProcFamily;
35
36   bool HasFPARMv8;
37   bool HasNEON;
38   bool HasCrypto;
39
40   /// AllowsUnalignedMem - If true, the subtarget allows unaligned memory
41   /// accesses for some types.  For details, see
42   /// AArch64TargetLowering::allowsUnalignedMemoryAccesses().
43   bool AllowsUnalignedMem;
44
45   /// TargetTriple - What processor and OS we're targeting.
46   Triple TargetTriple;
47
48   /// CPUString - String name of used CPU.
49   std::string CPUString;
50
51   /// IsLittleEndian - The target is Little Endian
52   bool IsLittleEndian;
53
54 private:
55   void initializeSubtargetFeatures(StringRef CPU, StringRef FS);
56
57 public:
58   /// This constructor initializes the data members to match that
59   /// of the specified triple.
60   ///
61   AArch64Subtarget(StringRef TT, StringRef CPU, StringRef FS,
62                    bool LittleEndian);
63
64   virtual bool enableMachineScheduler() const {
65     return true;
66   }
67
68   /// ParseSubtargetFeatures - Parses features string setting specified
69   /// subtarget options.  Definition of function is auto generated by tblgen.
70   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
71
72   bool GVIsIndirectSymbol(const GlobalValue *GV, Reloc::Model RelocM) const;
73
74   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
75   bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
76
77   bool hasFPARMv8() const { return HasFPARMv8; }
78   bool hasNEON() const { return HasNEON; }
79   bool hasCrypto() const { return HasCrypto; }
80
81   bool allowsUnalignedMem() const { return AllowsUnalignedMem; }
82
83   bool isLittle() const { return IsLittleEndian; }
84
85   const std::string & getCPUString() const { return CPUString; }
86 };
87 } // End llvm namespace
88
89 #endif  // LLVM_TARGET_AARCH64_SUBTARGET_H