Path: blob/main/contrib/llvm-project/llvm/lib/Target/BPF/BPFSubtarget.h
35267 views
//===-- BPFSubtarget.h - Define Subtarget for the BPF -----------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file declares the BPF specific subclass of TargetSubtargetInfo.9//10//===----------------------------------------------------------------------===//1112#ifndef LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H13#define LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H1415#include "BPFFrameLowering.h"16#include "BPFISelLowering.h"17#include "BPFInstrInfo.h"18#include "BPFRegisterInfo.h"19#include "BPFSelectionDAGInfo.h"20#include "llvm/CodeGen/GlobalISel/CallLowering.h"21#include "llvm/CodeGen/GlobalISel/InstructionSelector.h"22#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"23#include "llvm/CodeGen/RegisterBankInfo.h"24#include "llvm/CodeGen/SelectionDAGTargetInfo.h"25#include "llvm/CodeGen/TargetSubtargetInfo.h"26#include "llvm/IR/DataLayout.h"27#include "llvm/Target/TargetMachine.h"2829#define GET_SUBTARGETINFO_HEADER30#include "BPFGenSubtargetInfo.inc"3132namespace llvm {33class StringRef;3435class BPFSubtarget : public BPFGenSubtargetInfo {36virtual void anchor();37BPFInstrInfo InstrInfo;38BPFFrameLowering FrameLowering;39BPFTargetLowering TLInfo;40BPFSelectionDAGInfo TSInfo;4142private:43void initializeEnvironment();44void initSubtargetFeatures(StringRef CPU, StringRef FS);4546protected:47// unused48bool isDummyMode;4950bool IsLittleEndian;5152// whether the cpu supports jmp ext53bool HasJmpExt;5455// whether the cpu supports jmp32 ext.56// NOTE: jmp32 is not enabled when alu32 enabled.57bool HasJmp32;5859// whether the cpu supports alu32 instructions.60bool HasAlu32;6162// whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections63bool UseDwarfRIS;6465// whether cpu v4 insns are enabled.66bool HasLdsx, HasMovsx, HasBswap, HasSdivSmod, HasGotol, HasStoreImm;6768std::unique_ptr<CallLowering> CallLoweringInfo;69std::unique_ptr<InstructionSelector> InstSelector;70std::unique_ptr<LegalizerInfo> Legalizer;71std::unique_ptr<RegisterBankInfo> RegBankInfo;7273public:74// This constructor initializes the data members to match that75// of the specified triple.76BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,77const TargetMachine &TM);7879BPFSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);8081// ParseSubtargetFeatures - Parses features string setting specified82// subtarget options. Definition of function is auto generated by tblgen.83void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);84bool getHasJmpExt() const { return HasJmpExt; }85bool getHasJmp32() const { return HasJmp32; }86bool getHasAlu32() const { return HasAlu32; }87bool getUseDwarfRIS() const { return UseDwarfRIS; }88bool hasLdsx() const { return HasLdsx; }89bool hasMovsx() const { return HasMovsx; }90bool hasBswap() const { return HasBswap; }91bool hasSdivSmod() const { return HasSdivSmod; }92bool hasGotol() const { return HasGotol; }93bool hasStoreImm() const { return HasStoreImm; }9495bool isLittleEndian() const { return IsLittleEndian; }9697const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }98const BPFFrameLowering *getFrameLowering() const override {99return &FrameLowering;100}101const BPFTargetLowering *getTargetLowering() const override {102return &TLInfo;103}104const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {105return &TSInfo;106}107const BPFRegisterInfo *getRegisterInfo() const override {108return &InstrInfo.getRegisterInfo();109}110111const CallLowering *getCallLowering() const override;112InstructionSelector *getInstructionSelector() const override;113const LegalizerInfo *getLegalizerInfo() const override;114const RegisterBankInfo *getRegBankInfo() const override;115};116} // End llvm namespace117118#endif119120121