LLVM 22.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 "XtensaInstrInfo.h"
18#include "XtensaSubtarget.h"
19#include "XtensaTargetMachine.h"
27#include "llvm/Support/Debug.h"
31#include <deque>
32
33using namespace llvm;
34
35#define DEBUG_TYPE "xtensa-lower"
36
37// Return true if we must use long (in fact, indirect) function call.
38// It's simplified version, production implimentation must
39// resolve a functions in ROM (usually glibc functions)
40static bool isLongCall(const char *str) {
41 // Currently always use long calls
42 return true;
43}
44
45// The calling conventions in XtensaCallingConv.td are described in terms of the
46// callee's register window. This function translates registers to the
47// corresponding caller window %o register.
48static unsigned toCallerWindow(unsigned Reg) {
49 if (Reg >= Xtensa::A2 && Reg <= Xtensa::A7)
50 return Reg - Xtensa::A2 + Xtensa::A10;
51 return Reg;
52}
53
55 const XtensaSubtarget &STI)
56 : TargetLowering(TM), Subtarget(STI) {
57 MVT PtrVT = MVT::i32;
58 // Set up the register classes.
59 addRegisterClass(MVT::i32, &Xtensa::ARRegClass);
60
61 if (Subtarget.hasSingleFloat()) {
62 addRegisterClass(MVT::f32, &Xtensa::FPRRegClass);
63 }
64
65 if (Subtarget.hasBoolean()) {
66 addRegisterClass(MVT::v1i1, &Xtensa::BRRegClass);
67 }
68
69 // Set up special registers.
71
73
75
80
82
84 setOperationAction(ISD::SIGN_EXTEND_INREG, {MVT::i8, MVT::i16},
85 Subtarget.hasSEXT() ? Legal : Expand);
86
93
94 // No sign extend instructions for i1 and sign extend load i8
95 for (MVT VT : MVT::integer_valuetypes()) {
100 }
101
107
108 // Expand jump table branches as address arithmetic followed by an
109 // indirect jump.
111
114
118
119 if (Subtarget.hasSingleFloat()) {
122 } else {
125 }
126
129
134
135 if (Subtarget.hasMul32())
137 else
139
140 if (Subtarget.hasMul32High()) {
143 } else {
146 }
147
150
151 if (Subtarget.hasDiv32()) {
156 } else {
161 }
162
165
169
178
180 Subtarget.hasMINMAX() ? Legal : Expand);
181
182 // Implement custom stack allocations
184 // Implement custom stack save and restore
187
188 // VASTART, VAARG and VACOPY need to deal with the Xtensa-specific varargs
189 // structure, but VAEND is a no-op.
194
195 // Handle floating-point types.
196 for (unsigned I = MVT::FIRST_FP_VALUETYPE; I <= MVT::LAST_FP_VALUETYPE; ++I) {
198 if (isTypeLegal(VT)) {
199 if (VT.getSizeInBits() == 32 && Subtarget.hasSingleFloat()) {
206 } else {
213 }
214
215 // TODO: once implemented in InstrInfo uncomment
224 }
225 }
226
227 // Handle floating-point types.
228 if (Subtarget.hasSingleFloat()) {
235
241 } else {
248 }
249
250 // Floating-point truncation and stores need to be done separately.
251 setTruncStoreAction(MVT::f64, MVT::f32, Expand);
252
253 if (Subtarget.hasS32C1I()) {
256 } else if (Subtarget.hasForcedAtomics()) {
258 } else {
260 }
261
262 // Compute derived properties from the register classes
264}
265
267 const GlobalAddressSDNode *GA) const {
268 // The Xtensa target isn't yet aware of offsets.
269 return false;
270}
271
273 bool ForCodeSize) const {
274 return false;
275}
276
277//===----------------------------------------------------------------------===//
278// Inline asm support
279//===----------------------------------------------------------------------===//
282 if (Constraint.size() == 1) {
283 switch (Constraint[0]) {
284 case 'r':
285 return C_RegisterClass;
286 default:
287 break;
288 }
289 }
290 return TargetLowering::getConstraintType(Constraint);
291}
292
295 AsmOperandInfo &Info, const char *Constraint) const {
297 Value *CallOperandVal = Info.CallOperandVal;
298 // If we don't have a value, we can't do a match,
299 // but allow it at the lowest weight.
300 if (!CallOperandVal)
301 return CW_Default;
302
303 Type *Ty = CallOperandVal->getType();
304
305 // Look at the constraint type.
306 switch (*Constraint) {
307 default:
309 break;
310 case 'r':
311 if (Ty->isIntegerTy())
312 Weight = CW_Register;
313 break;
314 }
315 return Weight;
316}
317
318std::pair<unsigned, const TargetRegisterClass *>
320 const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const {
321 if (Constraint.size() == 1) {
322 // GCC Constraint Letters
323 switch (Constraint[0]) {
324 default:
325 break;
326 case 'r': // General-purpose register
327 return std::make_pair(0U, &Xtensa::ARRegClass);
328 }
329 }
331}
332
334 SDValue Op, StringRef Constraint, std::vector<SDValue> &Ops,
335 SelectionDAG &DAG) const {
336 SDLoc DL(Op);
337
338 // Only support length 1 constraints for now.
339 if (Constraint.size() > 1)
340 return;
341
343}
344
345//===----------------------------------------------------------------------===//
346// Calling conventions
347//===----------------------------------------------------------------------===//
348
349#include "XtensaGenCallingConv.inc"
350
351static const MCPhysReg IntRegs[] = {Xtensa::A2, Xtensa::A3, Xtensa::A4,
352 Xtensa::A5, Xtensa::A6, Xtensa::A7};
353
354static bool CC_Xtensa_Custom(unsigned ValNo, MVT ValVT, MVT LocVT,
355 CCValAssign::LocInfo LocInfo,
356 ISD::ArgFlagsTy ArgFlags, Type *OrigTy,
357 CCState &State) {
358 if (ArgFlags.isByVal()) {
359 Align ByValAlign = ArgFlags.getNonZeroByValAlign();
360 unsigned ByValSize = ArgFlags.getByValSize();
361 if (ByValSize < 4) {
362 ByValSize = 4;
363 }
364 if (ByValAlign < Align(4)) {
365 ByValAlign = Align(4);
366 }
367 unsigned Offset = State.AllocateStack(ByValSize, ByValAlign);
368 State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
369 // Mark all unused registers as allocated to avoid misuse
370 // of such registers.
371 while (State.AllocateReg(IntRegs))
372 ;
373 return false;
374 }
375
376 // Promote i8 and i16
377 if (LocVT == MVT::i8 || LocVT == MVT::i16) {
378 LocVT = MVT::i32;
379 if (ArgFlags.isSExt())
380 LocInfo = CCValAssign::SExt;
381 else if (ArgFlags.isZExt())
382 LocInfo = CCValAssign::ZExt;
383 else
384 LocInfo = CCValAssign::AExt;
385 }
386
387 unsigned Register;
388
389 Align OrigAlign = ArgFlags.getNonZeroOrigAlign();
390 bool needs64BitAlign = (ValVT == MVT::i32 && OrigAlign == Align(8));
391 bool needs128BitAlign = (ValVT == MVT::i32 && OrigAlign == Align(16));
392
393 if (ValVT == MVT::i32) {
395 // If this is the first part of an i64 arg,
396 // the allocated register must be either A2, A4 or A6.
397 if (needs64BitAlign && (Register == Xtensa::A3 || Register == Xtensa::A5 ||
398 Register == Xtensa::A7))
400 // arguments with 16byte alignment must be passed in the first register or
401 // passed via stack
402 if (needs128BitAlign && (Register != Xtensa::A2))
403 while ((Register = State.AllocateReg(IntRegs)))
404 ;
405 LocVT = MVT::i32;
406 } else if (ValVT == MVT::f64) {
407 // Allocate int register and shadow next int register.
409 if (Register == Xtensa::A3 || Register == Xtensa::A5 ||
410 Register == Xtensa::A7)
412 State.AllocateReg(IntRegs);
413 LocVT = MVT::i32;
414 } else {
415 report_fatal_error("Cannot handle this ValVT.");
416 }
417
418 if (!Register) {
419 unsigned Offset = State.AllocateStack(ValVT.getStoreSize(), OrigAlign);
420 State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
421 } else {
422 State.addLoc(CCValAssign::getReg(ValNo, ValVT, Register, LocVT, LocInfo));
423 }
424
425 return false;
426}
427
428/// Return the register type for a given MVT
431 EVT VT) const {
432 if (VT.isFloatingPoint())
433 return MVT::i32;
434
436}
437
438CCAssignFn *XtensaTargetLowering::CCAssignFnForCall(CallingConv::ID CC,
439 bool IsVarArg) const {
440 return CC_Xtensa_Custom;
441}
442
444 SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
445 const SmallVectorImpl<ISD::InputArg> &Ins, const SDLoc &DL,
446 SelectionDAG &DAG, SmallVectorImpl<SDValue> &InVals) const {
448 MachineFrameInfo &MFI = MF.getFrameInfo();
450
451 // Used with vargs to acumulate store chains.
452 std::vector<SDValue> OutChains;
453
454 // Assign locations to all of the incoming arguments.
456 CCState CCInfo(CallConv, IsVarArg, DAG.getMachineFunction(), ArgLocs,
457 *DAG.getContext());
458
459 CCInfo.AnalyzeFormalArguments(Ins, CCAssignFnForCall(CallConv, IsVarArg));
460
461 for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) {
462 CCValAssign &VA = ArgLocs[i];
463 // Arguments stored on registers
464 if (VA.isRegLoc()) {
465 EVT RegVT = VA.getLocVT();
466
467 if (RegVT != MVT::i32)
468 report_fatal_error("RegVT not supported by FormalArguments Lowering");
469
470 // Transform the arguments stored on
471 // physical registers into virtual ones
472 Register Reg = 0;
473 MCRegister FrameReg = Subtarget.getRegisterInfo()->getFrameRegister(MF);
474
475 // Argument passed in FrameReg in Windowed ABI we save in A8 (in
476 // emitPrologue), so load argument from A8
477 if (Subtarget.isWindowedABI() && (VA.getLocReg() == FrameReg)) {
478 Reg = MF.addLiveIn(Xtensa::A8, &Xtensa::ARRegClass);
479 XtensaFI->setSaveFrameRegister();
480 } else {
481 Reg = MF.addLiveIn(VA.getLocReg(), &Xtensa::ARRegClass);
482 }
483
484 SDValue ArgValue = DAG.getCopyFromReg(Chain, DL, Reg, RegVT);
485
486 // If this is an 8 or 16-bit value, it has been passed promoted
487 // to 32 bits. Insert an assert[sz]ext to capture this, then
488 // truncate to the right size.
489 if (VA.getLocInfo() != CCValAssign::Full) {
490 unsigned Opcode = 0;
491 if (VA.getLocInfo() == CCValAssign::SExt)
492 Opcode = ISD::AssertSext;
493 else if (VA.getLocInfo() == CCValAssign::ZExt)
494 Opcode = ISD::AssertZext;
495 if (Opcode)
496 ArgValue = DAG.getNode(Opcode, DL, RegVT, ArgValue,
497 DAG.getValueType(VA.getValVT()));
498 ArgValue = DAG.getNode((VA.getValVT() == MVT::f32) ? ISD::BITCAST
500 DL, VA.getValVT(), ArgValue);
501 }
502
503 InVals.push_back(ArgValue);
504
505 } else {
506 assert(VA.isMemLoc());
507
508 EVT ValVT = VA.getValVT();
509
510 // The stack pointer offset is relative to the caller stack frame.
511 int FI = MFI.CreateFixedObject(ValVT.getStoreSize(), VA.getLocMemOffset(),
512 true);
513
514 if (Ins[VA.getValNo()].Flags.isByVal()) {
515 // Assume that in this case load operation is created
516 SDValue FIN = DAG.getFrameIndex(FI, MVT::i32);
517 InVals.push_back(FIN);
518 } else {
519 // Create load nodes to retrieve arguments from the stack
520 SDValue FIN =
522 InVals.push_back(DAG.getLoad(
523 ValVT, DL, Chain, FIN,
525 }
526 }
527 }
528
529 if (IsVarArg) {
530 unsigned Idx = CCInfo.getFirstUnallocated(IntRegs);
531 unsigned ArgRegsNum = std::size(IntRegs);
532 const TargetRegisterClass *RC = &Xtensa::ARRegClass;
533 MachineFrameInfo &MFI = MF.getFrameInfo();
534 MachineRegisterInfo &RegInfo = MF.getRegInfo();
535 unsigned RegSize = 4;
536 MVT RegTy = MVT::i32;
537 MVT FITy = getFrameIndexTy(DAG.getDataLayout());
538
539 XtensaFI->setVarArgsFirstGPR(Idx + 2); // 2 - number of a2 register
540
542 MFI.CreateFixedObject(4, CCInfo.getStackSize(), true));
543
544 // Offset of the first variable argument from stack pointer, and size of
545 // the vararg save area. For now, the varargs save area is either zero or
546 // large enough to hold a0-a7.
547 int VaArgOffset, VarArgsSaveSize;
548
549 // If all registers are allocated, then all varargs must be passed on the
550 // stack and we don't need to save any argregs.
551 if (ArgRegsNum == Idx) {
552 VaArgOffset = CCInfo.getStackSize();
553 VarArgsSaveSize = 0;
554 } else {
555 VarArgsSaveSize = RegSize * (ArgRegsNum - Idx);
556 VaArgOffset = -VarArgsSaveSize;
557
558 // Record the frame index of the first variable argument
559 // which is a value necessary to VASTART.
560 int FI = MFI.CreateFixedObject(RegSize, VaArgOffset, true);
561 XtensaFI->setVarArgsInRegsFrameIndex(FI);
562
563 // Copy the integer registers that may have been used for passing varargs
564 // to the vararg save area.
565 for (unsigned I = Idx; I < ArgRegsNum; ++I, VaArgOffset += RegSize) {
566 const Register Reg = RegInfo.createVirtualRegister(RC);
567 RegInfo.addLiveIn(IntRegs[I], Reg);
568
569 SDValue ArgValue = DAG.getCopyFromReg(Chain, DL, Reg, RegTy);
570 FI = MFI.CreateFixedObject(RegSize, VaArgOffset, true);
571 SDValue PtrOff = DAG.getFrameIndex(FI, FITy);
572 SDValue Store = DAG.getStore(Chain, DL, ArgValue, PtrOff,
574 OutChains.push_back(Store);
575 }
576 }
577 }
578
579 // All stores are grouped in one node to allow the matching between
580 // the size of Ins and InVals. This only happens when on varg functions
581 if (!OutChains.empty()) {
582 OutChains.push_back(Chain);
583 Chain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other, OutChains);
584 }
585
586 return Chain;
587}
588
591 SmallVectorImpl<SDValue> &InVals) const {
592 SelectionDAG &DAG = CLI.DAG;
593 SDLoc &DL = CLI.DL;
595 SmallVector<SDValue, 32> &OutVals = CLI.OutVals;
597 SDValue Chain = CLI.Chain;
598 SDValue Callee = CLI.Callee;
599 bool &IsTailCall = CLI.IsTailCall;
600 CallingConv::ID CallConv = CLI.CallConv;
601 bool IsVarArg = CLI.IsVarArg;
602
604 EVT PtrVT = getPointerTy(DAG.getDataLayout());
605 const TargetFrameLowering *TFL = Subtarget.getFrameLowering();
606
607 // TODO: Support tail call optimization.
608 IsTailCall = false;
609
610 // Analyze the operands of the call, assigning locations to each operand.
612 CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
613
614 CCAssignFn *CC = CCAssignFnForCall(CallConv, IsVarArg);
615
616 CCInfo.AnalyzeCallOperands(Outs, CC);
617
618 // Get a count of how many bytes are to be pushed on the stack.
619 unsigned NumBytes = CCInfo.getStackSize();
620
621 Align StackAlignment = TFL->getStackAlign();
622 unsigned NextStackOffset = alignTo(NumBytes, StackAlignment);
623
624 Chain = DAG.getCALLSEQ_START(Chain, NextStackOffset, 0, DL);
625
626 // Copy argument values to their designated locations.
627 std::deque<std::pair<unsigned, SDValue>> RegsToPass;
628 SmallVector<SDValue, 8> MemOpChains;
629 SDValue StackPtr;
630 for (unsigned I = 0, E = ArgLocs.size(); I != E; ++I) {
631 CCValAssign &VA = ArgLocs[I];
632 SDValue ArgValue = OutVals[I];
633 ISD::ArgFlagsTy Flags = Outs[I].Flags;
634
635 if (VA.isRegLoc())
636 // Queue up the argument copies and emit them at the end.
637 RegsToPass.push_back(std::make_pair(VA.getLocReg(), ArgValue));
638 else if (Flags.isByVal()) {
639 assert(VA.isMemLoc());
640 assert(Flags.getByValSize() &&
641 "ByVal args of size 0 should have been ignored by front-end.");
642 assert(!IsTailCall &&
643 "Do not tail-call optimize if there is a byval argument.");
644
645 if (!StackPtr.getNode())
646 StackPtr = DAG.getCopyFromReg(Chain, DL, Xtensa::SP, PtrVT);
647 unsigned Offset = VA.getLocMemOffset();
648 SDValue Address = DAG.getNode(ISD::ADD, DL, PtrVT, StackPtr,
650 SDValue SizeNode = DAG.getConstant(Flags.getByValSize(), DL, MVT::i32);
651 SDValue Memcpy = DAG.getMemcpy(
652 Chain, DL, Address, ArgValue, SizeNode, Flags.getNonZeroByValAlign(),
653 /*isVolatile=*/false, /*AlwaysInline=*/false,
654 /*CI=*/nullptr, std::nullopt, MachinePointerInfo(),
656 MemOpChains.push_back(Memcpy);
657 } else {
658 assert(VA.isMemLoc() && "Argument not register or memory");
659
660 // Work out the address of the stack slot. Unpromoted ints and
661 // floats are passed as right-justified 8-byte values.
662 if (!StackPtr.getNode())
663 StackPtr = DAG.getCopyFromReg(Chain, DL, Xtensa::SP, PtrVT);
664 unsigned Offset = VA.getLocMemOffset();
665 SDValue Address = DAG.getNode(ISD::ADD, DL, PtrVT, StackPtr,
667
668 // Emit the store.
669 MemOpChains.push_back(
670 DAG.getStore(Chain, DL, ArgValue, Address, MachinePointerInfo()));
671 }
672 }
673
674 // Join the stores, which are independent of one another.
675 if (!MemOpChains.empty())
676 Chain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other, MemOpChains);
677
678 // Build a sequence of copy-to-reg nodes, chained and glued together.
679 SDValue Glue;
680 for (unsigned I = 0, E = RegsToPass.size(); I != E; ++I) {
681 unsigned Reg = RegsToPass[I].first;
682 if (Subtarget.isWindowedABI())
683 Reg = toCallerWindow(Reg);
684 Chain = DAG.getCopyToReg(Chain, DL, Reg, RegsToPass[I].second, Glue);
685 Glue = Chain.getValue(1);
686 }
687 std::string name;
688 unsigned char TF = 0;
689
690 // Accept direct calls by converting symbolic call addresses to the
691 // associated Target* opcodes.
692 if (ExternalSymbolSDNode *E = dyn_cast<ExternalSymbolSDNode>(Callee)) {
693 name = E->getSymbol();
694 TF = E->getTargetFlags();
695 if (isPositionIndependent()) {
696 report_fatal_error("PIC relocations is not supported");
697 } else
698 Callee = DAG.getTargetExternalSymbol(E->getSymbol(), PtrVT, TF);
699 } else if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee)) {
700 const GlobalValue *GV = G->getGlobal();
701 name = GV->getName().str();
702 }
703
704 if ((!name.empty()) && isLongCall(name.c_str())) {
705 // Create a constant pool entry for the callee address
707 XtensaMachineFunctionInfo *XtensaFI =
709 unsigned LabelId = XtensaFI->createCPLabelId();
710
712 *DAG.getContext(), name.c_str(), LabelId, false, Modifier);
713
714 // Get the address of the callee into a register
715 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4), 0, TF);
716 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
717 Callee = DAG.getLoad(
718 PtrVT, DL, DAG.getEntryNode(), CPWrap,
720 }
721
722 // The first call operand is the chain and the second is the target address.
724 Ops.push_back(Chain);
725 Ops.push_back(Callee);
726
727 // Add a register mask operand representing the call-preserved registers.
728 const TargetRegisterInfo *TRI = Subtarget.getRegisterInfo();
729 const uint32_t *Mask = TRI->getCallPreservedMask(MF, CallConv);
730 assert(Mask && "Missing call preserved mask for calling convention");
731 Ops.push_back(DAG.getRegisterMask(Mask));
732
733 // Add argument registers to the end of the list so that they are
734 // known live into the call.
735 for (unsigned I = 0, E = RegsToPass.size(); I != E; ++I) {
736 unsigned Reg = RegsToPass[I].first;
737 if (Subtarget.isWindowedABI())
738 Reg = toCallerWindow(Reg);
739 Ops.push_back(DAG.getRegister(Reg, RegsToPass[I].second.getValueType()));
740 }
741
742 // Glue the call to the argument copies, if any.
743 if (Glue.getNode())
744 Ops.push_back(Glue);
745
746 SDVTList NodeTys = DAG.getVTList(MVT::Other, MVT::Glue);
747 Chain = DAG.getNode(Subtarget.isWindowedABI() ? XtensaISD::CALLW8
749 DL, NodeTys, Ops);
750 Glue = Chain.getValue(1);
751
752 // Mark the end of the call, which is glued to the call itself.
753 Chain = DAG.getCALLSEQ_END(Chain, DAG.getConstant(NumBytes, DL, PtrVT, true),
754 DAG.getConstant(0, DL, PtrVT, true), Glue, DL);
755 Glue = Chain.getValue(1);
756
757 // Assign locations to each value returned by this call.
759 CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, *DAG.getContext());
760 RetCCInfo.AnalyzeCallResult(Ins, Subtarget.isWindowedABI() ? RetCCW8_Xtensa
761 : RetCC_Xtensa);
762
763 // Copy all of the result registers out of their specified physreg.
764 for (unsigned I = 0, E = RetLocs.size(); I != E; ++I) {
765 CCValAssign &VA = RetLocs[I];
766
767 // Copy the value out, gluing the copy to the end of the call sequence.
768 unsigned Reg = VA.getLocReg();
769 SDValue RetValue = DAG.getCopyFromReg(Chain, DL, Reg, VA.getLocVT(), Glue);
770 Chain = RetValue.getValue(1);
771 Glue = RetValue.getValue(2);
772
773 InVals.push_back(RetValue);
774 }
775 return Chain;
776}
777
779 CallingConv::ID CallConv, MachineFunction &MF, bool IsVarArg,
780 const SmallVectorImpl<ISD::OutputArg> &Outs, LLVMContext &Context,
781 const Type *RetTy) const {
783 CCState CCInfo(CallConv, IsVarArg, MF, RVLocs, Context);
784 return CCInfo.CheckReturn(Outs, RetCC_Xtensa);
785}
786
789 bool IsVarArg,
791 const SmallVectorImpl<SDValue> &OutVals,
792 const SDLoc &DL, SelectionDAG &DAG) const {
794
795 // Assign locations to each returned value.
797 CCState RetCCInfo(CallConv, IsVarArg, MF, RetLocs, *DAG.getContext());
798 RetCCInfo.AnalyzeReturn(Outs, RetCC_Xtensa);
799
800 SDValue Glue;
801 // Quick exit for void returns
802 if (RetLocs.empty())
803 return DAG.getNode(Subtarget.isWindowedABI() ? XtensaISD::RETW
805 DL, MVT::Other, Chain);
806
807 // Copy the result values into the output registers.
809 RetOps.push_back(Chain);
810 for (unsigned I = 0, E = RetLocs.size(); I != E; ++I) {
811 CCValAssign &VA = RetLocs[I];
812 SDValue RetValue = OutVals[I];
813
814 // Make the return register live on exit.
815 assert(VA.isRegLoc() && "Can only return in registers!");
816
817 // Chain and glue the copies together.
818 unsigned Register = VA.getLocReg();
819 Chain = DAG.getCopyToReg(Chain, DL, Register, RetValue, Glue);
820 Glue = Chain.getValue(1);
821 RetOps.push_back(DAG.getRegister(Register, VA.getLocVT()));
822 }
823
824 // Update chain and glue.
825 RetOps[0] = Chain;
826 if (Glue.getNode())
827 RetOps.push_back(Glue);
828
829 return DAG.getNode(Subtarget.isWindowedABI() ? XtensaISD::RETW
831 DL, MVT::Other, RetOps);
832}
833
835 switch (Cond) {
836 case ISD::SETEQ:
837 return Xtensa::BEQ;
838 case ISD::SETNE:
839 return Xtensa::BNE;
840 case ISD::SETLT:
841 return Xtensa::BLT;
842 case ISD::SETLE:
843 return Xtensa::BGE;
844 case ISD::SETGT:
845 return Xtensa::BLT;
846 case ISD::SETGE:
847 return Xtensa::BGE;
848 case ISD::SETULT:
849 return Xtensa::BLTU;
850 case ISD::SETULE:
851 return Xtensa::BGEU;
852 case ISD::SETUGT:
853 return Xtensa::BLTU;
854 case ISD::SETUGE:
855 return Xtensa::BGEU;
856 default:
857 llvm_unreachable("Unknown branch kind");
858 }
859}
860
861static std::pair<unsigned, unsigned> getFPBranchKind(ISD::CondCode Cond) {
862 switch (Cond) {
863 case ISD::SETUNE:
864 return std::make_pair(Xtensa::BF, Xtensa::OEQ_S);
865 case ISD::SETUO:
866 return std::make_pair(Xtensa::BT, Xtensa::UN_S);
867 case ISD::SETO:
868 return std::make_pair(Xtensa::BF, Xtensa::UN_S);
869 case ISD::SETUEQ:
870 return std::make_pair(Xtensa::BT, Xtensa::UEQ_S);
871 case ISD::SETULE:
872 return std::make_pair(Xtensa::BT, Xtensa::ULE_S);
873 case ISD::SETULT:
874 return std::make_pair(Xtensa::BT, Xtensa::ULT_S);
875 case ISD::SETEQ:
876 case ISD::SETOEQ:
877 return std::make_pair(Xtensa::BT, Xtensa::OEQ_S);
878 case ISD::SETNE:
879 return std::make_pair(Xtensa::BF, Xtensa::OEQ_S);
880 case ISD::SETLE:
881 case ISD::SETOLE:
882 return std::make_pair(Xtensa::BT, Xtensa::OLE_S);
883 case ISD::SETLT:
884 case ISD::SETOLT:
885 return std::make_pair(Xtensa::BT, Xtensa::OLT_S);
886 case ISD::SETGE:
887 return std::make_pair(Xtensa::BF, Xtensa::OLT_S);
888 case ISD::SETGT:
889 return std::make_pair(Xtensa::BF, Xtensa::OLE_S);
890 default:
891 llvm_unreachable("Invalid condition!");
892 }
893}
894
895SDValue XtensaTargetLowering::LowerSELECT_CC(SDValue Op,
896 SelectionDAG &DAG) const {
897 SDLoc DL(Op);
898 EVT Ty = Op.getValueType();
899 SDValue LHS = Op.getOperand(0);
900 SDValue RHS = Op.getOperand(1);
901 SDValue TrueValue = Op.getOperand(2);
902 SDValue FalseValue = Op.getOperand(3);
903 ISD::CondCode CC = cast<CondCodeSDNode>(Op->getOperand(4))->get();
904
905 if (LHS.getValueType() == MVT::i32) {
906 unsigned BrOpcode = getBranchOpcode(CC);
907 SDValue TargetCC = DAG.getConstant(BrOpcode, DL, MVT::i32);
908
909 SDValue Res = DAG.getNode(XtensaISD::SELECT_CC, DL, Ty, LHS, RHS, TrueValue,
910 FalseValue, TargetCC, Op->getFlags());
911 return Res;
912 }
913 assert(LHS.getValueType() == MVT::f32 &&
914 "We expect MVT::f32 type of the LHS Operand in SELECT_CC");
915 unsigned BrOpcode;
916 unsigned CmpOpCode;
917 std::tie(BrOpcode, CmpOpCode) = getFPBranchKind(CC);
918 SDValue TargetCC = DAG.getConstant(CmpOpCode, DL, MVT::i32);
919 SDValue TargetBC = DAG.getConstant(BrOpcode, DL, MVT::i32);
920 return DAG.getNode(XtensaISD::SELECT_CC_FP, DL, Ty,
921 {LHS, RHS, TrueValue, FalseValue, TargetCC, TargetBC},
922 Op->getFlags());
923}
924
925SDValue XtensaTargetLowering::LowerRETURNADDR(SDValue Op,
926 SelectionDAG &DAG) const {
927 // This nodes represent llvm.returnaddress on the DAG.
928 // It takes one operand, the index of the return address to return.
929 // An index of zero corresponds to the current function's return address.
930 // An index of one to the parent's return address, and so on.
931 // Depths > 0 not supported yet!
932 if (Op.getConstantOperandVal(0) != 0)
933 return SDValue();
934
936 MachineFrameInfo &MFI = MF.getFrameInfo();
937 EVT VT = Op.getValueType();
938 MFI.setReturnAddressIsTaken(true);
939
940 // Return RA, which contains the return address. Mark it an implicit
941 // live-in.
942 Register RA = MF.addLiveIn(Xtensa::A0, getRegClassFor(MVT::i32));
943 return DAG.getCopyFromReg(DAG.getEntryNode(), SDLoc(Op), RA, VT);
944}
945
946SDValue XtensaTargetLowering::LowerImmediate(SDValue Op,
947 SelectionDAG &DAG) const {
948 const ConstantSDNode *CN = cast<ConstantSDNode>(Op);
949 SDLoc DL(CN);
950 APInt APVal = CN->getAPIntValue();
951 int64_t Value = APVal.getSExtValue();
952 if (Op.getValueType() == MVT::i32) {
953 // Check if use node maybe lowered to the MOVI instruction
954 if (Value > -2048 && Value <= 2047)
955 return Op;
956 // Check if use node maybe lowered to the ADDMI instruction
957 SDNode &OpNode = *Op.getNode();
958 if ((OpNode.hasOneUse() && OpNode.user_begin()->getOpcode() == ISD::ADD) &&
959 isShiftedInt<8, 8>(Value))
960 return Op;
961 Type *Ty = Type::getInt32Ty(*DAG.getContext());
962 Constant *CV = ConstantInt::get(Ty, Value);
963 SDValue CP = DAG.getConstantPool(CV, MVT::i32);
964 SDValue Res =
965 DAG.getLoad(MVT::i32, DL, DAG.getEntryNode(), CP, MachinePointerInfo());
966 return Res;
967 }
968 return Op;
969}
970
971SDValue XtensaTargetLowering::LowerGlobalAddress(SDValue Op,
972 SelectionDAG &DAG) const {
973 const GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Op);
974 SDLoc DL(Op);
975 auto PtrVT = Op.getValueType();
976 const GlobalValue *GV = G->getGlobal();
977
978 SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, Align(4));
979 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
980 SDValue Res = DAG.getLoad(
981 PtrVT, DL, DAG.getEntryNode(), CPWrap,
983 return Res;
984}
985
986SDValue XtensaTargetLowering::LowerGlobalTLSAddress(SDValue Op,
987 SelectionDAG &DAG) const {
988 const GlobalAddressSDNode *G = cast<GlobalAddressSDNode>(Op);
989 SDLoc DL(Op);
990 EVT PtrVT = Op.getValueType();
991 const GlobalValue *GV = G->getGlobal();
992
993 if (DAG.getTarget().useEmulatedTLS())
994 return LowerToTLSEmulatedModel(G, DAG);
995
997
998 if (!Subtarget.hasTHREADPTR()) {
1000 DAG.getMachineFunction().getFunction(), "only emulated TLS supported",
1001 DL.getDebugLoc()));
1002 return DAG.getPOISON(Op->getValueType(0));
1003 }
1004
1005 if (model == TLSModel::LocalExec || model == TLSModel::InitialExec) {
1006 bool Priv = GV->isPrivateLinkage(GV->getLinkage());
1008 XtensaMachineFunctionInfo *XtensaFI =
1010 unsigned LabelId = XtensaFI->createCPLabelId();
1011
1012 // Create a constant pool entry for the callee address
1014 *DAG.getContext(), GV->getName().str().c_str(), LabelId, Priv,
1016
1017 // Get the address of the callee into a register
1018 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
1019 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
1020 SDValue Addr = DAG.getLoad(
1021 PtrVT, DL, DAG.getEntryNode(), CPWrap,
1023
1024 SDValue TPRegister = DAG.getRegister(Xtensa::THREADPTR, MVT::i32);
1026 DAG.getNode(XtensaISD::RUR, DL, MVT::i32, TPRegister);
1027
1028 return DAG.getNode(ISD::ADD, DL, PtrVT, ThreadPointer, Addr);
1029 }
1030
1033 "only local-exec and initial-exec TLS mode supported", DL.getDebugLoc()));
1034
1035 return DAG.getPOISON(Op->getValueType(0));
1036}
1037
1038SDValue XtensaTargetLowering::LowerBlockAddress(SDValue Op,
1039 SelectionDAG &DAG) const {
1040 BlockAddressSDNode *Node = cast<BlockAddressSDNode>(Op);
1041 SDLoc DL(Op);
1042 const BlockAddress *BA = Node->getBlockAddress();
1043 EVT PtrVT = Op.getValueType();
1046 unsigned LabelId = XtensaFI->createCPLabelId();
1047
1050 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
1051 SDValue CPWrap = getAddrPCRel(CPAddr, DAG);
1052 SDValue Res = DAG.getLoad(
1053 PtrVT, DL, DAG.getEntryNode(), CPWrap,
1055 return Res;
1056}
1057
1058SDValue XtensaTargetLowering::LowerBR_JT(SDValue Op, SelectionDAG &DAG) const {
1059 SDValue Chain = Op.getOperand(0);
1060 SDValue Table = Op.getOperand(1);
1061 SDValue Index = Op.getOperand(2);
1062 SDLoc DL(Op);
1063 JumpTableSDNode *JT = cast<JumpTableSDNode>(Table);
1065 const MachineJumpTableInfo *MJTI = MF.getJumpTableInfo();
1066 SDValue TargetJT = DAG.getTargetJumpTable(JT->getIndex(), MVT::i32);
1067 const DataLayout &TD = DAG.getDataLayout();
1068 EVT PtrVT = Table.getValueType();
1069 unsigned EntrySize = MJTI->getEntrySize(TD);
1070
1071 assert((MJTI->getEntrySize(TD) == 4) && "Unsupported jump-table entry size");
1072
1073 Index = DAG.getNode(
1074 ISD::SHL, DL, Index.getValueType(), Index,
1075 DAG.getConstant(Log2_32(EntrySize), DL, Index.getValueType()));
1076
1077 SDValue Addr = DAG.getNode(ISD::ADD, DL, Index.getValueType(), Index, Table);
1078 SDValue LD =
1079 DAG.getLoad(PtrVT, DL, Chain, Addr,
1081
1082 return DAG.getNode(XtensaISD::BR_JT, DL, MVT::Other, LD.getValue(1), LD,
1083 TargetJT);
1084}
1085
1086SDValue XtensaTargetLowering::LowerJumpTable(SDValue Op,
1087 SelectionDAG &DAG) const {
1088 JumpTableSDNode *JT = cast<JumpTableSDNode>(Op);
1089 EVT PtrVT = Op.getValueType();
1090 SDLoc DL(Op);
1091
1092 // Create a constant pool entry for the jumptable address
1095
1096 // Get the address of the jumptable into a register
1097 SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4));
1098
1099 SDValue Res = DAG.getLoad(
1100 PtrVT, DL, DAG.getEntryNode(), getAddrPCRel(CPAddr, DAG),
1102 return Res;
1103}
1104
1105SDValue XtensaTargetLowering::getAddrPCRel(SDValue Op,
1106 SelectionDAG &DAG) const {
1107 SDLoc DL(Op);
1108 EVT Ty = Op.getValueType();
1109 return DAG.getNode(XtensaISD::PCREL_WRAPPER, DL, Ty, Op);
1110}
1111
1112SDValue XtensaTargetLowering::LowerConstantPool(SDValue Op,
1113 SelectionDAG &DAG) const {
1114 EVT PtrVT = Op.getValueType();
1115 ConstantPoolSDNode *CP = cast<ConstantPoolSDNode>(Op);
1117
1118 if (!CP->isMachineConstantPoolEntry()) {
1119 Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(),
1120 CP->getOffset());
1121 } else {
1122 report_fatal_error("This constantpool type is not supported yet");
1123 }
1124
1125 return getAddrPCRel(Result, DAG);
1126}
1127
1128SDValue XtensaTargetLowering::LowerSTACKSAVE(SDValue Op,
1129 SelectionDAG &DAG) const {
1130 return DAG.getCopyFromReg(Op.getOperand(0), SDLoc(Op), Xtensa::SP,
1131 Op.getValueType());
1132}
1133
1134SDValue XtensaTargetLowering::LowerSTACKRESTORE(SDValue Op,
1135 SelectionDAG &DAG) const {
1136 SDValue Chain = Op.getOperand(0);
1137 SDValue NewSP = Op.getOperand(1);
1138
1139 if (Subtarget.isWindowedABI()) {
1140 return DAG.getNode(XtensaISD::MOVSP, SDLoc(Op), MVT::Other, Chain, NewSP);
1141 }
1142
1143 return DAG.getCopyToReg(Chain, SDLoc(Op), Xtensa::SP, NewSP);
1144}
1145
1146SDValue XtensaTargetLowering::LowerFRAMEADDR(SDValue Op,
1147 SelectionDAG &DAG) const {
1148 // This nodes represent llvm.frameaddress on the DAG.
1149 // It takes one operand, the index of the frame address to return.
1150 // An index of zero corresponds to the current function's frame address.
1151 // An index of one to the parent's frame address, and so on.
1152 // Depths > 0 not supported yet!
1153 if (Op.getConstantOperandVal(0) != 0)
1154 return SDValue();
1155
1157 MachineFrameInfo &MFI = MF.getFrameInfo();
1158 MFI.setFrameAddressIsTaken(true);
1159 EVT VT = Op.getValueType();
1160 SDLoc DL(Op);
1161
1162 MCRegister FrameRegister = Subtarget.getRegisterInfo()->getFrameRegister(MF);
1163 SDValue FrameAddr =
1164 DAG.getCopyFromReg(DAG.getEntryNode(), DL, FrameRegister, VT);
1165 return FrameAddr;
1166}
1167
1168SDValue XtensaTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
1169 SelectionDAG &DAG) const {
1170 SDValue Chain = Op.getOperand(0); // Legalize the chain.
1171 SDValue Size = Op.getOperand(1); // Legalize the size.
1172 EVT VT = Size->getValueType(0);
1173 SDLoc DL(Op);
1174
1175 // Round up Size to 32
1176 SDValue SizeTmp =
1177 DAG.getNode(ISD::ADD, DL, VT, Size, DAG.getConstant(31, DL, MVT::i32));
1178 SDValue SizeRoundUp = DAG.getNode(ISD::AND, DL, VT, SizeTmp,
1179 DAG.getSignedConstant(~31, DL, MVT::i32));
1180
1181 MCRegister SPReg = Xtensa::SP;
1182 SDValue SP = DAG.getCopyFromReg(Chain, DL, SPReg, VT);
1183 SDValue NewSP = DAG.getNode(ISD::SUB, DL, VT, SP, SizeRoundUp); // Value
1184 if (Subtarget.isWindowedABI()) {
1185 Chain = DAG.getNode(XtensaISD::MOVSP, SDLoc(Op), MVT::Other, SP.getValue(1),
1186 NewSP);
1187 } else {
1188 Chain = DAG.getCopyToReg(SP.getValue(1), DL, SPReg, NewSP); // Output chain
1189 }
1190
1191 SDValue NewVal = DAG.getCopyFromReg(Chain, DL, SPReg, MVT::i32);
1192 Chain = NewVal.getValue(1);
1193
1194 SDValue Ops[2] = {NewVal, Chain};
1195 return DAG.getMergeValues(Ops, DL);
1196}
1197
1198SDValue XtensaTargetLowering::LowerVASTART(SDValue Op,
1199 SelectionDAG &DAG) const {
1202 SDValue Chain = Op.getOperand(0);
1203 SDValue Addr = Op.getOperand(1);
1204 EVT PtrVT = Addr.getValueType();
1205 SDLoc DL(Op);
1206
1207 // Struct va_list_tag
1208 // int32 *va_stk - points to the arguments passed in memory
1209 // int32 *va_reg - points to the registers with arguments saved in memory
1210 // int32 va_ndx - offset from va_stk or va_reg pointers which points to the
1211 // next variable argument
1212
1213 SDValue VAIndex;
1214 SDValue StackOffsetFI =
1215 DAG.getFrameIndex(XtensaFI->getVarArgsOnStackFrameIndex(), PtrVT);
1216 unsigned ArgWords = XtensaFI->getVarArgsFirstGPR() - 2;
1217
1218 // If first variable argument passed in registers (maximum words in registers
1219 // is 6) then set va_ndx to the position of this argument in registers area
1220 // stored in memory (va_reg pointer). Otherwise va_ndx should point to the
1221 // position of the first variable argument on stack (va_stk pointer).
1222 if (ArgWords < 6) {
1223 VAIndex = DAG.getConstant(ArgWords * 4, DL, MVT::i32);
1224 } else {
1225 VAIndex = DAG.getConstant(32, DL, MVT::i32);
1226 }
1227
1229 DAG.getFrameIndex(XtensaFI->getVarArgsInRegsFrameIndex(), PtrVT);
1230 uint64_t FrameOffset = PtrVT.getStoreSize();
1231 const Value *SV = cast<SrcValueSDNode>(Op.getOperand(2))->getValue();
1232
1233 // Store pointer to arguments given on stack (va_stk)
1234 SDValue StackPtr = DAG.getNode(ISD::SUB, DL, PtrVT, StackOffsetFI,
1235 DAG.getConstant(32, DL, PtrVT));
1236
1237 SDValue StoreStackPtr =
1238 DAG.getStore(Chain, DL, StackPtr, Addr, MachinePointerInfo(SV));
1239
1240 uint64_t NextOffset = FrameOffset;
1241 SDValue NextPtr =
1242 DAG.getObjectPtrOffset(DL, Addr, TypeSize::getFixed(NextOffset));
1243
1244 // Store pointer to arguments given on registers (va_reg)
1245 SDValue StoreRegPtr = DAG.getStore(StoreStackPtr, DL, FrameIndex, NextPtr,
1246 MachinePointerInfo(SV, NextOffset));
1247 NextOffset += FrameOffset;
1248 NextPtr = DAG.getObjectPtrOffset(DL, Addr, TypeSize::getFixed(NextOffset));
1249
1250 // Store third word : position in bytes of the first VA argument (va_ndx)
1251 return DAG.getStore(StoreRegPtr, DL, VAIndex, NextPtr,
1252 MachinePointerInfo(SV, NextOffset));
1253}
1254
1255SDValue XtensaTargetLowering::LowerVACOPY(SDValue Op, SelectionDAG &DAG) const {
1256 // Size of the va_list_tag structure
1257 constexpr unsigned VAListSize = 3 * 4;
1258 SDValue Chain = Op.getOperand(0);
1259 SDValue DstPtr = Op.getOperand(1);
1260 SDValue SrcPtr = Op.getOperand(2);
1261 const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
1262 const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
1263 SDLoc DL(Op);
1264
1265 return DAG.getMemcpy(Chain, DL, DstPtr, SrcPtr,
1266 DAG.getConstant(VAListSize, SDLoc(Op), MVT::i32),
1267 Align(4), /*isVolatile*/ false, /*AlwaysInline*/ true,
1268 /*CI=*/nullptr, std::nullopt, MachinePointerInfo(DstSV),
1269 MachinePointerInfo(SrcSV));
1270}
1271
1272SDValue XtensaTargetLowering::LowerVAARG(SDValue Op, SelectionDAG &DAG) const {
1273 SDNode *Node = Op.getNode();
1274 EVT VT = Node->getValueType(0);
1275 Type *Ty = VT.getTypeForEVT(*DAG.getContext());
1276 EVT PtrVT = Op.getValueType();
1277 SDValue InChain = Node->getOperand(0);
1278 SDValue VAListPtr = Node->getOperand(1);
1279 const Value *SV = cast<SrcValueSDNode>(Node->getOperand(2))->getValue();
1280 SDLoc DL(Node);
1281 auto &TD = DAG.getDataLayout();
1282 Align ArgAlignment = TD.getABITypeAlign(Ty);
1283 unsigned ArgAlignInBytes = ArgAlignment.value();
1284 unsigned ArgSizeInBytes = TD.getTypeAllocSize(Ty);
1285 unsigned VASizeInBytes = llvm::alignTo(ArgSizeInBytes, 4);
1286
1287 // va_stk
1288 SDValue VAStack =
1289 DAG.getLoad(MVT::i32, DL, InChain, VAListPtr, MachinePointerInfo());
1290 InChain = VAStack.getValue(1);
1291
1292 // va_reg
1293 SDValue VARegPtr =
1294 DAG.getObjectPtrOffset(DL, VAListPtr, TypeSize::getFixed(4));
1295 SDValue VAReg =
1296 DAG.getLoad(MVT::i32, DL, InChain, VARegPtr, MachinePointerInfo());
1297 InChain = VAReg.getValue(1);
1298
1299 // va_ndx
1300 SDValue VarArgIndexPtr =
1301 DAG.getObjectPtrOffset(DL, VARegPtr, TypeSize::getFixed(4));
1302 SDValue VAIndex =
1303 DAG.getLoad(MVT::i32, DL, InChain, VarArgIndexPtr, MachinePointerInfo());
1304 InChain = VAIndex.getValue(1);
1305
1306 SDValue OrigIndex = VAIndex;
1307
1308 if (ArgAlignInBytes > 4) {
1309 OrigIndex = DAG.getNode(ISD::ADD, DL, PtrVT, OrigIndex,
1310 DAG.getConstant(ArgAlignInBytes - 1, DL, MVT::i32));
1311 OrigIndex =
1312 DAG.getNode(ISD::AND, DL, PtrVT, OrigIndex,
1313 DAG.getSignedConstant(-ArgAlignInBytes, DL, MVT::i32));
1314 }
1315
1316 VAIndex = DAG.getNode(ISD::ADD, DL, PtrVT, OrigIndex,
1317 DAG.getConstant(VASizeInBytes, DL, MVT::i32));
1318
1319 SDValue CC = DAG.getSetCC(DL, MVT::i32, OrigIndex,
1320 DAG.getConstant(6 * 4, DL, MVT::i32), ISD::SETLE);
1321
1322 SDValue StkIndex =
1323 DAG.getNode(ISD::ADD, DL, PtrVT, VAIndex,
1324 DAG.getConstant(32 + VASizeInBytes, DL, MVT::i32));
1325
1326 CC = DAG.getSetCC(DL, MVT::i32, VAIndex, DAG.getConstant(6 * 4, DL, MVT::i32),
1327 ISD::SETLE);
1328
1329 SDValue Array = DAG.getNode(ISD::SELECT, DL, MVT::i32, CC, VAReg, VAStack);
1330
1331 VAIndex = DAG.getNode(ISD::SELECT, DL, MVT::i32, CC, VAIndex, StkIndex);
1332
1333 CC = DAG.getSetCC(DL, MVT::i32, VAIndex, DAG.getConstant(6 * 4, DL, MVT::i32),
1334 ISD::SETLE);
1335
1336 SDValue VAIndexStore = DAG.getStore(InChain, DL, VAIndex, VarArgIndexPtr,
1337 MachinePointerInfo(SV));
1338 InChain = VAIndexStore;
1339
1340 SDValue Addr = DAG.getNode(ISD::SUB, DL, PtrVT, VAIndex,
1341 DAG.getConstant(VASizeInBytes, DL, MVT::i32));
1342
1343 Addr = DAG.getNode(ISD::ADD, DL, PtrVT, Array, Addr);
1344
1345 return DAG.getLoad(VT, DL, InChain, Addr, MachinePointerInfo());
1346}
1347
1348SDValue XtensaTargetLowering::LowerShiftLeftParts(SDValue Op,
1349 SelectionDAG &DAG) const {
1350 SDLoc DL(Op);
1351 MVT VT = MVT::i32;
1352 SDValue Lo = Op.getOperand(0), Hi = Op.getOperand(1);
1353 SDValue Shamt = Op.getOperand(2);
1354
1355 // if Shamt - register size < 0: // Shamt < register size
1356 // Lo = Lo << Shamt
1357 // Hi = (Hi << Shamt) | (Lo >>u (register size - Shamt))
1358 // else:
1359 // Lo = 0
1360 // Hi = Lo << (Shamt - register size)
1361
1362 SDValue MinusRegisterSize = DAG.getSignedConstant(-32, DL, VT);
1363 SDValue ShamtMinusRegisterSize =
1364 DAG.getNode(ISD::ADD, DL, VT, Shamt, MinusRegisterSize);
1365
1366 SDValue LoTrue = DAG.getNode(ISD::SHL, DL, VT, Lo, Shamt);
1367 SDValue HiTrue = DAG.getNode(XtensaISD::SRCL, DL, VT, Hi, Lo, Shamt);
1368 SDValue Zero = DAG.getConstant(0, DL, VT);
1369 SDValue HiFalse = DAG.getNode(ISD::SHL, DL, VT, Lo, ShamtMinusRegisterSize);
1370
1371 SDValue Cond = DAG.getSetCC(DL, VT, ShamtMinusRegisterSize, Zero, ISD::SETLT);
1372 Lo = DAG.getNode(ISD::SELECT, DL, VT, Cond, LoTrue, Zero);
1373 Hi = DAG.getNode(ISD::SELECT, DL, VT, Cond, HiTrue, HiFalse);
1374
1375 return DAG.getMergeValues({Lo, Hi}, DL);
1376}
1377
1378SDValue XtensaTargetLowering::LowerShiftRightParts(SDValue Op,
1379 SelectionDAG &DAG,
1380 bool IsSRA) const {
1381 SDLoc DL(Op);
1382 SDValue Lo = Op.getOperand(0), Hi = Op.getOperand(1);
1383 SDValue Shamt = Op.getOperand(2);
1384 MVT VT = MVT::i32;
1385
1386 // SRA expansion:
1387 // if Shamt - register size < 0: // Shamt < register size
1388 // Lo = (Lo >>u Shamt) | (Hi << u (register size - Shamt))
1389 // Hi = Hi >>s Shamt
1390 // else:
1391 // Lo = Hi >>s (Shamt - register size);
1392 // Hi = Hi >>s (register size - 1)
1393 //
1394 // SRL expansion:
1395 // if Shamt - register size < 0: // Shamt < register size
1396 // Lo = (Lo >>u Shamt) | (Hi << u (register size - Shamt))
1397 // Hi = Hi >>u Shamt
1398 // else:
1399 // Lo = Hi >>u (Shamt - register size);
1400 // Hi = 0;
1401
1402 unsigned ShiftRightOp = IsSRA ? ISD::SRA : ISD::SRL;
1403 SDValue MinusRegisterSize = DAG.getSignedConstant(-32, DL, VT);
1404 SDValue RegisterSizeMinus1 = DAG.getConstant(32 - 1, DL, VT);
1405 SDValue ShamtMinusRegisterSize =
1406 DAG.getNode(ISD::ADD, DL, VT, Shamt, MinusRegisterSize);
1407
1408 SDValue LoTrue = DAG.getNode(XtensaISD::SRCR, DL, VT, Hi, Lo, Shamt);
1409 SDValue HiTrue = DAG.getNode(ShiftRightOp, DL, VT, Hi, Shamt);
1410 SDValue Zero = DAG.getConstant(0, DL, VT);
1411 SDValue LoFalse =
1412 DAG.getNode(ShiftRightOp, DL, VT, Hi, ShamtMinusRegisterSize);
1413 SDValue HiFalse;
1414
1415 if (IsSRA) {
1416 HiFalse = DAG.getNode(ShiftRightOp, DL, VT, Hi, RegisterSizeMinus1);
1417 } else {
1418 HiFalse = Zero;
1419 }
1420
1421 SDValue Cond = DAG.getSetCC(DL, VT, ShamtMinusRegisterSize, Zero, ISD::SETLT);
1422 Lo = DAG.getNode(ISD::SELECT, DL, VT, Cond, LoTrue, LoFalse);
1423 Hi = DAG.getNode(ISD::SELECT, DL, VT, Cond, HiTrue, HiFalse);
1424
1425 return DAG.getMergeValues({Lo, Hi}, DL);
1426}
1427
1428SDValue XtensaTargetLowering::LowerCTPOP(SDValue Op, SelectionDAG &DAG) const {
1429 auto &TLI = DAG.getTargetLoweringInfo();
1430 return TLI.expandCTPOP(Op.getNode(), DAG);
1431}
1432
1434 SDValue C) const {
1435 APInt Imm;
1436 unsigned EltSizeInBits;
1437
1438 if (ISD::isConstantSplatVector(C.getNode(), Imm)) {
1439 EltSizeInBits = VT.getScalarSizeInBits();
1440 } else if (VT.isScalarInteger()) {
1441 EltSizeInBits = VT.getSizeInBits();
1442 if (auto *ConstNode = dyn_cast<ConstantSDNode>(C.getNode()))
1443 Imm = ConstNode->getAPIntValue();
1444 else
1445 return false;
1446 } else {
1447 return false;
1448 }
1449
1450 // Omit if data size exceeds.
1451 if (EltSizeInBits > 32)
1452 return false;
1453
1454 // Convert MULT to LSL.
1455 if (Imm.isPowerOf2() && Imm.isIntN(5))
1456 return true;
1457
1458 return false;
1459}
1460
1462 SelectionDAG &DAG) const {
1463 switch (Op.getOpcode()) {
1464 case ISD::BR_JT:
1465 return LowerBR_JT(Op, DAG);
1466 case ISD::Constant:
1467 return LowerImmediate(Op, DAG);
1468 case ISD::RETURNADDR:
1469 return LowerRETURNADDR(Op, DAG);
1470 case ISD::GlobalAddress:
1471 return LowerGlobalAddress(Op, DAG);
1473 return LowerGlobalTLSAddress(Op, DAG);
1474 case ISD::BlockAddress:
1475 return LowerBlockAddress(Op, DAG);
1476 case ISD::JumpTable:
1477 return LowerJumpTable(Op, DAG);
1478 case ISD::CTPOP:
1479 return LowerCTPOP(Op, DAG);
1480 case ISD::ConstantPool:
1481 return LowerConstantPool(Op, DAG);
1482 case ISD::SELECT_CC:
1483 return LowerSELECT_CC(Op, DAG);
1484 case ISD::STACKSAVE:
1485 return LowerSTACKSAVE(Op, DAG);
1486 case ISD::STACKRESTORE:
1487 return LowerSTACKRESTORE(Op, DAG);
1488 case ISD::FRAMEADDR:
1489 return LowerFRAMEADDR(Op, DAG);
1491 return LowerDYNAMIC_STACKALLOC(Op, DAG);
1492 case ISD::VASTART:
1493 return LowerVASTART(Op, DAG);
1494 case ISD::VAARG:
1495 return LowerVAARG(Op, DAG);
1496 case ISD::VACOPY:
1497 return LowerVACOPY(Op, DAG);
1498 case ISD::SHL_PARTS:
1499 return LowerShiftLeftParts(Op, DAG);
1500 case ISD::SRA_PARTS:
1501 return LowerShiftRightParts(Op, DAG, true);
1502 case ISD::SRL_PARTS:
1503 return LowerShiftRightParts(Op, DAG, false);
1504 default:
1505 report_fatal_error("Unexpected node to lower");
1506 }
1507}
1508
1509const char *XtensaTargetLowering::getTargetNodeName(unsigned Opcode) const {
1510 switch (Opcode) {
1511 case XtensaISD::BR_JT:
1512 return "XtensaISD::BR_JT";
1513 case XtensaISD::CALL:
1514 return "XtensaISD::CALL";
1515 case XtensaISD::CALLW8:
1516 return "XtensaISD::CALLW8";
1517 case XtensaISD::EXTUI:
1518 return "XtensaISD::EXTUI";
1519 case XtensaISD::MOVSP:
1520 return "XtensaISD::MOVSP";
1522 return "XtensaISD::PCREL_WRAPPER";
1523 case XtensaISD::RET:
1524 return "XtensaISD::RET";
1525 case XtensaISD::RETW:
1526 return "XtensaISD::RETW";
1527 case XtensaISD::RUR:
1528 return "XtensaISD::RUR";
1530 return "XtensaISD::SELECT_CC";
1532 return "XtensaISD::SELECT_CC_FP";
1533 case XtensaISD::SRCL:
1534 return "XtensaISD::SRCL";
1535 case XtensaISD::SRCR:
1536 return "XtensaISD::SRCR";
1537 case XtensaISD::CMPUO:
1538 return "XtensaISD::CMPUO";
1539 case XtensaISD::CMPUEQ:
1540 return "XtensaISD::CMPUEQ";
1541 case XtensaISD::CMPULE:
1542 return "XtensaISD::CMPULE";
1543 case XtensaISD::CMPULT:
1544 return "XtensaISD::CMPULT";
1545 case XtensaISD::CMPOEQ:
1546 return "XtensaISD::CMPOEQ";
1547 case XtensaISD::CMPOLE:
1548 return "XtensaISD::CMPOLE";
1549 case XtensaISD::CMPOLT:
1550 return "XtensaISD::CMPOLT";
1551 case XtensaISD::MADD:
1552 return "XtensaISD::MADD";
1553 case XtensaISD::MSUB:
1554 return "XtensaISD::MSUB";
1555 case XtensaISD::MOVS:
1556 return "XtensaISD::MOVS";
1557 }
1558 return nullptr;
1559}
1560
1564}
1565
1566//===----------------------------------------------------------------------===//
1567// Custom insertion
1568//===----------------------------------------------------------------------===//
1569
1571XtensaTargetLowering::emitSelectCC(MachineInstr &MI,
1572 MachineBasicBlock *MBB) const {
1573 const TargetInstrInfo &TII = *Subtarget.getInstrInfo();
1574 DebugLoc DL = MI.getDebugLoc();
1575
1576 MachineOperand &LHS = MI.getOperand(1);
1577 MachineOperand &RHS = MI.getOperand(2);
1578 MachineOperand &TrueValue = MI.getOperand(3);
1579 MachineOperand &FalseValue = MI.getOperand(4);
1580
1581 // To "insert" a SELECT_CC instruction, we actually have to insert
1582 // CopyMBB and SinkMBB blocks and add branch to MBB. We build phi
1583 // operation in SinkMBB like phi (TrueVakue,FalseValue), where TrueValue
1584 // is passed from MMB and FalseValue is passed from CopyMBB.
1585 // MBB
1586 // | \
1587 // | CopyMBB
1588 // | /
1589 // SinkMBB
1590 // The incoming instruction knows the
1591 // destination vreg to set, the condition code register to branch on, the
1592 // true/false values to select between, and a branch opcode to use.
1593 const BasicBlock *LLVM_BB = MBB->getBasicBlock();
1595
1597 MachineBasicBlock *CopyMBB = F->CreateMachineBasicBlock(LLVM_BB);
1598 MachineBasicBlock *SinkMBB = F->CreateMachineBasicBlock(LLVM_BB);
1599
1600 F->insert(It, CopyMBB);
1601 F->insert(It, SinkMBB);
1602
1603 // Transfer the remainder of MBB and its successor edges to SinkMBB.
1604 SinkMBB->splice(SinkMBB->begin(), MBB,
1605 std::next(MachineBasicBlock::iterator(MI)), MBB->end());
1607
1608 MBB->addSuccessor(CopyMBB);
1609 MBB->addSuccessor(SinkMBB);
1610
1611 if (MI.getOpcode() == Xtensa::SELECT_CC_FP_FP ||
1612 MI.getOpcode() == Xtensa::SELECT_CC_FP_INT) {
1613 unsigned CmpKind = MI.getOperand(5).getImm();
1614 unsigned BrKind = MI.getOperand(6).getImm();
1615 MCPhysReg BReg = Xtensa::B0;
1616
1617 BuildMI(MBB, DL, TII.get(CmpKind), BReg)
1618 .addReg(LHS.getReg())
1619 .addReg(RHS.getReg());
1620 BuildMI(MBB, DL, TII.get(BrKind))
1621 .addReg(BReg, RegState::Kill)
1622 .addMBB(SinkMBB);
1623 } else {
1624 unsigned BrKind = MI.getOperand(5).getImm();
1625 BuildMI(MBB, DL, TII.get(BrKind))
1626 .addReg(LHS.getReg())
1627 .addReg(RHS.getReg())
1628 .addMBB(SinkMBB);
1629 }
1630
1631 CopyMBB->addSuccessor(SinkMBB);
1632
1633 // SinkMBB:
1634 // %Result = phi [ %FalseValue, CopyMBB ], [ %TrueValue, MBB ]
1635 // ...
1636
1637 BuildMI(*SinkMBB, SinkMBB->begin(), DL, TII.get(Xtensa::PHI),
1638 MI.getOperand(0).getReg())
1639 .addReg(FalseValue.getReg())
1640 .addMBB(CopyMBB)
1641 .addReg(TrueValue.getReg())
1642 .addMBB(MBB);
1643
1644 MI.eraseFromParent(); // The pseudo instruction is gone now.
1645 return SinkMBB;
1646}
1647
1650 DebugLoc DL = MI.getDebugLoc();
1651 const XtensaInstrInfo &TII = *Subtarget.getInstrInfo();
1652
1653 switch (MI.getOpcode()) {
1654 case Xtensa::BRCC_FP: {
1655 MachineOperand &Cond = MI.getOperand(0);
1656 MachineOperand &LHS = MI.getOperand(1);
1657 MachineOperand &RHS = MI.getOperand(2);
1658 MachineBasicBlock *TargetBB = MI.getOperand(3).getMBB();
1659 unsigned BrKind = 0;
1660 unsigned CmpKind = 0;
1661 ISD::CondCode CondCode = (ISD::CondCode)Cond.getImm();
1662 MCPhysReg BReg = Xtensa::B0;
1663
1664 std::tie(BrKind, CmpKind) = getFPBranchKind(CondCode);
1665 BuildMI(*MBB, MI, DL, TII.get(CmpKind), BReg)
1666 .addReg(LHS.getReg())
1667 .addReg(RHS.getReg());
1668 BuildMI(*MBB, MI, DL, TII.get(BrKind))
1669 .addReg(BReg, RegState::Kill)
1670 .addMBB(TargetBB);
1671
1672 MI.eraseFromParent();
1673 return MBB;
1674 }
1675 case Xtensa::SELECT_CC_FP_FP:
1676 case Xtensa::SELECT_CC_FP_INT:
1677 case Xtensa::SELECT_CC_INT_FP:
1678 case Xtensa::SELECT:
1679 return emitSelectCC(MI, MBB);
1680 case Xtensa::S8I:
1681 case Xtensa::S16I:
1682 case Xtensa::S32I:
1683 case Xtensa::S32I_N:
1684 case Xtensa::SSI:
1685 case Xtensa::SSIP:
1686 case Xtensa::SSX:
1687 case Xtensa::SSXP:
1688 case Xtensa::L8UI:
1689 case Xtensa::L16SI:
1690 case Xtensa::L16UI:
1691 case Xtensa::L32I:
1692 case Xtensa::L32I_N:
1693 case Xtensa::LSI:
1694 case Xtensa::LSIP:
1695 case Xtensa::LSX:
1696 case Xtensa::LSXP: {
1697 // Insert memory wait instruction "memw" before volatile load/store as it is
1698 // implemented in gcc. If memoperands is empty then assume that it aslo
1699 // maybe volatile load/store and insert "memw".
1700 if (MI.memoperands_empty() || (*MI.memoperands_begin())->isVolatile()) {
1701 BuildMI(*MBB, MI, DL, TII.get(Xtensa::MEMW));
1702 }
1703 return MBB;
1704 }
1705 case Xtensa::MOVSP_P: {
1706 MachineOperand &NewSP = MI.getOperand(0);
1707
1708 BuildMI(*MBB, MI, DL, TII.get(Xtensa::MOVSP), Xtensa::SP)
1709 .addReg(NewSP.getReg());
1710 MI.eraseFromParent();
1711
1712 return MBB;
1713 }
1714 case Xtensa::ATOMIC_CMP_SWAP_32_P: {
1715 MachineOperand &R = MI.getOperand(0);
1716 MachineOperand &Addr = MI.getOperand(1);
1717 MachineOperand &Cmp = MI.getOperand(2);
1718 MachineOperand &Swap = MI.getOperand(3);
1719
1720 BuildMI(*MBB, MI, DL, TII.get(Xtensa::WSR), Xtensa::SCOMPARE1)
1721 .addReg(Cmp.getReg());
1722
1723 BuildMI(*MBB, MI, DL, TII.get(Xtensa::S32C1I), R.getReg())
1724 .addReg(Swap.getReg())
1725 .addReg(Addr.getReg())
1726 .addImm(0);
1727
1728 MI.eraseFromParent();
1729 return MBB;
1730 }
1731 default:
1732 llvm_unreachable("Unexpected instr type to insert");
1733 }
1734}
unsigned RegSize
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
return RetTy
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
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
Register const TargetRegisterInfo * TRI
static constexpr MCPhysReg SPReg
const SmallVectorImpl< MachineOperand > & Cond
SI optimize exec mask operations pre RA
static const char * name
Definition: SMEABIPass.cpp:52
static const MCPhysReg IntRegs[32]
static unsigned toCallerWindow(unsigned Reg)
Value * RHS
Value * LHS
static bool isLongCall(const char *str)
static unsigned toCallerWindow(unsigned Reg)
static std::pair< unsigned, unsigned > getFPBranchKind(ISD::CondCode Cond)
static unsigned getBranchOpcode(ISD::CondCode Cond)
static bool CC_Xtensa_Custom(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
Class for arbitrary precision integers.
Definition: APInt.h:78
int64_t getSExtValue() const
Get sign extended value.
Definition: APInt.h:1562
an instruction that atomically reads a memory location, combines it with another value,...
Definition: Instructions.h:709
LLVM Basic Block Representation.
Definition: BasicBlock.h:62
The address of a basic block.
Definition: Constants.h:899
CCState - This class holds information needed while lowering arguments and return values.
unsigned getFirstUnallocated(ArrayRef< MCPhysReg > Regs) const
getFirstUnallocated - Return the index of the first unallocated register in the set,...
LLVM_ABI 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.
LLVM_ABI 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 ...
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI 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 getReg(unsigned ValNo, MVT ValVT, MCRegister Reg, MVT LocVT, LocInfo HTP, bool IsCustom=false)
static CCValAssign getMem(unsigned ValNo, MVT ValVT, int64_t Offset, 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:43
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
LLVM_ABI Align getABITypeAlign(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
Definition: DataLayout.cpp:842
TypeSize getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
Definition: DataLayout.h:504
A debug info location.
Definition: DebugLoc.h:124
Diagnostic information for unsupported feature in backend.
LinkageTypes getLinkage() const
Definition: GlobalValue.h:548
static bool isPrivateLinkage(LinkageTypes Linkage)
Definition: GlobalValue.h:408
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
LLVM_ABI void diagnose(const DiagnosticInfo &DI)
Report a message to the currently installed diagnostic handler.
Wrapper class representing physical registers. Should be passed by value.
Definition: MCRegister.h:33
Machine Value Type.
static auto integer_valuetypes()
TypeSize getSizeInBits() const
Returns the size of the specified MVT in bits.
TypeSize getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
LLVM_ABI 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.
LLVM_ABI 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.
LLVM_ABI int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)
Create a new object at a fixed location on the stack.
void setFrameAddressIsTaken(bool T)
void setReturnAddressIsTaken(bool s)
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
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 & addImm(int64_t Val) const
Add a new immediate operand.
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:72
LLVM_ABI 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.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI Register createVirtualRegister(const TargetRegisterClass *RegClass, StringRef Name="")
createVirtualRegister - Create and return a new virtual register in the function with the specified r...
void addLiveIn(MCRegister Reg, Register vreg=Register())
addLiveIn - Add the specified register as a live-in.
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.
user_iterator user_begin() const
Provide iteration support to walk over all users 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:229
SDValue getCopyToReg(SDValue Chain, const SDLoc &dl, Register Reg, SDValue N)
Definition: SelectionDAG.h:813
LLVM_ABI SDValue getMergeValues(ArrayRef< SDValue > Ops, const SDLoc &dl)
Create a MERGE_VALUES node from the given operands.
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align=std::nullopt, int Offs=0, bool isT=false, unsigned TargetFlags=0)
SDValue getSetCC(const SDLoc &DL, EVT VT, SDValue LHS, SDValue RHS, ISD::CondCode Cond, SDValue Chain=SDValue(), bool IsSignaling=false)
Helper function to make it easier to build SetCC's if you just have an ISD::CondCode instead of an SD...
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
LLVM_ABI 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,...
LLVM_ABI 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(), BatchAAResults *BatchAA=nullptr)
const TargetLowering & getTargetLoweringInfo() const
Definition: SelectionDAG.h:504
SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags=0)
Definition: SelectionDAG.h:768
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).
SDValue getCopyFromReg(SDValue Chain, const SDLoc &dl, Register Reg, EVT VT)
Definition: SelectionDAG.h:839
const DataLayout & getDataLayout() const
Definition: SelectionDAG.h:498
LLVM_ABI SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
LLVM_ABI 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.
LLVM_ABI SDValue getSignedConstant(int64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
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 ...
const TargetMachine & getTarget() const
Definition: SelectionDAG.h:499
LLVM_ABI SDValue getIntPtrConstant(uint64_t Val, const SDLoc &DL, bool isTarget=false)
LLVM_ABI SDValue getValueType(EVT)
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:493
SDValue getPOISON(EVT VT)
Return a POISON node. POISON does not have a useful SDLoc.
LLVM_ABI SDValue getFrameIndex(int FI, EVT VT, bool isTarget=false)
LLVM_ABI SDValue getRegisterMask(const uint32_t *RegMask)
SDValue getObjectPtrOffset(const SDLoc &SL, SDValue Ptr, TypeSize Offset)
Create an add instruction with appropriate flags when used for addressing some offset of an object.
LLVMContext * getContext() const
Definition: SelectionDAG.h:511
LLVM_ABI 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:777
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
Definition: SelectionDAG.h:581
bool empty() const
Definition: SmallVector.h:82
size_t size() const
Definition: SmallVector.h:79
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
void push_back(const T &Elt)
Definition: SmallVector.h:414
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:233
constexpr size_t size() const
size - Get the string size.
Definition: StringRef.h:154
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...
virtual const TargetRegisterClass * getRegClassFor(MVT VT, bool isDivergent=false) const
Return the register class that should be used for the specified value type.
const TargetMachine & getTargetMachine() const
virtual MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const
Certain combinations of ABIs, Targets and features require that types are legal for some operations a...
void setMaxAtomicSizeInBitsSupported(unsigned SizeInBits)
Set the maximum atomic operation size supported by the backend.
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.
bool isTypeLegal(EVT VT) const
Return true if the target has native support 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 setTruncStoreAction(MVT ValVT, MVT MemVT, LegalizeAction Action)
Indicate that the specified truncating store does not work with the specified type and indicate what ...
void setMinCmpXchgSizeInBits(unsigned SizeInBits)
Sets the minimum cmpxchg or ll/sc size supported by the backend.
void setStackPointerRegisterToSaveRestore(Register R)
If set to a physical register, this specifies the register that llvm.savestack/llvm....
AtomicExpansionKind
Enum that specifies what an atomic load/AtomicRMWInst is expanded to, if at all.
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...
virtual ConstraintType getConstraintType(StringRef Constraint) const
Given a constraint, return the type of constraint it is for this target.
virtual SDValue LowerToTLSEmulatedModel(const GlobalAddressSDNode *GA, SelectionDAG &DAG) const
Lower TLS global address SDNode for target independent emulated TLS model.
SDValue expandCTPOP(SDNode *N, SelectionDAG &DAG) const
Expand CTPOP nodes.
bool isPositionIndependent() const
virtual ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &info, const char *constraint) const
Examine constraint string and operand type and determine a weight value.
virtual std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const
Given a physical register constraint (e.g.
virtual void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const
Lower the specified operand into the Ops vector.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:83
TLSModel::Model getTLSModel(const GlobalValue *GV) const
Returns the TLS model which should be used for the given global variable.
bool useEmulatedTLS() const
Returns true if this target uses emulated TLS.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
static constexpr TypeSize getFixed(ScalarTy ExactSize)
Definition: TypeSize.h:346
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:240
LLVM Value Representation.
Definition: Value.h:75
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:256
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:322
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.
Register getFrameRegister(const MachineFunction &MF) const override
const XtensaInstrInfo * getInstrInfo() const override
bool isWindowedABI() const
bool hasTHREADPTR() const
bool hasForcedAtomics() const
const XtensaRegisterInfo * getRegisterInfo() const override
bool hasSingleFloat() const
bool hasMul32High() const
const TargetFrameLowering * getFrameLowering() const override
bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF, bool isVarArg, const SmallVectorImpl< ISD::OutputArg > &Outs, LLVMContext &Context, const Type *RetTy) const override
This hook should be implemented to check whether the return values described by the Outs array can fi...
TargetLowering::ConstraintWeight getSingleConstraintMatchWeight(AsmOperandInfo &Info, const char *Constraint) const override
Examine constraint string and operand type and determine a weight value.
const char * getTargetNodeName(unsigned Opcode) const override
This method returns the name of a target specific DAG node.
TargetLowering::ConstraintType getConstraintType(StringRef Constraint) const override
Given a constraint, return the type of constraint it is for this target.
bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override
Return true if folding a constant offset with the given GlobalAddress is legal.
bool decomposeMulByConstant(LLVMContext &Context, EVT VT, SDValue C) const override
Return true if it is profitable to transform an integer multiplication-by-constant into simpler opera...
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.
bool isFPImmLegal(const APFloat &Imm, EVT VT, bool ForCodeSize) const override
Returns true if the target can instruction select the specified FP immediate natively.
XtensaTargetLowering(const TargetMachine &TM, const XtensaSubtarget &STI)
AtomicExpansionKind shouldExpandAtomicRMWInIR(AtomicRMWInst *) const override
Returns how the IR-level AtomicExpand pass should expand the given AtomicRMW, if at all.
void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint, std::vector< SDValue > &Ops, SelectionDAG &DAG) const override
Lower the specified operand into the Ops vector.
std::pair< unsigned, const TargetRegisterClass * > getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, StringRef Constraint, MVT VT) const override
Given a physical register constraint (e.g.
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,...
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the register type for a given MVT.
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:134
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
@ SETCC
SetCC operator - This evaluates to a true value iff the condition is true.
Definition: ISDOpcodes.h:801
@ STACKRESTORE
STACKRESTORE has two operands, an input chain and a pointer to restore to it returns an output chain.
Definition: ISDOpcodes.h:1236
@ STACKSAVE
STACKSAVE - STACKSAVE has one operand, an input chain.
Definition: ISDOpcodes.h:1232
@ CTLZ_ZERO_UNDEF
Definition: ISDOpcodes.h:774
@ SMUL_LOHI
SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing a signed/unsigned value of type i[2...
Definition: ISDOpcodes.h:270
@ BSWAP
Byte Swap and Counting operators.
Definition: ISDOpcodes.h:765
@ VAEND
VAEND, VASTART - VAEND and VASTART have three operands: an input chain, pointer, and a SRCVALUE.
Definition: ISDOpcodes.h:1265
@ ConstantFP
Definition: ISDOpcodes.h:87
@ ADD
Simple integer binary arithmetic operators.
Definition: ISDOpcodes.h:259
@ FMA
FMA - Perform a * b + c with no intermediate rounding step.
Definition: ISDOpcodes.h:511
@ GlobalAddress
Definition: ISDOpcodes.h:88
@ SINT_TO_FP
[SU]INT_TO_FP - These operators convert integers (whose interpreted sign depends on the first letter)...
Definition: ISDOpcodes.h:862
@ FADD
Simple binary floating point operators.
Definition: ISDOpcodes.h:410
@ SDIVREM
SDIVREM/UDIVREM - Divide two integers and produce both a quotient and remainder result.
Definition: ISDOpcodes.h:275
@ BITCAST
BITCAST - This operator converts between integer, vector and FP values, as if the value was stored to...
Definition: ISDOpcodes.h:975
@ GlobalTLSAddress
Definition: ISDOpcodes.h:89
@ FrameIndex
Definition: ISDOpcodes.h:90
@ CTTZ_ZERO_UNDEF
Bit counting operators with an undefined result for zero inputs.
Definition: ISDOpcodes.h:773
@ FNEG
Perform various unary floating-point operations inspired by libm.
Definition: ISDOpcodes.h:1002
@ BR_CC
BR_CC - Conditional branch.
Definition: ISDOpcodes.h:1187
@ BR_JT
BR_JT - Jumptable branch.
Definition: ISDOpcodes.h:1166
@ SELECT
Select(COND, TRUEVAL, FALSEVAL).
Definition: ISDOpcodes.h:778
@ VACOPY
VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, a source pointer,...
Definition: ISDOpcodes.h:1261
@ MULHU
MULHU/MULHS - Multiply high - Multiply two integers of type iN, producing an unsigned/signed value of...
Definition: ISDOpcodes.h:695
@ SHL
Shift and rotation operations.
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:793
@ DYNAMIC_STACKALLOC
DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned to a specified boundary.
Definition: ISDOpcodes.h:1151
@ ConstantPool
Definition: ISDOpcodes.h:92
@ SIGN_EXTEND_INREG
SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to sign extend a small value in ...
Definition: ISDOpcodes.h:870
@ SMIN
[US]{MIN/MAX} - Binary minimum or maximum of signed or unsigned integers.
Definition: ISDOpcodes.h:718
@ FRAMEADDR
FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and llvm.returnaddress on the DAG.
Definition: ISDOpcodes.h:110
@ FP_TO_SINT
FP_TO_[US]INT - Convert a floating point value to a signed or unsigned integer.
Definition: ISDOpcodes.h:908
@ AND
Bitwise operators - logical and, logical or, logical xor.
Definition: ISDOpcodes.h:730
@ TokenFactor
TokenFactor - This node takes multiple tokens as input and produces a single token result.
Definition: ISDOpcodes.h:53
@ TRUNCATE
TRUNCATE - Completely drop the high bits.
Definition: ISDOpcodes.h:838
@ VAARG
VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, and the alignment.
Definition: ISDOpcodes.h:1256
@ BlockAddress
Definition: ISDOpcodes.h:94
@ SHL_PARTS
SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded integer shift operations.
Definition: ISDOpcodes.h:815
@ AssertSext
AssertSext, AssertZext - These nodes record if a register contains a value that has already been zero...
Definition: ISDOpcodes.h:62
@ FCOPYSIGN
FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.
Definition: ISDOpcodes.h:521
@ AssertZext
Definition: ISDOpcodes.h:63
LLVM_ABI bool isConstantSplatVector(const SDNode *N, APInt &SplatValue)
Node predicates.
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
Definition: ISDOpcodes.h:1685
@ Kill
The last use of a register.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
Definition: MathExtras.h:336
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition: Error.cpp:167
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
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
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:390
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Definition: ValueTypes.h:147
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:368
uint64_t getScalarSizeInBits() const
Definition: ValueTypes.h:380
LLVM_ABI Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
Definition: ValueTypes.cpp:216
bool isScalarInteger() const
Return true if this is an integer, but not a vector.
Definition: ValueTypes.h:157
Align getNonZeroOrigAlign() const
unsigned getByValSize() const
Align getNonZeroByValAlign() const
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getJumpTable(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a jump table entry.
static LLVM_ABI MachinePointerInfo getConstantPool(MachineFunction &MF)
Return a MachinePointerInfo record that refers to the constant pool.
static LLVM_ABI 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 contains information for each constraint that we are lowering.
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