ARM64: initial backend import
[oota-llvm.git] / lib / Target / ARM64 / ARM64Subtarget.h
1 //=====---- ARM64Subtarget.h - Define Subtarget for the ARM64 -*- 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 ARM64 specific subclass of TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef ARM64SUBTARGET_H
15 #define ARM64SUBTARGET_H
16
17 #include "llvm/Target/TargetSubtargetInfo.h"
18 #include "ARM64RegisterInfo.h"
19 #include <string>
20
21 #define GET_SUBTARGETINFO_HEADER
22 #include "ARM64GenSubtargetInfo.inc"
23
24 namespace llvm {
25 class GlobalValue;
26 class StringRef;
27
28 class ARM64Subtarget : public ARM64GenSubtargetInfo {
29 protected:
30   // HasZeroCycleRegMove - Has zero-cycle register mov instructions.
31   bool HasZeroCycleRegMove;
32
33   // HasZeroCycleZeroing - Has zero-cycle zeroing instructions.
34   bool HasZeroCycleZeroing;
35
36   /// CPUString - String name of used CPU.
37   std::string CPUString;
38
39   /// TargetTriple - What processor and OS we're targeting.
40   Triple TargetTriple;
41
42 public:
43   /// This constructor initializes the data members to match that
44   /// of the specified triple.
45   ARM64Subtarget(const std::string &TT, const std::string &CPU,
46                  const std::string &FS);
47
48   virtual bool enableMachineScheduler() const { return true; }
49
50   bool hasZeroCycleRegMove() const { return HasZeroCycleRegMove; }
51
52   bool hasZeroCycleZeroing() const { return HasZeroCycleZeroing; }
53
54   bool isTargetDarwin() const { return TargetTriple.isOSDarwin(); }
55
56   bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
57
58   bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
59
60   bool isCyclone() const { return CPUString == "cyclone"; }
61
62   /// getMaxInlineSizeThreshold - Returns the maximum memset / memcpy size
63   /// that still makes it profitable to inline the call.
64   unsigned getMaxInlineSizeThreshold() const { return 64; }
65
66   /// ParseSubtargetFeatures - Parses features string setting specified
67   /// subtarget options.  Definition of function is auto generated by tblgen.
68   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
69
70   /// ClassifyGlobalReference - Find the target operand flags that describe
71   /// how a global value should be referenced for the current subtarget.
72   unsigned char ClassifyGlobalReference(const GlobalValue *GV,
73                                         const TargetMachine &TM) const;
74
75   /// This function returns the name of a function which has an interface
76   /// like the non-standard bzero function, if such a function exists on
77   /// the current subtarget and it is considered prefereable over
78   /// memset with zero passed as the second argument. Otherwise it
79   /// returns null.
80   const char *getBZeroEntry() const;
81
82   void overrideSchedPolicy(MachineSchedPolicy &Policy, MachineInstr *begin,
83                            MachineInstr *end, unsigned NumRegionInstrs) const;
84 };
85 } // End llvm namespace
86
87 #endif // ARM64SUBTARGET_H