LLVM  14.0.0git
BPFSubtarget.cpp
Go to the documentation of this file.
1 //===-- BPFSubtarget.cpp - BPF Subtarget Information ----------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the BPF specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "BPFSubtarget.h"
14 #include "BPF.h"
15 #include "llvm/Support/Host.h"
17 
18 using namespace llvm;
19 
20 #define DEBUG_TYPE "bpf-subtarget"
21 
22 #define GET_SUBTARGETINFO_TARGET_DESC
23 #define GET_SUBTARGETINFO_CTOR
24 #include "BPFGenSubtargetInfo.inc"
25 
26 void BPFSubtarget::anchor() {}
27 
29  StringRef FS) {
30  initializeEnvironment();
31  initSubtargetFeatures(CPU, FS);
32  ParseSubtargetFeatures(CPU, /*TuneCPU*/ CPU, FS);
33  return *this;
34 }
35 
36 void BPFSubtarget::initializeEnvironment() {
37  HasJmpExt = false;
38  HasJmp32 = 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  if (CPU == "v3") {
53  HasJmpExt = true;
54  HasJmp32 = true;
55  HasAlu32 = true;
56  return;
57  }
58 }
59 
60 BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
61  const std::string &FS, const TargetMachine &TM)
62  : BPFGenSubtargetInfo(TT, CPU, /*TuneCPU*/ CPU, FS), InstrInfo(),
63  FrameLowering(initializeSubtargetDependencies(CPU, FS)),
64  TLInfo(TM, *this) {}
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
BPFSubtarget.h
llvm::BPFSubtarget::HasAlu32
bool HasAlu32
Definition: BPFSubtarget.h:55
Host.h
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::BPFSubtarget::initializeSubtargetDependencies
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Definition: BPFSubtarget.cpp:28
BPF.h
llvm::BPFSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm::BPFSubtarget::UseDwarfRIS
bool UseDwarfRIS
Definition: BPFSubtarget.h:58
BPFGenSubtargetInfo
llvm::BPFSubtarget::BPFSubtarget
BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
Definition: BPFSubtarget.cpp:60
llvm::X86AS::FS
@ FS
Definition: X86.h:188
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::sys::detail::getHostCPUNameForBPF
StringRef getHostCPUNameForBPF()
Definition: Host.cpp:381
llvm::BPFSubtarget::HasJmp32
bool HasJmp32
Definition: BPFSubtarget.h:52
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
TargetRegistry.h
llvm::BPFSubtarget
Definition: BPFSubtarget.h:31
llvm::BPFSubtarget::HasJmpExt
bool HasJmpExt
Definition: BPFSubtarget.h:48