LLVM 24.0.0git
MipsISelLowering.h
Go to the documentation of this file.
1//===- MipsISelLowering.h - Mips 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 Mips uses to lower LLVM code into a
10// selection DAG.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
15#define LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
16
20#include "Mips.h"
30#include "llvm/IR/CallingConv.h"
31#include "llvm/IR/InlineAsm.h"
32#include "llvm/IR/Type.h"
34#include <algorithm>
35#include <deque>
36#include <utility>
37#include <vector>
38
39namespace llvm {
40
41class Argument;
42class FastISel;
46class MachineInstr;
47class MipsCCState;
49class MipsSubtarget;
52class MCRegisterClass;
54
55 //===--------------------------------------------------------------------===//
56 // TargetLowering Implementation
57 //===--------------------------------------------------------------------===//
58
60 bool isMicroMips;
61
62 public:
63 explicit MipsTargetLowering(const MipsTargetMachine &TM,
64 const MipsSubtarget &STI);
65
66 static const MipsTargetLowering *create(const MipsTargetMachine &TM,
67 const MipsSubtarget &STI);
68
69 /// createFastISel - This method returns a target specific FastISel object,
70 /// or null if the target does not support "fast" ISel.
71 FastISel *
73 const TargetLibraryInfo *libInfo,
74 const LibcallLoweringInfo *libcallLowering) const override;
75
76 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override {
77 return MVT::i32;
78 }
79
81 ISD::NodeType) const override;
82
83 bool isCheapToSpeculateCttz(Type *Ty) const override;
85 const APInt &DemandedElts,
86 const SelectionDAG &DAG,
87 unsigned Depth) const override;
88 bool isCheapToSpeculateCtlz(Type *Ty) const override;
89 bool hasBitTest(SDValue X, SDValue Y) const override;
90 bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override;
91
92 /// Return the register type for a given MVT, ensuring vectors are treated
93 /// as a series of gpr sized integers.
95 EVT VT) const override;
96
97 /// Return the number of registers for a given MVT, ensuring vectors are
98 /// treated as a series of gpr sized integers.
101 EVT VT) const override;
102
103 /// Break down vectors to the correct number of gpr sized integers.
105 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
106 unsigned &NumIntermediates, MVT &RegisterVT) const override;
107
108 /// Return the correct alignment for the current calling convention.
110 const DataLayout &DL) const override {
111 const Align ABIAlign = DL.getABITypeAlign(ArgTy);
112 if (ArgTy->isVectorTy())
113 return std::min(ABIAlign, Align(8));
114 return ABIAlign;
115 }
116
118 return ISD::SIGN_EXTEND;
119 }
120
121 /// LowerOperation - Provide custom lowering hooks for some operations.
122 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
123
124 /// ReplaceNodeResults - Replace the results of node with an illegal result
125 /// type with new values built out of custom code.
126 ///
128 SelectionDAG &DAG) const override;
129
130 /// getSetCCResultType - get the ISD::SETCC result ValueType
132 EVT VT) const override;
133
134 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
135
138 MachineBasicBlock *MBB) const override;
139
141 SDNode *Node) const override;
142
143 void finalizeLowering(MachineFunction &MF) const override;
144
145 void HandleByVal(CCState *, unsigned &, Align) const override;
146
147 Register getRegisterByName(const char* RegName, LLT VT,
148 const MachineFunction &MF) const override;
149
150 /// If a physical register, this returns the register that receives the
151 /// exception address on entry to an EH pad.
154 const Constant *PersonalityFn) const override {
155 return ABI.getArgRegPtr(0);
156 }
157
158 /// If a physical register, this returns the register that receives the
159 /// exception typeid on entry to a landing pad.
162 const Constant *PersonalityFn) const override {
163 return ABI.getArgRegPtr(1);
164 }
165
166 bool isJumpTableRelative() const override {
168 }
169
171
173
174 protected:
175 SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;
176
177 // This method creates the following nodes, which are necessary for
178 // computing a local symbol's address:
179 //
180 // (add (load (wrapper $gp, %got(sym)), %lo(sym))
181 template <class NodeTy>
182 SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
183 bool IsN32OrN64) const {
184 unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
185 SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
186 getTargetNode(N, Ty, DAG, GOTFlag));
187 SDValue Load =
188 DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
190 unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
191 SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
192 getTargetNode(N, Ty, DAG, LoFlag));
193 return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
194 }
195
196 // This method creates the following nodes, which are necessary for
197 // computing a global symbol's address:
198 //
199 // (load (wrapper $gp, %got(sym)))
200 template <class NodeTy>
201 SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
202 unsigned Flag, SDValue Chain,
203 const MachinePointerInfo &PtrInfo) const {
204 SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
205 getTargetNode(N, Ty, DAG, Flag));
206 return DAG.getLoad(Ty, DL, Chain, Tgt, PtrInfo);
207 }
208
209 // This method creates the following nodes, which are necessary for
210 // computing a global symbol's address in large-GOT mode:
211 //
212 // (load (wrapper (add %hi(sym), $gp), %lo(sym)))
213 template <class NodeTy>
215 SelectionDAG &DAG, unsigned HiFlag,
216 unsigned LoFlag, SDValue Chain,
217 const MachinePointerInfo &PtrInfo) const {
218 SDValue Hi = DAG.getNode(MipsISD::GotHi, DL, Ty,
219 getTargetNode(N, Ty, DAG, HiFlag));
220 Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, getGlobalReg(DAG, Ty));
221 SDValue Wrapper = DAG.getNode(MipsISD::Wrapper, DL, Ty, Hi,
222 getTargetNode(N, Ty, DAG, LoFlag));
223 return DAG.getLoad(Ty, DL, Chain, Wrapper, PtrInfo);
224 }
225
226 // This method creates the following nodes, which are necessary for
227 // computing a symbol's address in non-PIC mode:
228 //
229 // (add %hi(sym), %lo(sym))
230 //
231 // This method covers O32, N32 and N64 in sym32 mode.
232 template <class NodeTy>
233 SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty,
234 SelectionDAG &DAG) const {
235 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
236 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
237 return DAG.getNode(ISD::ADD, DL, Ty,
238 DAG.getNode(MipsISD::Hi, DL, Ty, Hi),
239 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
240 }
241
242 // This method creates the following nodes, which are necessary for
243 // computing a symbol's address in non-PIC mode for N64.
244 //
245 // (add (shl (add (shl (add %highest(sym), %higher(sim)), 16), %high(sym)),
246 // 16), %lo(%sym))
247 //
248 // FIXME: This method is not efficent for (micro)MIPS64R6.
249 template <class NodeTy>
250 SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty,
251 SelectionDAG &DAG) const {
252 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
253 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
254
255 SDValue Highest =
256 DAG.getNode(MipsISD::Highest, DL, Ty,
257 getTargetNode(N, Ty, DAG, MipsII::MO_HIGHEST));
258 SDValue Higher = getTargetNode(N, Ty, DAG, MipsII::MO_HIGHER);
259 SDValue HigherPart =
260 DAG.getNode(ISD::ADD, DL, Ty, Highest,
261 DAG.getNode(MipsISD::Higher, DL, Ty, Higher));
262 SDValue Cst = DAG.getConstant(16, DL, MVT::i32);
263 SDValue Shift = DAG.getNode(ISD::SHL, DL, Ty, HigherPart, Cst);
264 SDValue Add = DAG.getNode(ISD::ADD, DL, Ty, Shift,
265 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
266 SDValue Shift2 = DAG.getNode(ISD::SHL, DL, Ty, Add, Cst);
267
268 return DAG.getNode(ISD::ADD, DL, Ty, Shift2,
269 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
270 }
271
272 // This method creates the following nodes, which are necessary for
273 // computing a symbol's address using gp-relative addressing:
274 //
275 // (add $gp, %gp_rel(sym))
276 template <class NodeTy>
277 SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty,
278 SelectionDAG &DAG, bool IsN64) const {
279 SDValue GPRel = getTargetNode(N, Ty, DAG, MipsII::MO_GPREL);
280 return DAG.getNode(
281 ISD::ADD, DL, Ty,
282 DAG.getRegister(IsN64 ? Mips::GP_64 : Mips::GP, Ty),
283 DAG.getNode(MipsISD::GPRel, DL, DAG.getVTList(Ty), GPRel));
284 }
285
286 // This method creates the following nodes, which are necessary for
287 // loading a dllimported symbol:
288 //
289 // (lw (add (shl(%high(sym), 16), %low(sym)))
290 template <class NodeTy>
291 SDValue getDllimportSymbol(NodeTy *N, const SDLoc &DL, EVT Ty,
292 SelectionDAG &DAG) const {
293 SDValue Hi =
294 getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI | MipsII::MO_DLLIMPORT);
295 SDValue Lo =
296 getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO | MipsII::MO_DLLIMPORT);
297 return DAG.getNode(ISD::ADD, DL, Ty, DAG.getNode(MipsISD::Lo, DL, Ty, Lo),
298 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
299 }
300
301 // This method creates the following nodes, which are necessary for
302 // loading a dllimported global variable:
303 //
304 // (lw (lw (add (shl(%high(sym), 16), %low(sym))))
305 template <class NodeTy>
307 SelectionDAG &DAG, SDValue Chain,
308 const MachinePointerInfo &PtrInfo) const {
309 return DAG.getLoad(Ty, DL, Chain, getDllimportSymbol(N, DL, Ty, DAG),
310 PtrInfo);
311 }
312
313 /// This function fills Ops, which is the list of operands that will later
314 /// be used when a function call node is created. It also generates
315 /// copyToReg nodes to set up argument registers.
316 virtual void
318 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
319 bool IsPICCall, bool GlobalOrExternal, bool LocalLinkage,
320 bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee,
321 SDValue Chain) const;
322
323 protected:
326
327 // Subtarget Info
329 // Cache the ABI from the TargetMachine, we use it everywhere.
331
332 private:
333 // Create a TargetGlobalAddress node.
334 SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
335 unsigned Flag) const;
336
337 // Create a TargetExternalSymbol node.
338 SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG,
339 unsigned Flag) const;
340
341 // Create a TargetBlockAddress node.
342 SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
343 unsigned Flag) const;
344
345 // Create a TargetJumpTable node.
346 SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,
347 unsigned Flag) const;
348
349 // Create a TargetConstantPool node.
350 SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,
351 unsigned Flag) const;
352
353 // Lower Operand helpers
354 SDValue LowerCallResult(SDValue Chain, SDValue InGlue,
355 CallingConv::ID CallConv, bool isVarArg,
357 const SDLoc &dl, SelectionDAG &DAG,
360
361 // Lower Operand specifics
362 SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
363 SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
364 SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
365 SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
366 SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
367 SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
368 SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const;
369 SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
370 SDValue lowerFSETCC(SDValue Op, SelectionDAG &DAG) const;
371 SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
372 SDValue lowerVAARG(SDValue Op, SelectionDAG &DAG) const;
373 SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
374 SDValue lowerFABS(SDValue Op, SelectionDAG &DAG) const;
375 SDValue lowerFABS32(SDValue Op, SelectionDAG &DAG,
376 bool HasExtractInsert) const;
377 SDValue lowerFABS64(SDValue Op, SelectionDAG &DAG,
378 bool HasExtractInsert) const;
379 SDValue lowerFNEG(SDValue Op, SelectionDAG &DAG) const;
380 SDValue lowerFCANONICALIZE(SDValue Op, SelectionDAG &DAG) const;
381 SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
382 SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
383 SDValue lowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
384 SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const;
385 SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG& DAG) const;
386 SDValue lowerShiftRightParts(SDValue Op, SelectionDAG& DAG,
387 bool IsSRA) const;
388 SDValue lowerEH_DWARF_CFA(SDValue Op, SelectionDAG &DAG) const;
389 SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const;
390 SDValue lowerSTRICT_FP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
391 SDValue lowerGET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
392 SDValue lowerSET_ROUNDING(SDValue Op, SelectionDAG &DAG) const;
393 SDValue lowerREADCYCLECOUNTER(SDValue Op, SelectionDAG &DAG) const;
394 SDValue lowerConstantFP(SDValue Op, SelectionDAG &DAG) const;
395
396 /// isEligibleForTailCallOptimization - Check whether the call is eligible
397 /// for tail call optimization.
398 virtual bool
399 isEligibleForTailCallOptimization(const CCState &CCInfo,
400 unsigned NextStackOffset,
401 const MipsFunctionInfo &FI) const = 0;
402
403 /// copyByValArg - Copy argument registers which were used to pass a byval
404 /// argument to the stack. Create a stack frame object for the byval
405 /// argument.
406 void copyByValRegs(SDValue Chain, const SDLoc &DL,
407 std::vector<SDValue> &OutChains, SelectionDAG &DAG,
408 const ISD::ArgFlagsTy &Flags,
410 const Argument *FuncArg, unsigned FirstReg,
411 unsigned LastReg, const CCValAssign &VA,
412 MipsCCState &State) const;
413
414 /// passByValArg - Pass a byval argument in registers or on stack.
415 void passByValArg(SDValue Chain, const SDLoc &DL,
416 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
417 SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
418 MachineFrameInfo &MFI, SelectionDAG &DAG, SDValue Arg,
419 unsigned FirstReg, unsigned LastReg,
420 const ISD::ArgFlagsTy &Flags, bool isLittle,
421 const CCValAssign &VA) const;
422
423 /// writeVarArgRegs - Write variable function arguments passed in registers
424 /// to the stack. Also create a stack frame object for the first variable
425 /// argument.
426 void writeVarArgRegs(std::vector<SDValue> &OutChains, SDValue Chain,
427 const SDLoc &DL, SelectionDAG &DAG,
428 CCState &State) const;
429
430 SDValue
431 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
433 const SDLoc &dl, SelectionDAG &DAG,
434 SmallVectorImpl<SDValue> &InVals) const override;
435
436 SDValue passArgOnStack(SDValue StackPtr, unsigned Offset, SDValue Chain,
437 SDValue Arg, const SDLoc &DL, bool IsTailCall,
438 SelectionDAG &DAG) const;
439
441 SmallVectorImpl<SDValue> &InVals) const override;
442
443 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
444 bool isVarArg,
446 LLVMContext &Context, const Type *RetTy) const override;
447
448 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
450 const SmallVectorImpl<SDValue> &OutVals,
451 const SDLoc &dl, SelectionDAG &DAG) const override;
452
453 SDValue LowerInterruptReturn(SmallVectorImpl<SDValue> &RetOps,
454 const SDLoc &DL, SelectionDAG &DAG) const;
455
456 bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override;
457
458 // Inline asm support
459 ConstraintType getConstraintType(StringRef Constraint) const override;
460
461 /// Examine constraint string and operand type and determine a weight value.
462 /// The operand object must already have been set up with the operand type.
463 ConstraintWeight getSingleConstraintMatchWeight(
464 AsmOperandInfo &info, const char *constraint) const override;
465
466 /// This function parses registers that appear in inline-asm constraints.
467 /// It returns pair (0, 0) on failure.
468 std::pair<unsigned, const TargetRegisterClass *>
469 parseRegForInlineAsmConstraint(StringRef C, MVT VT) const;
470
471 std::pair<unsigned, const TargetRegisterClass *>
472 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
473 StringRef Constraint, MVT VT) const override;
474
475 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
476 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is
477 /// true it means one of the asm constraint of the inline asm instruction
478 /// being processed is 'm'.
479 void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,
480 std::vector<SDValue> &Ops,
481 SelectionDAG &DAG) const override;
482
484 getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
485 if (ConstraintCode == "o")
487 if (ConstraintCode == "R")
489 if (ConstraintCode == "ZC")
491 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
492 }
493
494 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM,
495 Type *Ty, unsigned AS,
496 Instruction *I = nullptr) const override;
497
498 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
499
500 EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
501 const AttributeList &FuncAttributes) const override;
502
503 /// Returns how to materialize the specified FP immediate.
504 FPImmAction getFPImmAction(const APFloat &Imm, EVT VT,
505 bool ForCodeSize) const override;
506
507 bool isLegalICmpImmediate(int64_t Imm) const override;
508 bool isLegalAddImmediate(int64_t Imm) const override;
509
510 unsigned getJumpTableEncoding() const override;
511 SDValue getPICJumpTableRelocBase(SDValue Table,
512 SelectionDAG &DAG) const override;
513 bool useSoftFloat() const override;
514
515 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
516 return true;
517 }
518
520
521 /// Emit a sign-extension using sll/sra, seb, or seh appropriately.
522 MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr &MI,
523 MachineBasicBlock *BB,
524 unsigned Size, unsigned DstReg,
525 unsigned SrcRec) const;
526
527 MachineBasicBlock *emitAtomicBinary(MachineInstr &MI,
528 MachineBasicBlock *BB) const;
529 MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr &MI,
530 MachineBasicBlock *BB,
531 unsigned Size) const;
532 MachineBasicBlock *emitAtomicCmpSwap(MachineInstr &MI,
533 MachineBasicBlock *BB) const;
534 MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr &MI,
535 MachineBasicBlock *BB,
536 unsigned Size) const;
537 MachineBasicBlock *emitPseudoSELECT(MachineInstr &MI, MachineBasicBlock *BB,
538 bool isFPCmp, unsigned Opc) const;
539 MachineBasicBlock *emitPseudoD_SELECT(MachineInstr &MI,
540 MachineBasicBlock *BB) const;
541 MachineBasicBlock *emitLDR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
542 MachineBasicBlock *emitLDR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
543 MachineBasicBlock *emitSTR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
544 MachineBasicBlock *emitSTR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
545 };
546
547 /// Create MipsTargetLowering objects.
548 const MipsTargetLowering *
550 const MipsSubtarget &STI);
551 const MipsTargetLowering *
553 const MipsSubtarget &STI);
554
555namespace Mips {
556
557FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
558 const TargetLibraryInfo *libInfo,
559 const LibcallLoweringInfo *libcallLowering);
560
561} // end namespace Mips
562
563} // end namespace llvm
564
565#endif // LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
amdgpu aa AMDGPU Address space based Alias Analysis Wrapper
uint64_t Imm
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
#define X(NUM, ENUM, NAME)
Definition ELF.h:665
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define RegName(no)
lazy value info
static bool isLegalAddImmediate(const TargetTransformInfo &TTI, Immediate Offset)
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
RISCVCC::CondCode CC
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
This file describes how to lower LLVM code to machine code.
Class for arbitrary precision integers.
Definition APInt.h:78
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
CCState - This class holds information needed while lowering arguments and return values.
CCValAssign - Represent assignment of one arg/retval to a location.
This is an important base class in LLVM.
Definition Constant.h:44
A parsed version of the target data layout string in and methods for querying it.
Definition DataLayout.h:64
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
Definition FastISel.h:67
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
Tracks which library functions to use for a particular subtarget or function.
MCRegisterClass - Base class of TargetRegisterClass.
Machine Value Type.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Representation of each machine instruction.
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
MVT getRegisterTypeForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the register type for a given MVT, ensuring vectors are treated as a series of gpr sized integ...
bool hasBitTest(SDValue X, SDValue Y) const override
Return true if the target has a bit-test instruction: (X & (1 << Y)) ==/!= 0 This knowledge can be us...
static const MipsTargetLowering * create(const MipsTargetMachine &TM, const MipsSubtarget &STI)
SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN64) const
unsigned getVectorTypeBreakdownForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, unsigned &NumIntermediates, MVT &RegisterVT) const override
Break down vectors to the correct number of gpr sized integers.
Register getRegisterByName(const char *RegName, LLT VT, const MachineFunction &MF) const override
Return the register ID of the name passed in.
Register getExceptionPointerRegister(ExceptionHandling EH, const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
Register getExceptionSelectorRegister(ExceptionHandling EH, const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override
Return the type to use for a scalar shift opcode, given the shifted amount type.
EVT getSetCCResultType(const DataLayout &DL, LLVMContext &Context, EVT VT) const override
getSetCCResultType - get the ISD::SETCC result ValueType
SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned Flag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
MipsTargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
const MipsABIInfo & ABI
SDValue getAddrGlobalLargeGOT(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, unsigned HiFlag, unsigned LoFlag, SDValue Chain, const MachinePointerInfo &PtrInfo) const
SDValue getDllimportVariable(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, SDValue Chain, const MachinePointerInfo &PtrInfo) const
bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override
Return true if it is profitable to fold a pair of shifts into a mask.
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override
This method will be invoked for all target nodes and for any target-independent nodes that the target...
CCAssignFn * CCAssignFnForReturn() const
void ReplaceNodeResults(SDNode *N, SmallVectorImpl< SDValue > &Results, SelectionDAG &DAG) const override
ReplaceNodeResults - Replace the results of node with an illegal result type with new values built ou...
MachineBasicBlock * EmitInstrWithCustomInserter(MachineInstr &MI, MachineBasicBlock *MBB) const override
This method should be implemented by targets that mark instructions with the 'usesCustomInserter' fla...
SDValue getDllimportSymbol(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
CCAssignFn * CCAssignFnForCall() const
unsigned getNumRegistersForCallingConv(LLVMContext &Context, CallingConv::ID CC, EVT VT) const override
Return the number of registers for a given MVT, ensuring vectors are treated as a series of gpr sized...
virtual void getOpndList(SmallVectorImpl< SDValue > &Ops, std::deque< std::pair< unsigned, SDValue > > &RegsToPass, bool IsPICCall, bool GlobalOrExternal, bool LocalLinkage, bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee, SDValue Chain) const
This function fills Ops, which is the list of operands that will later be used when a function call n...
SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
EVT getTypeForExtReturn(LLVMContext &Context, EVT VT, ISD::NodeType) const override
Return the type that should be used to zero or sign extend a zeroext/signext integer return value.
bool isCheapToSpeculateCtlz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic ctlz.
SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override
LowerOperation - Provide custom lowering hooks for some operations.
bool isCheapToSpeculateCttz(Type *Ty) const override
Return true if it is cheap to speculate a call to intrinsic cttz.
SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN32OrN64) const
unsigned ComputeNumSignBitsForTargetNode(SDValue Op, const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const override
This method can be implemented by targets that want to expose additional information about sign bits ...
SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const
const MipsSubtarget & Subtarget
ISD::NodeType getExtendForAtomicOps() const override
Returns how the platform's atomic operations are extended (ZERO_EXTEND, SIGN_EXTEND,...
void HandleByVal(CCState *, unsigned &, Align) const override
Target-specific cleanup for formal ByVal parameters.
void finalizeLowering(MachineFunction &MF) const override
Execute target specific actions to finalize target lowering.
bool isJumpTableRelative() const override
SDValue lowerLOAD(SDValue Op, SelectionDAG &DAG) const
Align getABIAlignmentForCallingConv(Type *ArgTy, const DataLayout &DL) const override
Return the correct alignment for the current calling convention.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
Wrapper class for IR location info (IR ordering and DebugLoc) to be passed into SDNode creation funct...
Represents one node in the SelectionDAG.
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...
LLVM_ABI SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
LLVM_ABI SDValue getRegister(Register Reg, EVT VT)
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 getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const MMOMetadata &Metadata=MMOMetadata())
Loads are not normal binary operators: their result type is not determined by their operands,...
LLVM_ABI SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
MachineFunction & getMachineFunction() const
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Provides information about what library functions are available for the current target.
const TargetMachine & getTargetMachine() const
FPImmAction
How the legalizer should materialize a floating-point immediate.
virtual bool useSoftFloat() const
virtual InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const
TargetLowering(const TargetLowering &)=delete
virtual ArrayRef< MCPhysReg > getRoundingControlRegisters() const
Returns a 0 terminated array of rounding control registers that can be attached into strict FP call.
virtual unsigned getJumpTableEncoding() const
Return the entry encoding for a jump table in the current function.
bool isPositionIndependent() const
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:46
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:283
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition ISDOpcodes.h:43
@ ADD
Simple integer binary arithmetic operators.
Definition ISDOpcodes.h:266
@ SIGN_EXTEND
Conversion operators.
Definition ISDOpcodes.h:876
@ SHL
Shift and rotation operations.
Definition ISDOpcodes.h:793
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo, const LibcallLoweringInfo *libcallLowering)
constexpr MCPhysReg GP_64
constexpr MCPhysReg GP
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
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.
@ Load
The value being inserted comes from a load (InsertElement only).
const MipsTargetLowering * createMips16TargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Create MipsTargetLowering objects.
@ Add
Sum of integers.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
ExceptionHandling
Definition CodeGen.h:54
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
#define N
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
This class contains a discriminated union of information about pointers in memory operands,...
static LLVM_ABI MachinePointerInfo getGOT(MachineFunction &MF)
Return a MachinePointerInfo record that refers to a GOT entry.
This contains information for each constraint that we are lowering.
This structure contains all information that is necessary for lowering calls.