LLVM  8.0.1
BPFSubtarget.cpp
Go to the documentation of this file.
1 //===-- BPFSubtarget.cpp - BPF Subtarget Information ----------------------===//
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 implements the BPF specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "BPFSubtarget.h"
15 #include "BPF.h"
16 #include "llvm/Support/Host.h"
18 
19 using namespace llvm;
20 
21 #define DEBUG_TYPE "bpf-subtarget"
22 
23 #define GET_SUBTARGETINFO_TARGET_DESC
24 #define GET_SUBTARGETINFO_CTOR
25 #include "BPFGenSubtargetInfo.inc"
26 
27 void BPFSubtarget::anchor() {}
28 
30  StringRef FS) {
31  initializeEnvironment();
32  initSubtargetFeatures(CPU, FS);
33  ParseSubtargetFeatures(CPU, FS);
34  return *this;
35 }
36 
37 void BPFSubtarget::initializeEnvironment() {
38  HasJmpExt = false;
39  HasAlu32 = false;
40  UseDwarfRIS = false;
41 }
42 
43 void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
44  if (CPU == "probe")
46  if (CPU == "generic" || CPU == "v1")
47  return;
48  if (CPU == "v2") {
49  HasJmpExt = true;
50  return;
51  }
52 }
53 
54 BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
55  const std::string &FS, const TargetMachine &TM)
56  : BPFGenSubtargetInfo(TT, CPU, FS), InstrInfo(),
57  FrameLowering(initializeSubtargetDependencies(CPU, FS)),
58  TLInfo(TM, *this) {}
This class represents lattice values for constants.
Definition: AllocatorList.h:24
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
StringRef getHostCPUNameForBPF()
Definition: Host.cpp:330
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49