LLVM: lib/Target/BPF/BPFRegisterInfo.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

24

25#define GET_REGINFO_TARGET_DESC

26#include "BPFGenRegisterInfo.inc"

27using namespace llvm;

28

31 cl::desc("Specify the BPF stack size limit"),

33

36

39 return CSR_SaveList;

40}

41

45 switch (CC) {

46 default:

47 return CSR_RegMask;

49 return CSR_PreserveAll_RegMask;

50 }

51}

52

59

63 if (DL)

64

65 for (auto &I : MBB)

66 if (I.getDebugLoc()) {

67 DL = I.getDebugLoc();

68 break;

69 }

70

73 F,

74 "Looks like the BPF stack limit is exceeded. "

75 "Please move large on stack variables into BPF per-cpu array map. For "

76 "non-kernel uses, the stack can be increased using -mllvm "

77 "-bpf-stack-size.\n",

79 }

80}

81

83 int SPAdj, unsigned FIOperandNum,

85 assert(SPAdj == 0 && "Unexpected");

86

87 unsigned i = 0;

92

93 while (MI.getOperand(i).isFI()) {

94 ++i;

95 assert(i < MI.getNumOperands() && "Instr doesn't have FrameIndex operand!");

96 }

97

99 int FrameIndex = MI.getOperand(i).getIndex();

101

102 if (MI.getOpcode() == BPF::MOV_rr) {

104

106 MI.getOperand(i).ChangeToRegister(FrameReg, false);

107 Register reg = MI.getOperand(i - 1).getReg();

111 return false;

112 }

113

115 MI.getOperand(i + 1).getImm();

116

119

121

122 if (MI.getOpcode() == BPF::FI_ri) {

123

124

125

126 Register reg = MI.getOperand(i - 1).getReg();

127

133

134

135 MI.eraseFromParent();

136 } else {

137 MI.getOperand(i).ChangeToRegister(FrameReg, false);

138 MI.getOperand(i + 1).ChangeToImmediate(Offset);

139 }

140 return false;

141}

142

144 return BPF::R10;

145}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

const TargetInstrInfo & TII

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

static void WarnSize(int Offset, MachineFunction &MF, DebugLoc &DL, MachineBasicBlock &MBB)

Definition BPFRegisterInfo.cpp:60

static cl::opt< int > BPFStackSizeOption("bpf-stack-size", cl::desc("Specify the BPF stack size limit"), cl::init(512))

uint64_t IntrinsicInst * II

This file declares the machine register scavenger class.

Diagnostic information for unsupported feature in backend.

MachineInstrBundleIterator< MachineInstr > iterator

int64_t getObjectOffset(int ObjectIdx) const

Return the assigned stack offset of the specified object from the incoming stack pointer.

const TargetSubtargetInfo & getSubtarget() const

getSubtarget - Return the subtarget for which this machine code is being compiled.

MachineFrameInfo & getFrameInfo()

getFrameInfo - Return the frame info object for the current function.

Function & getFunction()

Return the LLVM function that this machine code represents.

const MachineInstrBuilder & addImm(int64_t Val) const

Add a new immediate operand.

const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const

Add a new virtual register operand.

Representation of each machine instruction.

Wrapper class representing virtual and physical registers.

TargetInstrInfo - Interface to description of machine instruction set.

virtual const TargetInstrInfo * getInstrInfo() const

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ PreserveAll

Used for runtime calls that preserves (almost) all registers.

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)

Builder interface. Specify how to create the initial instruction itself.

constexpr bool isInt(int64_t x)

Checks if an integer fits into the given bit width.

uint16_t MCPhysReg

An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...

const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override

Definition BPFRegisterInfo.cpp:38

BitVector getReservedRegs(const MachineFunction &MF) const override

Definition BPFRegisterInfo.cpp:53

Register getFrameRegister(const MachineFunction &MF) const override

Definition BPFRegisterInfo.cpp:143

bool eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override

Definition BPFRegisterInfo.cpp:82

const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override

Definition BPFRegisterInfo.cpp:43

BPFRegisterInfo()

Definition BPFRegisterInfo.cpp:34