1 //===-- BPFSubtarget.cpp - BPF Subtarget Information ----------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // This file implements the BPF specific subclass of TargetSubtargetInfo.
11 //===----------------------------------------------------------------------===//
13 #include "BPFSubtarget.h"
15 #include "llvm/Support/Host.h"
16 #include "llvm/Support/TargetRegistry.h"
20 #define DEBUG_TYPE "bpf-subtarget"
22 #define GET_SUBTARGETINFO_TARGET_DESC
23 #define GET_SUBTARGETINFO_CTOR
24 #include "BPFGenSubtargetInfo.inc"
26 void BPFSubtarget::anchor() {}
28 BPFSubtarget &BPFSubtarget::initializeSubtargetDependencies(StringRef CPU,
30 initializeEnvironment();
31 initSubtargetFeatures(CPU, FS);
32 ParseSubtargetFeatures(CPU, FS);
36 void BPFSubtarget::initializeEnvironment() {
43 void BPFSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
45 CPU = sys::detail::getHostCPUNameForBPF();
46 if (CPU == "generic" || CPU == "v1")
59 BPFSubtarget::BPFSubtarget(const Triple &TT, const std::string &CPU,
60 const std::string &FS, const TargetMachine &TM)
61 : BPFGenSubtargetInfo(TT, CPU, FS), InstrInfo(),
62 FrameLowering(initializeSubtargetDependencies(CPU, FS)),