LLVM 20.0.0git
XtensaISelLowering.h
Go to the documentation of this file.
1//===- XtensaISelLowering.h - Xtensa DAG Lowering Interface -----*- C++ -*-===//
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#ifndef LLVM_LIB_TARGET_XTENSA_XTENSAISELLOWERING_H
15#define LLVM_LIB_TARGET_XTENSA_XTENSAISELLOWERING_H
16
20
21namespace llvm {
22
23namespace XtensaISD {
24enum {
27
28 // Calls a function. Operand 0 is the chain operand and operand 1
29 // is the target address. The arguments start at operand 2.
30 // There is an optional glue operand at the end.
32
33 // Wraps a TargetGlobalAddress that should be loaded using PC-relative
34 // accesses. Operand 0 is the address.
37
38 // Select with condition operator - This selects between a true value and
39 // a false value (ops #2 and #3) based on the boolean result of comparing
40 // the lhs and rhs (ops #0 and #1) of a conditional expression with the
41 // condition code in op #4
43};
44}
45
46class XtensaSubtarget;
47
49public:
51 const XtensaSubtarget &STI);
52
54 EVT VT) const override {
55 if (!VT.isVector())
56 return MVT::i32;
58 }
59
60 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
61
62 const char *getTargetNodeName(unsigned Opcode) const override;
63
64 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
65
67 bool isVarArg,
69 const SDLoc &DL, SelectionDAG &DAG,
70 SmallVectorImpl<SDValue> &InVals) const override;
71
72 SDValue LowerCall(CallLoweringInfo &CLI,
73 SmallVectorImpl<SDValue> &InVals) const override;
74
76 bool isVarArg,
78 LLVMContext &Context) const override;
79
80 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool IsVarArg,
82 const SmallVectorImpl<SDValue> &OutVals, const SDLoc &DL,
83 SelectionDAG &DAG) const override;
84
85 const XtensaSubtarget &getSubtarget() const { return Subtarget; }
86
89 MachineBasicBlock *BB) const override;
90
91private:
92 const XtensaSubtarget &Subtarget;
93
94 SDValue LowerBR_JT(SDValue Op, SelectionDAG &DAG) const;
95
96 SDValue LowerImmediate(SDValue Op, SelectionDAG &DAG) const;
97
98 SDValue LowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
99
100 SDValue LowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
101
102 SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
103
104 SDValue LowerConstantPool(ConstantPoolSDNode *CP, SelectionDAG &DAG) const;
105
106 SDValue LowerSELECT_CC(SDValue Op, SelectionDAG &DAG) const;
107
108 SDValue LowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const;
109
110 SDValue LowerSTACKSAVE(SDValue Op, SelectionDAG &DAG) const;
111
112 SDValue LowerSTACKRESTORE(SDValue Op, SelectionDAG &DAG) const;
113
114 SDValue getAddrPCRel(SDValue Op, SelectionDAG &DAG) const;
115
116 CCAssignFn *CCAssignFnForCall(CallingConv::ID CC, bool IsVarArg) const;
117
118 MachineBasicBlock *emitSelectCC(MachineInstr &MI,
119 MachineBasicBlock *BB) const;
120};
121
122} // end namespace llvm
123
124#endif /* LLVM_LIB_TARGET_XTENSA_XTENSAISELLOWERING_H */
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
IRTranslator LLVM IR MI
const char LLVMTargetMachineRef TM
This file describes how to lower LLVM code to machine code.
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:103
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Representation of each machine instruction.
Definition: MachineInstr.h:69
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
Definition: SelectionDAG.h:226
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:587
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
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,...
EVT getSetCCResultType(const DataLayout &, LLVMContext &, EVT VT) const override
Return the ValueType of the result of SETCC operations.
SDValue LowerCall(CallLoweringInfo &CLI, SmallVectorImpl< SDValue > &InVals) const override
This hook must be implemented to lower calls into the specified DAG.
const XtensaSubtarget & getSubtarget() const
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...
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:1475
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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.
Extended Value Type.
Definition: ValueTypes.h:35
EVT changeVectorElementTypeToInteger() const
Return a vector with the same number of elements as this vector, but with the element type converted ...
Definition: ValueTypes.h:94
bool isVector() const
Return true if this is a vector value type.
Definition: ValueTypes.h:168