LLVM 20.0.0git
XtensaISelLowering.cpp
Go to the documentation of this file.
1//===- XtensaISelLowering.cpp - Xtensa DAG Lowering Implementation --------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the interfaces that Xtensa uses to lower LLVM code into a
10// selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#include "XtensaISelLowering.h"
16#include "XtensaSubtarget.h"
17#include "XtensaTargetMachine.h"
24#include "llvm/Support/Debug.h"
28#include <deque>
29
30using namespace llvm;
31
32#define DEBUG_TYPE "xtensa-lower"
33
34// Return true if we must use long (in fact, indirect) function call.
35// It's simplified version, production implimentation must
36// resolve a functions in ROM (usually glibc functions)
37static bool isLongCall(const char *str) {
38 // Currently always use long calls
39 return true;
40}
41
43 const XtensaSubtarget &STI)
44 : TargetLowering(TM), Subtarget(STI) {
45 MVT PtrVT = MVT::i32;
46 // Set up the register classes.
47 addRegisterClass(MVT::i32, &Xtensa::ARRegClass);
48
49 // Set up special registers.
51
53
55
58
60
64
71
72 // No sign extend instructions for i1
73 for (MVT VT : MVT::integer_valuetypes()) {
77 }
78
83
84 // Expand jump table branches as address arithmetic followed by an
85 // indirect jump.
87
91
95
100
101 // Implement custom stack allocations
103 // Implement custom stack save and restore
106
107 // Compute derived properties from the register classes
109}
110
112 const GlobalAddressSDNode *GA) const {
113 // The Xtensa target isn't yet aware of offsets.
114 return false;
115}
116
117//===----------------------------------------------------------------------===//
118// Calling conventions
119//===----------------------------------------------------------------------===//
120
121#include "XtensaGenCallingConv.inc"
122
123static bool CC_Xtensa_Custom(unsigned ValNo, MVT ValVT, MVT LocVT,
124 CCValAssign::LocInfo LocInfo,
125 ISD::ArgFlagsTy ArgFlags, CCState &State) {
126 static const MCPhysReg IntRegs[] = {Xtensa::A2, Xtensa::A3, Xtensa::A4,
127 Xtensa::A5, Xtensa::A6, Xtensa::A7};
128
129 if (ArgFlags.isByVal()) {
130 Align ByValAlign = ArgFlags.getNonZeroByValAlign();
131 unsigned ByValSize = ArgFlags.getByValSize();
132 if (ByValSize < 4) {
133 ByValSize = 4;
134 }
135 if (ByValAlign < Align(4)) {
136 ByValAlign = Align(4);
137 }
138 unsigned Offset = State.AllocateStack(ByValSize, ByValAlign);
139 State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
140 // Mark all unused registers as allocated to avoid misuse
141 // of such registers.
142 while (State.AllocateReg(IntRegs))
143 ;
144 return false;
145 }
146
147 // Promote i8 and i16
148 if (LocVT == MVT::i8 || LocVT == MVT::i16) {
149 LocVT = MVT::i32;
150 if (ArgFlags.isSExt())
151 LocInfo = CCValAssign::SExt;
152 else if (ArgFlags.isZExt())
153 LocInfo = CCValAssign::ZExt;
154 else
155 LocInfo = CCValAssign::AExt;
156 }
157
158 unsigned Register;
159
160 Align OrigAlign = ArgFlags.getNonZeroOrigAlign();
161 bool needs64BitAlign = (ValVT == MVT::i32 && OrigAlign == Align(8));
162 bool needs128BitAlign = (ValVT == MVT::i32 && OrigAlign == Align(16));
163
164 if (ValVT == MVT::i32) {
166 // If this is the first part of an i64 arg,
167 // the allocated register must be either A2, A4 or A6.
168 if (needs64BitAlign && (Register == Xtensa::A3 || Register == Xtensa::A5 ||
169 Register == Xtensa::A7))
171 // arguments with 16byte alignment must be passed in the first register or
172 // passed via stack
173 if (needs128BitAlign && (Register != Xtensa::A2))
174 while ((Register = State.AllocateReg(IntRegs)))
175 ;
176 LocVT = MVT::i32;
177 } else if (ValVT == MVT::f64) {
178 // Allocate int register and shadow next int register.
180 if (Register == Xtensa::A3 || Register == Xtensa::A5 ||
181 Register == Xtensa::A7)
183 State.AllocateReg(IntRegs);
184 LocVT = MVT::i32;
185 } else {
186 report_fatal_error("Cannot handle this ValVT.");
187 }
188
189 if (!Register) {
190 unsigned Offset = State.AllocateStack(ValVT.getStoreSize(), OrigAlign);
191 State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
192 } else {
193 State.addLoc(CCValAssign::getReg(ValNo, ValVT, Register, LocVT, LocInfo));
194 }
195
196 return false;
197}
198
199CCAssignFn *XtensaTargetLowering::CCAssignFnForCall(CallingConv::ID CC,
200 bool IsVarArg) const {
201 return CC_Xtensa_Custom;
202}
203
205 SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
206 const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &DL,
207 SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const {
209 MachineFrameInfo &MFI = MF.getFrameInfo();
210
211 // Used with vargs to acumulate store chains.
212 std::vector<SDValue> OutChains;
213
214 if (IsVarArg)
215 report_fatal_error("Var arg not supported by FormalArguments Lowering");
216
217 // Assign locations to all of the incoming arguments.
219 CCState CCInfo(CallConv, IsVarArg, DAG.getMachineFunction(), ArgLocs,
220 *DAG.getContext());
221
222 CCInfo.AnalyzeFormalArguments(Ins, CCAssignFnForCall(CallConv, IsVarArg));
223
224 for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
225 CCValAssign &VA = ArgLocs[i];
226 // Arguments stored on registers
227 if (VA.isRegLoc()) {
228 EVT RegVT = VA.getLocVT();
229 const TargetRegisterClass *RC;
230
231 if (RegVT == MVT::i32)
232 RC = &Xtensa::ARRegClass;
233 else
234 report_fatal_error("RegVT not supported by FormalArguments Lowering");
235
236 // Transform the arguments stored on
237 // physical registers into virtual ones
238 unsigned Register = MF.addLiveIn(VA.getLocReg(), RC);
239 SDValue ArgValue = DAG.getCopyFromReg(Chain, DL, Register, RegVT);
240
241 // If this is an 8 or 16-bit value, it has been passed promoted
242 // to 32 bits. Insert an assert[sz]ext to capture this, then
243 // truncate to the right size.
244 if (VA.getLocInfo() != CCValAssign::Full) {
245 unsigned Opcode = 0;
246 if (VA.getLocInfo() == CCValAssign::SExt)
247 Opcode = ISD::AssertSext;
248 else if (VA.getLocInfo() == CCValAssign::ZExt)
249 Opcode = ISD::AssertZext;
250 if (Opcode)
251 ArgValue = DAG.getNode(Opcode, DL, RegVT, ArgValue,
252 DAG.getValueType(VA.getValVT()));
253 ArgValue = DAG.getNode((VA.getValVT() == MVT::f32) ? ISD::BITCAST
255 DL, VA.getValVT(), ArgValue);
256 }
257
258 InVals.push_back(ArgValue);
259
260 } else {
261 assert(VA.isMemLoc());
262
263 EVT ValVT = VA.getValVT();
264
265 // The stack pointer offset is relative to the caller stack frame.
266 int FI = MFI.CreateFixedObject(ValVT.getStoreSize(), VA.getLocMemOffset(),
267 true);
268
269 if (Ins[VA.getValNo()].Flags.isByVal()) {
270 // Assume that in this case load operation is created
271 SDValue FIN = DAG.getFrameIndex(FI, MVT::i32);
272 InVals.push_back(FIN);
273 } else {
274 // Create load nodes to retrieve arguments from the stack
275 SDValue FIN =
277 InVals.push_back(DAG.getLoad(
278 ValVT, DL, Chain, FIN,
280 }
281 }
282 }
283
284 // All stores are grouped in one node to allow the matching between
285 // the size of Ins and InVals. This only happens when on varg functions
286 if (!OutChains.empty()) {
287 OutChains.push_back(Chain);
288 Chain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other, OutChains);
289 }
290
291 return Chain;
292}
293
296 SmallVectorImpl<SDValue> &InVals) const {
297 SelectionDAG &DAG = CLI.DAG;
298 SDLoc &DL = CLI.DL;
300 SmallVector<SDValue, 32> &OutVals = CLI.OutVals;
302 SDValue Chain = CLI.Chain;
303 SDValue Callee = CLI.Callee;
304 bool &IsTailCall = CLI.IsTailCall;
305 CallingConv::ID CallConv = CLI.CallConv;
306 bool IsVarArg = CLI.IsVarArg;
307
309 EVT PtrVT = getPointerTy(DAG.getDataLayout());
310 const TargetFrameLowering *TFL = Subtarget.getFrameLowering();
311
312 // TODO: Support tail call optimization.
313 IsTailCall = false;
314
315 // Analyze the operands of the call, assigning locations to each operand.
317 CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
318
319 CCAssignFn *CC = CCAssignFnForCall(CallConv, IsVarArg);
320
321 CCInfo.AnalyzeCallOperands(Outs, CC);
322
323 // Get a count of how many bytes are to be pushed on the stack.
324 unsigned NumBytes = CCInfo.getStackSize();
325
326 Align StackAlignment = TFL->getStackAlign();
327 unsigned NextStackOffset = alignTo(NumBytes, StackAlignment);
328
329 Chain = DAG.getCALLSEQ_START(Chain, NextStackOffset, 0, DL);
330
331 // Copy argument values to their designated locations.
332 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
333 SmallVector<SDValue, 8> MemOpChains;
334 SDValue StackPtr;
335 for (unsigned I = 0, E = ArgLocs.size(); I != E; ++I) {
336 CCValAssign &VA = ArgLocs[I];
337 SDValue ArgValue = OutVals[I];
338 ISD::ArgFlagsTy Flags = Outs[I].Flags;
339
340 if (VA.isRegLoc())
341 // Queue up the argument copies and emit them at the end.
342 RegsToPass.push_back(std::make_pair(VA.getLocReg(), ArgValue));
343 else if (Flags.isByVal()) {
344 assert(VA.isMemLoc());
345 assert(Flags.getByValSize() &&
346 "ByVal args of size 0 should have been ignored by front-end.");
347 assert(!IsTailCall &&
348 "Do not tail-call optimize if there is a byval argument.");
349
350 if (!StackPtr.getNode())
351 StackPtr = DAG.getCopyFromReg(Chain, DL, Xtensa::SP, PtrVT);
352 unsigned Offset = VA.getLocMemOffset();
353 SDValue Address = DAG.getNode(ISD::ADD, DL, PtrVT, StackPtr,
355 SDValue SizeNode = DAG.getConstant(Flags.getByValSize(), DL, MVT::i32);
356 SDValue Memcpy = DAG.getMemcpy(
357 Chain, DL, Address, ArgValue, SizeNode, Flags.getNonZeroByValAlign(),
358 /*isVolatile=*/false, /*AlwaysInline=*/false,
359 /*CI=*/nullptr, std::nullopt, MachinePointerInfo(), MachinePointerInfo());
360 MemOpChains.push_back(Memcpy);
361 } else {
362 assert(VA.isMemLoc() && "Argument not register or memory");
363
364 // Work out the address of the stack slot. Unpromoted ints and
365 // floats are passed as right-justified 8-byte values.
366 if (!StackPtr.getNode())
367 StackPtr = DAG.getCopyFromReg(Chain, DL, Xtensa::SP, PtrVT);
368 unsigned Offset = VA.getLocMemOffset();
369 SDValue Address = DAG.getNode(ISD::ADD, DL, PtrVT, StackPtr,
371
372 // Emit the store.
373 MemOpChains.push_back(
374 DAG.getStore(Chain, DL, ArgValue, Address, MachinePointerInfo()));
375 }
376 }
377
378 // Join the stores, which are independent of one another.
379 if (!MemOpChains.empty())
380 Chain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other, MemOpChains);
381
382 // Build a sequence of copy-to-reg nodes, chained and glued together.
383 SDValue Glue;
384 for (unsigned I = 0, E = RegsToPass.size(); I != E; ++I) {
385 unsigned Reg = RegsToPass[I].first;
386 Chain = DAG.getCopyToReg(Chain, DL, Reg, RegsToPass[I].second, Glue);
387 Glue = Chain.getValue(1);
388 }
389 std::string name;
390 unsigned char TF = 0;
391
392 // Accept direct calls by converting symbolic call addresses to the
393 // associated Target* opcodes.
394 if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) {
395 name = E->getSymbol();
396 TF = E->getTargetFlags();
397 if (isPositionIndependent()) {
398 report_fatal_error("PIC relocations is not supported");
399 } else
400 Callee = DAG.getTargetExternalSymbol(E->getSymbol(), PtrVT, TF);
401 } else if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
402 const GlobalValue *GV = G->getGlobal();
403 name = GV->getName().str();
404 }
405
406 if ((!name.empty()) && isLongCall(name.c_str())) {
407 // Create a constant pool entry for the callee address
409
411 *DAG.getContext(), name.c_str(), 0 /* XtensaCLabelIndex */, false,
412 Modifier);
413
414 // Get the address of the callee into a register
415 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4), 0, TF);
416 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
417 Callee = CPWrap;
418 }
419
420 // The first call operand is the chain and the second is the target address.
422 Ops.push_back(Chain);
423 Ops.push_back(Callee);
424
425 // Add a register mask operand representing the call-preserved registers.
426 const TargetRegisterInfo *TRI = Subtarget.getRegisterInfo();
427 const uint32_t *Mask = TRI->getCallPreservedMask(MF, CallConv);
428 assert(Mask && "Missing call preserved mask for calling convention");
429 Ops.push_back(DAG.getRegisterMask(Mask));
430
431 // Add argument registers to the end of the list so that they are
432 // known live into the call.
433 for (unsigned I = 0, E = RegsToPass.size(); I != E; ++I) {
434 unsigned Reg = RegsToPass[I].first;
435 Ops.push_back(DAG.getRegister(Reg, RegsToPass[I].second.getValueType()));
436 }
437
438 // Glue the call to the argument copies, if any.
439 if (Glue.getNode())
440 Ops.push_back(Glue);
441
442 SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
443 Chain = DAG.getNode(XtensaISD::CALL, DL, NodeTys, Ops);
444 Glue = Chain.getValue(1);
445
446 // Mark the end of the call, which is glued to the call itself.
447 Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, DL, PtrVT, true),
448 DAG.getConstant(0, DL, PtrVT, true), Glue, DL);
449 Glue = Chain.getValue(1);
450
451 // Assign locations to each value returned by this call.
453 CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, *DAG.getContext());
454 RetCCInfo.AnalyzeCallResult(Ins, RetCC_Xtensa);
455
456 // Copy all of the result registers out of their specified physreg.
457 for (unsigned I = 0, E = RetLocs.size(); I != E; ++I) {
458 CCValAssign &VA = RetLocs[I];
459
460 // Copy the value out, gluing the copy to the end of the call sequence.
461 unsigned Reg = VA.getLocReg();
462 SDValue RetValue = DAG.getCopyFromReg(Chain, DL, Reg, VA.getLocVT(), Glue);
463 Chain = RetValue.getValue(1);
464 Glue = RetValue.getValue(2);
465
466 InVals.push_back(RetValue);
467 }
468 return Chain;
469}
470
472 CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
473 const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context) const {
475 CCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
476 return CCInfo.CheckReturn(Outs, RetCC_Xtensa);
477}
478
481 bool IsVarArg,
483 const SmallVectorImpl<SDValue> &OutVals,
484 const SDLoc &DL, SelectionDAG &DAG) const {
485 if (IsVarArg)
486 report_fatal_error("VarArg not supported");
487
489
490 // Assign locations to each returned value.
492 CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, *DAG.getContext());
493 RetCCInfo.AnalyzeReturn(Outs, RetCC_Xtensa);
494
495 SDValue Glue;
496 // Quick exit for void returns
497 if (RetLocs.empty())
498 return DAG.getNode(XtensaISD::RET, DL, MVT::Other, Chain);
499
500 // Copy the result values into the output registers.
502 RetOps.push_back(Chain);
503 for (unsigned I = 0, E = RetLocs.size(); I != E; ++I) {
504 CCValAssign &VA = RetLocs[I];
505 SDValue RetValue = OutVals[I];
506
507 // Make the return register live on exit.
508 assert(VA.isRegLoc() && "Can only return in registers!");
509
510 // Chain and glue the copies together.
511 unsigned Register = VA.getLocReg();
512 Chain = DAG.getCopyToReg(Chain, DL, Register, RetValue, Glue);
513 Glue = Chain.getValue(1);
514 RetOps.push_back(DAG.getRegister(Register, VA.getLocVT()));
515 }
516
517 // Update chain and glue.
518 RetOps[0] = Chain;
519 if (Glue.getNode())
520 RetOps.push_back(Glue);
521
522 return DAG.getNode(XtensaISD::RET, DL, MVT::Other, RetOps);
523}
524
526 switch (Cond) {
527 case ISD::SETEQ:
528 return Xtensa::BEQ;
529 case ISD::SETNE:
530 return Xtensa::BNE;
531 case ISD::SETLT:
532 return Xtensa::BLT;
533 case ISD::SETLE:
534 return Xtensa::BGE;
535 case ISD::SETGT:
536 return Xtensa::BLT;
537 case ISD::SETGE:
538 return Xtensa::BGE;
539 case ISD::SETULT:
540 return Xtensa::BLTU;
541 case ISD::SETULE:
542 return Xtensa::BGEU;
543 case ISD::SETUGT:
544 return Xtensa::BLTU;
545 case ISD::SETUGE:
546 return Xtensa::BGEU;
547 default:
548 llvm_unreachable("Unknown branch kind");
549 }
550}
551
552SDValue XtensaTargetLowering::LowerSELECT_CC(SDValue Op,
553 SelectionDAG &DAG) const {
554 SDLoc DL(Op);
555 EVT Ty = Op.getOperand(0).getValueType();
556 SDValue LHS = Op.getOperand(0);
557 SDValue RHS = Op.getOperand(1);
558 SDValue TrueValue = Op.getOperand(2);
559 SDValue FalseValue = Op.getOperand(3);
560 ISD::CondCode CC = cast<CondCodeSDNode>(Op->getOperand(4))->get();
561
562 unsigned BrOpcode = getBranchOpcode(CC);
563 SDValue TargetCC = DAG.getConstant(BrOpcode, DL, MVT::i32);
564
565 return DAG.getNode(XtensaISD::SELECT_CC, DL, Ty, LHS, RHS, TrueValue,
566 FalseValue, TargetCC);
567}
568
569SDValue XtensaTargetLowering::LowerImmediate(SDValue Op,
570 SelectionDAG &DAG) const {
571 const ConstantSDNode *CN = cast<ConstantSDNode>(Op);
572 SDLoc DL(CN);
573 APInt APVal = CN->getAPIntValue();
574 int64_t Value = APVal.getSExtValue();
575 if (Op.getValueType() == MVT::i32) {
576 // Check if use node maybe lowered to the MOVI instruction
577 if (Value > -2048 && Value <= 2047)
578 return Op;
579 // Check if use node maybe lowered to the ADDMI instruction
580 SDNode &OpNode = *Op.getNode();
581 if ((OpNode.hasOneUse() && OpNode.use_begin()->getOpcode() == ISD::ADD) &&
582 isShiftedInt<16, 8>(Value))
583 return Op;
584 Type *Ty = Type::getInt32Ty(*DAG.getContext());
585 Constant *CV = ConstantInt::get(Ty, Value);
586 SDValue CP = DAG.getConstantPool(CV, MVT::i32);
587 return CP;
588 }
589 return Op;
590}
591
592SDValue XtensaTargetLowering::LowerGlobalAddress(SDValue Op,
593 SelectionDAG &DAG) const {
594 const GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Op);
595 SDLoc DL(Op);
596 auto PtrVT = Op.getValueType();
597 const GlobalValue *GV = G->getGlobal();
598
599 SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, Align(4));
600 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
601
602 return CPWrap;
603}
604
605SDValue XtensaTargetLowering::LowerBlockAddress(SDValue Op,
606 SelectionDAG &DAG) const {
607 BlockAddressSDNode *Node = cast<BlockAddressSDNode>(Op);
608 const BlockAddress *BA = Node->getBlockAddress();
609 EVT PtrVT = Op.getValueType();
610
613 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
614 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
615
616 return CPWrap;
617}
618
619SDValue XtensaTargetLowering::LowerBR_JT(SDValue Op, SelectionDAG &DAG) const {
620 SDValue Chain = Op.getOperand(0);
621 SDValue Table = Op.getOperand(1);
622 SDValue Index = Op.getOperand(2);
623 SDLoc DL(Op);
624 JumpTableSDNode *JT = cast<JumpTableSDNode>(Table);
626 const MachineJumpTableInfo *MJTI = MF.getJumpTableInfo();
627 SDValue TargetJT = DAG.getTargetJumpTable(JT->getIndex(), MVT::i32);
628 const DataLayout &TD = DAG.getDataLayout();
629 EVT PtrVT = Table.getValueType();
630 unsigned EntrySize = MJTI->getEntrySize(TD);
631
632 Index = DAG.getNode(ISD::MUL, DL, Index.getValueType(), Index,
633 DAG.getConstant(EntrySize, DL, Index.getValueType()));
634 SDValue Addr = DAG.getNode(ISD::ADD, DL, Index.getValueType(), Index, Table);
635 SDValue LD =
636 DAG.getLoad(PtrVT, DL, Chain, Addr,
638
639 return DAG.getNode(XtensaISD::BR_JT, DL, MVT::Other, LD.getValue(1), LD,
640 TargetJT);
641}
642
643SDValue XtensaTargetLowering::LowerJumpTable(SDValue Op,
644 SelectionDAG &DAG) const {
645 JumpTableSDNode *JT = cast<JumpTableSDNode>(Op);
646 EVT PtrVT = Op.getValueType();
647
648 // Create a constant pool entry for the callee address
651
652 // Get the address of the callee into a register
653 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
654
655 return getAddrPCRel(CPAddr, DAG);
656}
657
658SDValue XtensaTargetLowering::getAddrPCRel(SDValue Op,
659 SelectionDAG &DAG) const {
660 SDLoc DL(Op);
661 EVT Ty = Op.getValueType();
662 return DAG.getNode(XtensaISD::PCREL_WRAPPER, DL, Ty, Op);
663}
664
665SDValue XtensaTargetLowering::LowerConstantPool(ConstantPoolSDNode *CP,
666 SelectionDAG &DAG) const {
667 EVT PtrVT = getPointerTy(DAG.getDataLayout());
669 if (!CP->isMachineConstantPoolEntry()) {
670 Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(),
671 CP->getOffset());
672 } else {
673 report_fatal_error("This constantpool type is not supported yet");
674 }
675
676 return getAddrPCRel(Result, DAG);
677}
678
679SDValue XtensaTargetLowering::LowerSTACKSAVE(SDValue Op,
680 SelectionDAG &DAG) const {
681 return DAG.getCopyFromReg(Op.getOperand(0), SDLoc(Op), Xtensa::SP,
682 Op.getValueType());
683}
684
685SDValue XtensaTargetLowering::LowerSTACKRESTORE(SDValue Op,
686 SelectionDAG &DAG) const {
687 return DAG.getCopyToReg(Op.getOperand(0), SDLoc(Op), Xtensa::SP,
688 Op.getOperand(1));
689}
690
691SDValue XtensaTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
692 SelectionDAG &DAG) const {
693 SDValue Chain = Op.getOperand(0); // Legalize the chain.
694 SDValue Size = Op.getOperand(1); // Legalize the size.
695 EVT VT = Size->getValueType(0);
696 SDLoc DL(Op);
697
698 // Round up Size to 32
699 SDValue SizeTmp =
700 DAG.getNode(ISD::ADD, DL, VT, Size, DAG.getConstant(31, DL, MVT::i32));
701 SDValue SizeRoundUp = DAG.getNode(ISD::AND, DL, VT, SizeTmp,
702 DAG.getConstant(~31, DL, MVT::i32));
703
704 unsigned SPReg = Xtensa::SP;
705 SDValue SP = DAG.getCopyFromReg(Chain, DL, SPReg, VT);
706 SDValue NewSP = DAG.getNode(ISD::SUB, DL, VT, SP, SizeRoundUp); // Value
707 Chain = DAG.getCopyToReg(SP.getValue(1), DL, SPReg, NewSP); // Output chain
708
709 SDValue NewVal = DAG.getCopyFromReg(Chain, DL, SPReg, MVT::i32);
710 Chain = NewVal.getValue(1);
711
712 SDValue Ops[2] = {NewVal, Chain};
713 return DAG.getMergeValues(Ops, DL);
714}
715
717 SelectionDAG &DAG) const {
718 switch (Op.getOpcode()) {
719 case ISD::BR_JT:
720 return LowerBR_JT(Op, DAG);
721 case ISD::Constant:
722 return LowerImmediate(Op, DAG);
724 return LowerGlobalAddress(Op, DAG);
726 return LowerBlockAddress(Op, DAG);
727 case ISD::JumpTable:
728 return LowerJumpTable(Op, DAG);
730 return LowerConstantPool(cast<ConstantPoolSDNode>(Op), DAG);
731 case ISD::SELECT_CC:
732 return LowerSELECT_CC(Op, DAG);
733 case ISD::STACKSAVE:
734 return LowerSTACKSAVE(Op, DAG);
736 return LowerSTACKRESTORE(Op, DAG);
738 return LowerDYNAMIC_STACKALLOC(Op, DAG);
739 default:
740 report_fatal_error("Unexpected node to lower");
741 }
742}
743
744const char *XtensaTargetLowering::getTargetNodeName(unsigned Opcode) const {
745 switch (Opcode) {
746 case XtensaISD::BR_JT:
747 return "XtensaISD::BR_JT";
748 case XtensaISD::CALL:
749 return "XtensaISD::CALL";
751 return "XtensaISD::PCREL_WRAPPER";
752 case XtensaISD::RET:
753 return "XtensaISD::RET";
755 return "XtensaISD::SELECT_CC";
756 }
757 return nullptr;
758}
759
760//===----------------------------------------------------------------------===//
761// Custom insertion
762//===----------------------------------------------------------------------===//
763
765XtensaTargetLowering::emitSelectCC(MachineInstr &MI,
766 MachineBasicBlock *MBB) const {
767 const TargetInstrInfo &TII = *Subtarget.getInstrInfo();
768 DebugLoc DL = MI.getDebugLoc();
769
770 MachineOperand &LHS = MI.getOperand(1);
771 MachineOperand &RHS = MI.getOperand(2);
772 MachineOperand &TrueValue = MI.getOperand(3);
773 MachineOperand &FalseValue = MI.getOperand(4);
774 unsigned BrKind = MI.getOperand(5).getImm();
775
776 // To "insert" a SELECT_CC instruction, we actually have to insert
777 // CopyMBB and SinkMBB blocks and add branch to MBB. We build phi
778 // operation in SinkMBB like phi (TrueVakue,FalseValue), where TrueValue
779 // is passed from MMB and FalseValue is passed from CopyMBB.
780 // MBB
781 // | \
782 // | CopyMBB
783 // | /
784 // SinkMBB
785 // The incoming instruction knows the
786 // destination vreg to set, the condition code register to branch on, the
787 // true/false values to select between, and a branch opcode to use.
788 const BasicBlock *LLVM_BB = MBB->getBasicBlock();
790
792 MachineBasicBlock *CopyMBB = F->CreateMachineBasicBlock(LLVM_BB);
793 MachineBasicBlock *SinkMBB = F->CreateMachineBasicBlock(LLVM_BB);
794
795 F->insert(It, CopyMBB);
796 F->insert(It, SinkMBB);
797
798 // Transfer the remainder of MBB and its successor edges to SinkMBB.
799 SinkMBB->splice(SinkMBB->begin(), MBB,
800 std::next(MachineBasicBlock::iterator(MI)), MBB->end());
802
803 MBB->addSuccessor(CopyMBB);
804 MBB->addSuccessor(SinkMBB);
805
806 BuildMI(MBB, DL, TII.get(BrKind))
807 .addReg(LHS.getReg())
808 .addReg(RHS.getReg())
809 .addMBB(SinkMBB);
810
811 CopyMBB->addSuccessor(SinkMBB);
812
813 // SinkMBB:
814 // %Result = phi [ %FalseValue, CopyMBB ], [ %TrueValue, MBB ]
815 // ...
816
817 BuildMI(*SinkMBB, SinkMBB->begin(), DL, TII.get(Xtensa::PHI),
818 MI.getOperand(0).getReg())
819 .addReg(FalseValue.getReg())
820 .addMBB(CopyMBB)
821 .addReg(TrueValue.getReg())
822 .addMBB(MBB);
823
824 MI.eraseFromParent(); // The pseudo instruction is gone now.
825 return SinkMBB;
826}
827
830 switch (MI.getOpcode()) {
831 case Xtensa::SELECT:
832 return emitSelectCC(MI, MBB);
833 default:
834 llvm_unreachable("Unexpected instr type to insert");
835 }
836}
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
uint64_t Addr
uint64_t Size
const HexagonInstrInfo * TII
IRTranslator LLVM IR MI
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
#define G(x, y, z)
Definition: MD5.cpp:56
unsigned const TargetRegisterInfo * TRI
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const char * name
Definition: SMEABIPass.cpp:50
static const MCPhysReg IntRegs[32]
Value * RHS
Value * LHS
static bool CC_Xtensa_Custom(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
static bool isLongCall(const char *str)
static unsigned getBranchOpcode(ISD::CondCode Cond)
Class for arbitrary precision integers.
Definition: APInt.h:78
int64_t getSExtValue() const
Get sign extended value.
Definition: APInt.h:1520
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
The address of a basic block.
Definition: Constants.h:890
CCState - This class holds information needed while lowering arguments and return values.
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
MCRegister AllocateReg(MCPhysReg Reg)
AllocateReg - Attempt to allocate one register.
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
int64_t AllocateStack(unsigned Size, Align Alignment)
AllocateStack - Allocate a chunk of stack space with the specified size and alignment.
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
uint64_t getStackSize() const
Returns the size of the currently allocated portion of the stack.
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
void addLoc(const CCValAssign &V)
CCValAssign - Represent assignment of one arg/retval to a location.
bool isRegLoc() const
Register getLocReg() const
LocInfo getLocInfo() const
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, MVT LocVT, LocInfo HTP, bool IsCustom=false)
static CCValAssign getReg(unsigned ValNo, MVT ValVT, unsigned RegNo, MVT LocVT, LocInfo HTP, bool IsCustom=false)
bool isMemLoc() const
int64_t getLocMemOffset() const
unsigned getValNo() const
const APInt & getAPIntValue() const
This is an important base class in LLVM.
Definition: Constant.h:42
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
A debug info location.
Definition: DebugLoc.h:33
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Machine Value Type.
static auto integer_valuetypes()
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
void transferSuccessorsAndUpdatePHIs(MachineBasicBlock *FromMBB)
Transfers all the successors, as in transferSuccessors, and update PHI operands in the successor bloc...
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Register addLiveIn(MCRegister PReg, const TargetRegisterClass *RC)
addLiveIn - Add the specified physical register as a live-in value and create a corresponding virtual...
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
Representation of each machine instruction.
Definition: MachineInstr.h:69
unsigned getEntrySize(const DataLayout &TD) const
getEntrySize - Return the size of each entry in the jump table.
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
unsigned getOpcode() const
Return the SelectionDAG opcode value for this node.
bool hasOneUse() const
Return true if there is exactly one use of this node.
use_iterator use_begin() const
Provide iteration support to walk over all uses of an SDNode.
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
SDNode * getNode() const
get the SDNode which holds the desired result
SDValue getValue(unsigned R) const
EVT getValueType() const
Return the ValueType of the referenced return value.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:226
SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
SDValue getMemcpy(SDValue Chain, const SDLoc &dl, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool isVol, bool AlwaysInline, const CallInst *CI, std::optional< bool > OverrideTailCall, MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo, const AAMDNodes &AAInfo=AAMDNodes(), AAResults *AA=nullptr)
SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offs=0, bool isT=false, unsigned TargetFlags=0)
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
Definition: SelectionDAG.h:746
SDValue getCALLSEQ_END(SDValue Chain, SDValue Op1, SDValue Op2, SDValue InGlue, const SDLoc &DL)
Return a new CALLSEQ_END node, which always must have a glue result (to ensure it's not CSE'd).
const DataLayout & getDataLayout() const
Definition: SelectionDAG.h:487
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getStore(SDValue Chain, const SDLoc &dl, SDValue Val, SDValue Ptr, MachinePointerInfo PtrInfo, Align Alignment, MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes())
Helper function to build ISD::STORE nodes.
SDValue getCALLSEQ_START(SDValue Chain, uint64_t InSize, uint64_t OutSize, const SDLoc &DL)
Return a new CALLSEQ_START node, that starts new call frame, in which InSize bytes are set up inside ...
SDValue getRegister(unsigned Reg, EVT VT)
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, unsigned Reg, SDValue N)
Definition: SelectionDAG.h:787
SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
SDValue getValueType(EVT)
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:482
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, unsigned Reg, EVT VT)
Definition: SelectionDAG.h:813
SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
SDValue getRegisterMask(const uint32_t *RegMask)
LLVMContext * getContext() const
Definition: SelectionDAG.h:500
SDValue getTargetExternalSymbol(const char *Sym, EVT VT, unsigned TargetFlags=0)
SDValue getTargetConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offset=0, unsigned TargetFlags=0)
Definition: SelectionDAG.h:753
bool empty() const
Definition: SmallVector.h:94
size_t size() const
Definition: SmallVector.h:91
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:586
void push_back(const T &Elt)
Definition: SmallVector.h:426
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:215
Information about stack frame layout on the target.
Align getStackAlign() const
getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...
TargetInstrInfo - Interface to description of machine instruction set.
void setOperationAction(unsigned Op, MVT VT, LegalizeAction Action)
Indicate that the specified operation does not work with the specified type and indicate what to do a...
void setMinFunctionAlignment(Align Alignment)
Set the target's minimum function alignment.
void setBooleanContents(BooleanContent Ty)
Specify how the target extends the result of integer and floating point boolean values from i1 to a w...
void computeRegisterProperties(const TargetRegisterInfo *TRI)
Once all of the register classes are added, this allows us to compute derived properties we expose.
void addRegisterClass(MVT VT, const TargetRegisterClass *RC)
Add the specified register class as an available regclass for the specified value type.
virtual MVT getPointerTy(const DataLayout &DL, uint32_t AS=0) const
Return the pointer type for the given address space, defaults to the pointer type from the data layou...
void setStackPointerRegisterToSaveRestore(Register R)
If set to a physical register, this specifies the register that llvm.savestack/llvm....
void setCondCodeAction(ArrayRef< ISD::CondCode > CCs, MVT VT, LegalizeAction Action)
Indicate that the specified condition code is or isn't supported on the target and indicate what to d...
void setLoadExtAction(unsigned ExtType, MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified load with extension does not work with the specified type and indicate wh...
MVT getFrameIndexTy(const DataLayout &DL) const
Return the type for frame index, which is determined by the alloca address space specified through th...
void setSchedulingPreference(Sched::Preference Pref)
Specify the target scheduling preference.
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
bool isPositionIndependent() const
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
static IntegerType * getInt32Ty(LLVMContext &C)
LLVM Value Representation.
Definition: Value.h:74
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
static XtensaConstantPoolConstant * Create(const Constant *C, unsigned ID, XtensaCP::XtensaCPKind Kind)
static XtensaConstantPoolJumpTable * Create(LLVMContext &C, unsigned Idx)
static XtensaConstantPoolSymbol * Create(LLVMContext &C, const char *S, unsigned ID, bool PrivLinkage, XtensaCP::XtensaCPModifier Modifier=XtensaCP::no_modifier)
XtensaConstantPoolValue - Xtensa specific constantpool value.
const XtensaInstrInfo * getInstrInfo() const override
const XtensaRegisterInfo * getRegisterInfo() const override
const TargetFrameLowering * getFrameLowering() const override
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *BB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg, const SmallVectorImpl< ISD::InputArg > &Ins, const SDLoc &DL, SelectionDAG &DAG, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower the incoming (formal) arguments, described by the Ins array,...
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
XtensaTargetLowering(const TargetMachine &TM, const XtensaSubtarget &STI)
SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, const SmallVectorImpl< SDValue > &OutVals, const SDLoc &DL, SelectionDAG &DAG) const override
This hook must be implemented to lower outgoing return values, described by the Outs array,...
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
This callback is invoked for operations that are unsupported by the target, which are registered to u...
self_iterator getIterator()
Definition: ilist_node.h:132
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
Definition: ISDOpcodes.h:779
@ STACKRESTORE
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain.
Definition: ISDOpcodes.h:1194
@ STACKSAVE
STACKSAVE - STACKSAVE has one operand, an input chain.
Definition: ISDOpcodes.h:1190
@ ADD
Simple integer binary arithmetic operators.
Definition: ISDOpcodes.h:246
@ GlobalAddress
Definition: ISDOpcodes.h:78
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
Definition: ISDOpcodes.h:840
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
Definition: ISDOpcodes.h:953
@ BR_CC
BR_CC - Conditional branch.
Definition: ISDOpcodes.h:1145
@ BR_JT
BR_JT - Jumptable branch.
Definition: ISDOpcodes.h:1124
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
Definition: ISDOpcodes.h:756
@ SELECT_CC
Select with condition operator - This selects between a true value and a false value (ops #2 and #3) ...
Definition: ISDOpcodes.h:771
@ DYNAMIC_STACKALLOC
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary.
Definition: ISDOpcodes.h:1109
@ ConstantPool
Definition: ISDOpcodes.h:82
@ SIGN_EXTEND_INREG
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
Definition: ISDOpcodes.h:848
@ FP_TO_SINT
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
Definition: ISDOpcodes.h:886
@ AND
Bitwise operators - logical and, logical or, logical xor.
Definition: ISDOpcodes.h:708
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
Definition: ISDOpcodes.h:52
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
Definition: ISDOpcodes.h:816
@ BlockAddress
Definition: ISDOpcodes.h:84
@ AssertSext
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
Definition: ISDOpcodes.h:61
@ AssertZext
Definition: ISDOpcodes.h:62
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
Definition: ISDOpcodes.h:1603
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:167
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
Definition: Alignment.h:155
DWARFExpression::Operation Op
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
Extended Value Type.
Definition: ValueTypes.h:35
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
Definition: ValueTypes.h:381
Align getNonZeroOrigAlign() const
unsigned getByValSize() const
Align getNonZeroByValAlign() const
This class contains a discriminated union of information about pointers in memory operands,...
static MachinePointerInfo getJumpTable(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a jump table entry.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
This represents a list of ValueType's that has been intern'd by a SelectionDAG.
This structure contains all information that is necessary for lowering calls.
SmallVector< ISD::InputArg, 32 > Ins
SmallVector< ISD::OutputArg, 32 > Outs
SmallVector< SDValue, 32 > OutVals