32 #define DEBUG_TYPE "bpf-isel"
42 return "BPF DAG->DAG Pattern Instruction Selection";
47 #include "BPFGenDAGISel.inc"
62 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
MVT::i64);
63 Offset = CurDAG->getTargetConstant(0, DL,
MVT::i64);
72 if (CurDAG->isBaseWithConstantOffset(Addr)) {
78 dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0)))
79 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
MVT::i64);
89 Offset = CurDAG->getTargetConstant(0, DL,
MVT::i64);
97 if (!CurDAG->isBaseWithConstantOffset(Addr))
106 dyn_cast<FrameIndexSDNode>(Addr.
getOperand(0)))
107 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(),
MVT::i64);
137 errs() <<
"Error at line " << DL.
getLine() <<
": ";
140 errs() <<
"Unsupport signed division for DAG: ";
142 errs() <<
"Please convert to unsigned div/mod.\n";
146 unsigned IntNo = cast<ConstantSDNode>(Node->
getOperand(1))->getZExtValue();
148 case Intrinsic::bpf_load_byte:
149 case Intrinsic::bpf_load_half:
150 case Intrinsic::bpf_load_word: {
158 Chain = CurDAG->getCopyToReg(Chain, DL, R6Reg, Skb,
SDValue());
159 Node = CurDAG->UpdateNodeOperands(Node, Chain, N1, R6Reg, N3);
167 int FI = cast<FrameIndexSDNode>(Node)->getIndex();
169 SDValue TFI = CurDAG->getTargetFrameIndex(FI, VT);
170 unsigned Opc = BPF::MOV_rr;
172 CurDAG->SelectNodeTo(Node, Opc, VT, TFI);
175 ReplaceNode(Node, CurDAG->getMachineNode(Opc,
SDLoc(Node), VT, TFI));
185 return new BPFDAGToDAGISel(TM);
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
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
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.
const SDValue & getOperand(unsigned i) const
unsigned getOpcode() const
FunctionPass class - This class is used to implement most global optimizations.
EVT - Extended Value Type.
void dump() const
Dump this node, for debugging.
constexpr bool isInt< 32 >(int64_t x)
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_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const DebugLoc & getDebugLoc() const
Return the source location info.
StringRef - Represent a constant reference to a string, i.e.
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...