/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/lib/Target/BPF/BPFSubtarget.h
Line | Count | Source |
1 | | //===-- BPFSubtarget.h - Define Subtarget for the BPF -----------*- 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 BPF specific subclass of TargetSubtargetInfo. |
11 | | // |
12 | | //===----------------------------------------------------------------------===// |
13 | | |
14 | | #ifndef LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H |
15 | | #define LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H |
16 | | |
17 | | #include "BPFFrameLowering.h" |
18 | | #include "BPFISelLowering.h" |
19 | | #include "BPFInstrInfo.h" |
20 | | #include "llvm/CodeGen/SelectionDAGTargetInfo.h" |
21 | | #include "llvm/IR/DataLayout.h" |
22 | | #include "llvm/Target/TargetMachine.h" |
23 | | #include "llvm/Target/TargetSubtargetInfo.h" |
24 | | |
25 | | #define GET_SUBTARGETINFO_HEADER |
26 | | #include "BPFGenSubtargetInfo.inc" |
27 | | |
28 | | namespace llvm { |
29 | | class StringRef; |
30 | | |
31 | | class BPFSubtarget : public BPFGenSubtargetInfo { |
32 | | virtual void anchor(); |
33 | | BPFInstrInfo InstrInfo; |
34 | | BPFFrameLowering FrameLowering; |
35 | | BPFTargetLowering TLInfo; |
36 | | SelectionDAGTargetInfo TSInfo; |
37 | | |
38 | | private: |
39 | | void initializeEnvironment(); |
40 | | void initSubtargetFeatures(StringRef CPU, StringRef FS); |
41 | | bool probeJmpExt(); |
42 | | |
43 | | protected: |
44 | | // unused |
45 | | bool isDummyMode; |
46 | | |
47 | | // whether the cpu supports jmp ext |
48 | | bool HasJmpExt; |
49 | | |
50 | | public: |
51 | | // This constructor initializes the data members to match that |
52 | | // of the specified triple. |
53 | | BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, |
54 | | const TargetMachine &TM); |
55 | | |
56 | | BPFSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); |
57 | | |
58 | | // ParseSubtargetFeatures - Parses features string setting specified |
59 | | // subtarget options. Definition of function is auto generated by tblgen. |
60 | | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
61 | 51 | bool getHasJmpExt() const { return HasJmpExt; } |
62 | | |
63 | 8.67k | const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; } |
64 | 1.97k | const BPFFrameLowering *getFrameLowering() const override { |
65 | 1.97k | return &FrameLowering; |
66 | 1.97k | } |
67 | 3.01k | const BPFTargetLowering *getTargetLowering() const override { |
68 | 3.01k | return &TLInfo; |
69 | 3.01k | } |
70 | 148 | const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { |
71 | 148 | return &TSInfo; |
72 | 148 | } |
73 | 15.4k | const TargetRegisterInfo *getRegisterInfo() const override { |
74 | 15.4k | return &InstrInfo.getRegisterInfo(); |
75 | 15.4k | } |
76 | | }; |
77 | | } // End llvm namespace |
78 | | |
79 | | #endif |