Lines Matching defs:AM
95 bool MatchAddress(SDValue N, MSP430ISelAddressMode &AM);
96 bool MatchWrapper(SDValue N, MSP430ISelAddressMode &AM);
97 bool MatchAddressBase(SDValue N, MSP430ISelAddressMode &AM);
140 bool MSP430DAGToDAGISel::MatchWrapper(SDValue N, MSP430ISelAddressMode &AM) {
143 if (AM.hasSymbolicDisplacement())
149 AM.GV = G->getGlobal();
150 AM.Disp += G->getOffset();
151 //AM.SymbolFlags = G->getTargetFlags();
153 AM.CP = CP->getConstVal();
154 AM.Alignment = CP->getAlign();
155 AM.Disp += CP->getOffset();
156 //AM.SymbolFlags = CP->getTargetFlags();
158 AM.ES = S->getSymbol();
159 //AM.SymbolFlags = S->getTargetFlags();
161 AM.JT = J->getIndex();
162 //AM.SymbolFlags = J->getTargetFlags();
164 AM.BlockAddr = cast<BlockAddressSDNode>(N0)->getBlockAddress();
165 //AM.SymbolFlags = cast<BlockAddressSDNode>(N0)->getTargetFlags();
172 bool MSP430DAGToDAGISel::MatchAddressBase(SDValue N, MSP430ISelAddressMode &AM) {
174 if (AM.BaseType != MSP430ISelAddressMode::RegBase || AM.Base.Reg.getNode()) {
180 AM.BaseType = MSP430ISelAddressMode::RegBase;
181 AM.Base.Reg = N;
185 bool MSP430DAGToDAGISel::MatchAddress(SDValue N, MSP430ISelAddressMode &AM) {
186 LLVM_DEBUG(errs() << "MatchAddress: "; AM.dump());
192 AM.Disp += Val;
197 if (!MatchWrapper(N, AM))
202 if (AM.BaseType == MSP430ISelAddressMode::RegBase
203 && AM.Base.Reg.getNode() == nullptr) {
204 AM.BaseType = MSP430ISelAddressMode::FrameIndexBase;
205 AM.Base.FrameIndex = cast<FrameIndexSDNode>(N)->getIndex();
211 MSP430ISelAddressMode Backup = AM;
212 if (!MatchAddress(N.getNode()->getOperand(0), AM) &&
213 !MatchAddress(N.getNode()->getOperand(1), AM))
215 AM = Backup;
216 if (!MatchAddress(N.getNode()->getOperand(1), AM) &&
217 !MatchAddress(N.getNode()->getOperand(0), AM))
219 AM = Backup;
227 MSP430ISelAddressMode Backup = AM;
230 if (!MatchAddress(N.getOperand(0), AM) &&
232 AM.GV == nullptr &&
235 AM.Disp += Offset;
238 AM = Backup;
243 return MatchAddressBase(N, AM);
251 MSP430ISelAddressMode AM;
253 if (MatchAddress(N, AM))
256 if (AM.BaseType == MSP430ISelAddressMode::RegBase)
257 if (!AM.Base.Reg.getNode())
258 AM.Base.Reg = CurDAG->getRegister(MSP430::SR, MVT::i16);
260 Base = (AM.BaseType == MSP430ISelAddressMode::FrameIndexBase)
262 AM.Base.FrameIndex,
264 : AM.Base.Reg;
266 if (AM.GV)
267 Disp = CurDAG->getTargetGlobalAddress(AM.GV, SDLoc(N),
268 MVT::i16, AM.Disp,
269 0/*AM.SymbolFlags*/);
270 else if (AM.CP)
271 Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16, AM.Alignment, AM.Disp,
272 0 /*AM.SymbolFlags*/);
273 else if (AM.ES)
274 Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i16, 0/*AM.SymbolFlags*/);
275 else if (AM.JT != -1)
276 Disp = CurDAG->getTargetJumpTable(AM.JT, MVT::i16, 0/*AM.SymbolFlags*/);
277 else if (AM.BlockAddr)
278 Disp = CurDAG->getTargetBlockAddress(AM.BlockAddr, MVT::i32, 0,
279 0/*AM.SymbolFlags*/);
281 Disp = CurDAG->getSignedTargetConstant(AM.Disp, SDLoc(N), MVT::i16);
304 ISD::MemIndexedMode AM = LD->getAddressingMode();
305 if (AM != ISD::POST_INC || LD->getExtensionType() != ISD::NON_EXTLOAD)