32 #define DEBUG_TYPE "bpf-isel"
41 const char *getPassName()
const override {
42 return "BPF DAG->DAG Pattern Instruction Selection";
47 #include "BPFGenDAGISel.inc"
61 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
MVT::i64);
62 Offset = CurDAG->getTargetConstant(0, DL,
MVT::i64);
71 if (CurDAG->isBaseWithConstantOffset(Addr)) {
77 dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0)))
78 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
MVT::i64);
88 Offset = CurDAG->getTargetConstant(0, DL,
MVT::i64);
115 unsigned IntNo = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
117 case Intrinsic::bpf_load_byte:
118 case Intrinsic::bpf_load_half:
119 case Intrinsic::bpf_load_word: {
127 Chain = CurDAG->getCopyToReg(Chain, DL, R6Reg, Skb,
SDValue());
128 Node = CurDAG->UpdateNodeOperands(Node, Chain, N1, R6Reg, N3);
136 int FI = cast<FrameIndexSDNode>(Node)->getIndex();
138 SDValue TFI = CurDAG->getTargetFrameIndex(FI, VT);
139 unsigned Opc = BPF::MOV_rr;
141 return CurDAG->SelectNodeTo(Node, Opc, VT, TFI);
142 return CurDAG->getMachineNode(Opc,
SDLoc(Node), VT, TFI);
147 SDNode *ResNode = SelectCode(Node);
150 if (ResNode ==
nullptr || ResNode == Node)
153 ResNode->
dump(CurDAG);
159 return new BPFDAGToDAGISel(TM);
bool isInt< 32 >(int64_t x)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
void dump() const
Dump this node, for debugging.
bool hasOneUse() const
Return true if there is exactly one use of this node.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or anything else with this node...
const SDValue & getOperand(unsigned Num) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
Reports a serious error, calling any installed error handler.
RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) This node represents a target in...
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
EVT getValueType(unsigned ResNo) const
Return the type of a specified result.
UNDEF - An undefined node.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
FunctionPass class - This class is used to implement most global optimizations.
EVT - Extended Value Type.
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
SelectionDAGISel - This is the common base class used for SelectionDAG-based pattern-matching instruc...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
int64_t getSExtValue() const
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation...
FunctionPass * createBPFISelDag(BPFTargetMachine &TM)
bool isMachineOpcode() const
Test if this node has a post-isel opcode, directly corresponding to a MachineInstr opcode...