@@ -53,42 +53,18 @@ bool Cpu0DAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
5353 return Ret;
5454}
5555
56- /* NOTE(fh):
57- * In .td:
58- * def addr : ComplexPattern<iPTR, 2, "SelectAddr", [frameindex],
59- * [SDNPWantParent]>;
60- * - Address operands in LD/ST patterns use addr
61- * - addr expands into two operands (base, offset)
62- * - The C++ "SelectAddr" must fill thouse outputs
63- *
64- * This is for the selection of "DATA DAG node with addr type"
65- * This choose the addressing operands (operand decomposition)
66- * The address expression in the DAG can be many shapes:
67- * add(base, imm), add(reg, reg), Wrapper(GlobalAddress)
68- * But Cpu0 LD/ST instr would only want operands in the form:
69- * LD Base, Offset
70- * llvm need a way to take an arbitrary DAG address expression and decompose it
71- * into the operands which instruction would expect.
72- *
73- * PatFrag vs ComplexPattern
74- * - PatFrag: helps match the operation node (e.g. aligned store with certain
75- * contraints)
76- * -> a named DAG-op matcher (with optional predicate)
77- * - ComplexPattern: helps match/decompose an operand (addr -> base + offset)
78- * -> a named operand matcher/decomposer implemented in C++
79- */
8056// @SelectAddr {
8157// / ComplexPattern used on Cpu0InstrInfo
8258// / Used on Cpu0 Load/Store instructions
83- bool Cpu0DAGToDAGISel::SelectAddr (SDNode *Parent, SDValue Addr, SDValue &Base,
84- SDValue &Offset) {
85- // @SelectAddr }
59+ bool Cpu0DAGToDAGISel::
60+ SelectAddr (SDNode *Parent, SDValue Addr, SDValue &Base, SDValue &Offset) {
61+ // @SelectAddr }
8662 EVT ValTy = Addr.getValueType ();
8763 SDLoc DL (Addr);
8864
8965 // If Parent is an unaligned f32 load or store, select a (base + index)
9066 // floating point load/store instruction (luxc1 or suxc1).
91- const LSBaseSDNode * LS = 0 ;
67+ const LSBaseSDNode* LS = 0 ;
9268
9369 if (Parent && (LS = dyn_cast<LSBaseSDNode>(Parent))) {
9470 EVT VT = LS->getMemoryVT ();
@@ -102,26 +78,21 @@ bool Cpu0DAGToDAGISel::SelectAddr(SDNode *Parent, SDValue Addr, SDValue &Base,
10278
10379 // if Address is FI, get the TargetFrameIndex.
10480 if (FrameIndexSDNode *FIN = dyn_cast<FrameIndexSDNode>(Addr)) {
105- Base = CurDAG->getTargetFrameIndex (FIN->getIndex (), ValTy);
81+ Base = CurDAG->getTargetFrameIndex (FIN->getIndex (), ValTy);
10682 Offset = CurDAG->getTargetConstant (0 , DL, ValTy);
10783 return true ;
10884 }
10985
110- Base = Addr;
86+ Base = Addr;
11187 Offset = CurDAG->getTargetConstant (0 , DL, ValTy);
11288 return true ;
11389}
11490
115- /* NOTE(fh):
116- ! This is for the selection of "OP code DAG Node"
117- * This choose the instruction (opcode-level)
118- * Called for every node in SelectionDAG (ISD::ADD, Cpu0ISD::Ret)
119- */
12091// @Select {
12192// / Select instructions not customized! Used for
12293// / expanded, promoted and normal instructions
12394void Cpu0DAGToDAGISel::Select (SDNode *Node) {
124- // @Select }
95+ // @Select }
12596 unsigned Opcode = Node->getOpcode ();
12697
12798 // If we have a custom node, we already have selected!
@@ -132,23 +103,15 @@ void Cpu0DAGToDAGISel::Select(SDNode *Node) {
132103 }
133104
134105 // See if subclasses can handle this node.
135- /* NOTE(fh):
136- * trySelect is a pure virtual function, and is overridden by the derived
137- * class that handles target specific cases -> subtarget custom hook
138- */
139106 if (trySelect (Node))
140107 return ;
141108
142- switch (Opcode) {
143- default :
144- break ;
109+ switch (Opcode) {
110+ default : break ;
111+
145112 }
146113
147- /* NOTE(fh):
148- * SelectCode is the TableGen-generated matcher
149- * - It tries patterns from .td
150- * - If none match, it will throw an error
151- */
152114 // Select the default instruction
153115 SelectCode (Node);
154116}
117+
0 commit comments