[AArch64] This is a work in progress to provide a machine description
[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
20 #define GET_SUBTARGETINFO_HEADER
21 #include "AArch64GenSubtargetInfo.inc"
22
23 #include <string>
24
25 namespace llvm {
26 class StringRef;
27 class GlobalValue;
28
29 class AArch64Subtarget : public AArch64GenSubtargetInfo {
30   virtual void anchor();
31 protected:
32   enum ARMProcFamilyEnum {Others, CortexA53, CortexA57};
33
34   /// ARMProcFamily - ARM processor family: Cortex-A53, Cortex-A57, and others.
35   ARMProcFamilyEnum ARMProcFamily;
36
37   bool HasFPARMv8;
38   bool HasNEON;
39   bool HasCrypto;
40
41   /// TargetTriple - What processor and OS we're targeting.
42   Triple TargetTriple;
43
44   /// CPUString - String name of used CPU.
45   std::string CPUString;
46
47   /// IsLittleEndian - The target is Little Endian
48   bool IsLittleEndian;
49
50 private:
51   void initializeSubtargetFeatures(StringRef CPU, StringRef FS);
52
53 public:
54   /// This constructor initializes the data members to match that
55   /// of the specified triple.
56   ///
57   AArch64Subtarget(StringRef TT, StringRef CPU, StringRef FS,
58                    bool LittleEndian);
59
60   virtual bool enableMachineScheduler() const {
61     return true;
62   }
63
64   /// ParseSubtargetFeatures - Parses features string setting specified
65   /// subtarget options.  Definition of function is auto generated by tblgen.
66   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
67
68   bool GVIsIndirectSymbol(const GlobalValue *GV, Reloc::Model RelocM) const;
69
70   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
71   bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
72
73   bool hasFPARMv8() const { return HasFPARMv8; }
74   bool hasNEON() const { return HasNEON; }
75   bool hasCrypto() const { return HasCrypto; }
76
77   bool isLittle() const { return IsLittleEndian; }
78
79   const std::string & getCPUString() const { return CPUString; }
80 };
81 } // End llvm namespace
82
83 #endif  // LLVM_TARGET_AARCH64_SUBTARGET_H