LLVM 22.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;
53
54 //===--------------------------------------------------------------------===//
55 // TargetLowering Implementation
56 //===--------------------------------------------------------------------===//
57
59 bool isMicroMips;
60
61 public:
62 explicit MipsTargetLowering(const MipsTargetMachine &TM,
63 const MipsSubtarget &STI);
64
65 static const MipsTargetLowering *create(const MipsTargetMachine &TM,
66 const MipsSubtarget &STI);
67
68 /// createFastISel - This method returns a target specific FastISel object,
69 /// or null if the target does not support "fast" ISel.
71 const TargetLibraryInfo *libInfo) const override;
72
73 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override {
74 return MVT::i32;
75 }
76
78 ISD::NodeType) const override;
79
80 bool isCheapToSpeculateCttz(Type *Ty) const override;
81 bool isCheapToSpeculateCtlz(Type *Ty) const override;
82 bool hasBitTest(SDValue X, SDValue Y) const override;
83 bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override;
84
85 /// Return the register type for a given MVT, ensuring vectors are treated
86 /// as a series of gpr sized integers.
88 EVT VT) const override;
89
90 /// Return the number of registers for a given MVT, ensuring vectors are
91 /// treated as a series of gpr sized integers.
94 EVT VT) const override;
95
96 /// Break down vectors to the correct number of gpr sized integers.
98 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
99 unsigned &NumIntermediates, MVT &RegisterVT) const override;
100
101 /// Return the correct alignment for the current calling convention.
103 const DataLayout &DL) const override {
104 const Align ABIAlign = DL.getABITypeAlign(ArgTy);
105 if (ArgTy->isVectorTy())
106 return std::min(ABIAlign, Align(8));
107 return ABIAlign;
108 }
109
111 return ISD::SIGN_EXTEND;
112 }
113
114 /// LowerOperation - Provide custom lowering hooks for some operations.
115 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
116
117 /// ReplaceNodeResults - Replace the results of node with an illegal result
118 /// type with new values built out of custom code.
119 ///
121 SelectionDAG &DAG) const override;
122
123 /// getSetCCResultType - get the ISD::SETCC result ValueType
125 EVT VT) const override;
126
127 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
128
131 MachineBasicBlock *MBB) const override;
132
134 SDNode *Node) const override;
135
136 void HandleByVal(CCState *, unsigned &, Align) const override;
137
138 Register getRegisterByName(const char* RegName, LLT VT,
139 const MachineFunction &MF) const override;
140
141 /// If a physical register, this returns the register that receives the
142 /// exception address on entry to an EH pad.
144 getExceptionPointerRegister(const Constant *PersonalityFn) const override {
145 return ABI.IsN64() ? Mips::A0_64 : Mips::A0;
146 }
147
148 /// If a physical register, this returns the register that receives the
149 /// exception typeid on entry to a landing pad.
151 getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
152 return ABI.IsN64() ? Mips::A1_64 : Mips::A1;
153 }
154
155 bool isJumpTableRelative() const override {
157 }
158
160
162
163 protected:
164 SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;
165
166 // This method creates the following nodes, which are necessary for
167 // computing a local symbol's address:
168 //
169 // (add (load (wrapper $gp, %got(sym)), %lo(sym))
170 template <class NodeTy>
171 SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
172 bool IsN32OrN64) const {
173 unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
174 SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
175 getTargetNode(N, Ty, DAG, GOTFlag));
176 SDValue Load =
177 DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
179 unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
180 SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
181 getTargetNode(N, Ty, DAG, LoFlag));
182 return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
183 }
184
185 // This method creates the following nodes, which are necessary for
186 // computing a global symbol's address:
187 //
188 // (load (wrapper $gp, %got(sym)))
189 template <class NodeTy>
190 SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
191 unsigned Flag, SDValue Chain,
192 const MachinePointerInfo &PtrInfo) const {
193 SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
194 getTargetNode(N, Ty, DAG, Flag));
195 return DAG.getLoad(Ty, DL, Chain, Tgt, PtrInfo);
196 }
197
198 // This method creates the following nodes, which are necessary for
199 // computing a global symbol's address in large-GOT mode:
200 //
201 // (load (wrapper (add %hi(sym), $gp), %lo(sym)))
202 template <class NodeTy>
204 SelectionDAG &DAG, unsigned HiFlag,
205 unsigned LoFlag, SDValue Chain,
206 const MachinePointerInfo &PtrInfo) const {
207 SDValue Hi = DAG.getNode(MipsISD::GotHi, DL, Ty,
208 getTargetNode(N, Ty, DAG, HiFlag));
209 Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, getGlobalReg(DAG, Ty));
210 SDValue Wrapper = DAG.getNode(MipsISD::Wrapper, DL, Ty, Hi,
211 getTargetNode(N, Ty, DAG, LoFlag));
212 return DAG.getLoad(Ty, DL, Chain, Wrapper, PtrInfo);
213 }
214
215 // This method creates the following nodes, which are necessary for
216 // computing a symbol's address in non-PIC mode:
217 //
218 // (add %hi(sym), %lo(sym))
219 //
220 // This method covers O32, N32 and N64 in sym32 mode.
221 template <class NodeTy>
222 SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty,
223 SelectionDAG &DAG) const {
224 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
225 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
226 return DAG.getNode(ISD::ADD, DL, Ty,
227 DAG.getNode(MipsISD::Hi, DL, Ty, Hi),
228 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
229 }
230
231 // This method creates the following nodes, which are necessary for
232 // computing a symbol's address in non-PIC mode for N64.
233 //
234 // (add (shl (add (shl (add %highest(sym), %higher(sim)), 16), %high(sym)),
235 // 16), %lo(%sym))
236 //
237 // FIXME: This method is not efficent for (micro)MIPS64R6.
238 template <class NodeTy>
239 SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty,
240 SelectionDAG &DAG) const {
241 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
242 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
243
244 SDValue Highest =
245 DAG.getNode(MipsISD::Highest, DL, Ty,
246 getTargetNode(N, Ty, DAG, MipsII::MO_HIGHEST));
247 SDValue Higher = getTargetNode(N, Ty, DAG, MipsII::MO_HIGHER);
248 SDValue HigherPart =
249 DAG.getNode(ISD::ADD, DL, Ty, Highest,
250 DAG.getNode(MipsISD::Higher, DL, Ty, Higher));
251 SDValue Cst = DAG.getConstant(16, DL, MVT::i32);
252 SDValue Shift = DAG.getNode(ISD::SHL, DL, Ty, HigherPart, Cst);
253 SDValue Add = DAG.getNode(ISD::ADD, DL, Ty, Shift,
254 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
255 SDValue Shift2 = DAG.getNode(ISD::SHL, DL, Ty, Add, Cst);
256
257 return DAG.getNode(ISD::ADD, DL, Ty, Shift2,
258 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
259 }
260
261 // This method creates the following nodes, which are necessary for
262 // computing a symbol's address using gp-relative addressing:
263 //
264 // (add $gp, %gp_rel(sym))
265 template <class NodeTy>
266 SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty,
267 SelectionDAG &DAG, bool IsN64) const {
268 SDValue GPRel = getTargetNode(N, Ty, DAG, MipsII::MO_GPREL);
269 return DAG.getNode(
270 ISD::ADD, DL, Ty,
271 DAG.getRegister(IsN64 ? Mips::GP_64 : Mips::GP, Ty),
272 DAG.getNode(MipsISD::GPRel, DL, DAG.getVTList(Ty), GPRel));
273 }
274
275 // This method creates the following nodes, which are necessary for
276 // loading a dllimported symbol:
277 //
278 // (lw (add (shl(%high(sym), 16), %low(sym)))
279 template <class NodeTy>
280 SDValue getDllimportSymbol(NodeTy *N, const SDLoc &DL, EVT Ty,
281 SelectionDAG &DAG) const {
282 SDValue Hi =
283 getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI | MipsII::MO_DLLIMPORT);
284 SDValue Lo =
285 getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO | MipsII::MO_DLLIMPORT);
286 return DAG.getNode(ISD::ADD, DL, Ty, DAG.getNode(MipsISD::Lo, DL, Ty, Lo),
287 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
288 }
289
290 // This method creates the following nodes, which are necessary for
291 // loading a dllimported global variable:
292 //
293 // (lw (lw (add (shl(%high(sym), 16), %low(sym))))
294 template <class NodeTy>
296 SelectionDAG &DAG, SDValue Chain,
297 const MachinePointerInfo &PtrInfo) const {
298 return DAG.getLoad(Ty, DL, Chain, getDllimportSymbol(N, DL, Ty, DAG),
299 PtrInfo);
300 }
301
302 /// This function fills Ops, which is the list of operands that will later
303 /// be used when a function call node is created. It also generates
304 /// copyToReg nodes to set up argument registers.
305 virtual void
307 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
308 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
309 bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee,
310 SDValue Chain) const;
311
312 protected:
315
316 // Subtarget Info
318 // Cache the ABI from the TargetMachine, we use it everywhere.
320
321 private:
322 // Create a TargetGlobalAddress node.
323 SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
324 unsigned Flag) const;
325
326 // Create a TargetExternalSymbol node.
327 SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG,
328 unsigned Flag) const;
329
330 // Create a TargetBlockAddress node.
331 SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
332 unsigned Flag) const;
333
334 // Create a TargetJumpTable node.
335 SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,
336 unsigned Flag) const;
337
338 // Create a TargetConstantPool node.
339 SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,
340 unsigned Flag) const;
341
342 // Lower Operand helpers
343 SDValue LowerCallResult(SDValue Chain, SDValue InGlue,
344 CallingConv::ID CallConv, bool isVarArg,
346 const SDLoc &dl, SelectionDAG &DAG,
349
350 // Lower Operand specifics
351 SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
352 SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
353 SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
354 SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
355 SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
356 SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
357 SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const;
358 SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
359 SDValue lowerFSETCC(SDValue Op, SelectionDAG &DAG) const;
360 SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
361 SDValue lowerVAARG(SDValue Op, SelectionDAG &DAG) const;
362 SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
363 SDValue lowerFABS(SDValue Op, SelectionDAG &DAG) const;
364 SDValue lowerFABS32(SDValue Op, SelectionDAG &DAG,
365 bool HasExtractInsert) const;
366 SDValue lowerFABS64(SDValue Op, SelectionDAG &DAG,
367 bool HasExtractInsert) const;
368 SDValue lowerFCANONICALIZE(SDValue Op, SelectionDAG &DAG) const;
369 SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
370 SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
371 SDValue lowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
372 SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const;
373 SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG& DAG) const;
374 SDValue lowerShiftRightParts(SDValue Op, SelectionDAG& DAG,
375 bool IsSRA) const;
376 SDValue lowerEH_DWARF_CFA(SDValue Op, SelectionDAG &DAG) const;
377 SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const;
378 SDValue lowerSTRICT_FP_TO_INT(SDValue Op, SelectionDAG &DAG) const;
379 SDValue lowerREADCYCLECOUNTER(SDValue Op, SelectionDAG &DAG) const;
380
381 /// isEligibleForTailCallOptimization - Check whether the call is eligible
382 /// for tail call optimization.
383 virtual bool
384 isEligibleForTailCallOptimization(const CCState &CCInfo,
385 unsigned NextStackOffset,
386 const MipsFunctionInfo &FI) const = 0;
387
388 /// copyByValArg - Copy argument registers which were used to pass a byval
389 /// argument to the stack. Create a stack frame object for the byval
390 /// argument.
391 void copyByValRegs(SDValue Chain, const SDLoc &DL,
392 std::vector<SDValue> &OutChains, SelectionDAG &DAG,
393 const ISD::ArgFlagsTy &Flags,
395 const Argument *FuncArg, unsigned FirstReg,
396 unsigned LastReg, const CCValAssign &VA,
397 MipsCCState &State) const;
398
399 /// passByValArg - Pass a byval argument in registers or on stack.
400 void passByValArg(SDValue Chain, const SDLoc &DL,
401 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
402 SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
403 MachineFrameInfo &MFI, SelectionDAG &DAG, SDValue Arg,
404 unsigned FirstReg, unsigned LastReg,
405 const ISD::ArgFlagsTy &Flags, bool isLittle,
406 const CCValAssign &VA) const;
407
408 /// writeVarArgRegs - Write variable function arguments passed in registers
409 /// to the stack. Also create a stack frame object for the first variable
410 /// argument.
411 void writeVarArgRegs(std::vector<SDValue> &OutChains, SDValue Chain,
412 const SDLoc &DL, SelectionDAG &DAG,
413 CCState &State) const;
414
415 SDValue
416 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
418 const SDLoc &dl, SelectionDAG &DAG,
419 SmallVectorImpl<SDValue> &InVals) const override;
420
421 SDValue passArgOnStack(SDValue StackPtr, unsigned Offset, SDValue Chain,
422 SDValue Arg, const SDLoc &DL, bool IsTailCall,
423 SelectionDAG &DAG) const;
424
426 SmallVectorImpl<SDValue> &InVals) const override;
427
428 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
429 bool isVarArg,
431 LLVMContext &Context, const Type *RetTy) const override;
432
433 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
435 const SmallVectorImpl<SDValue> &OutVals,
436 const SDLoc &dl, SelectionDAG &DAG) const override;
437
438 SDValue LowerInterruptReturn(SmallVectorImpl<SDValue> &RetOps,
439 const SDLoc &DL, SelectionDAG &DAG) const;
440
441 bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override;
442
443 // Inline asm support
444 ConstraintType getConstraintType(StringRef Constraint) const override;
445
446 /// Examine constraint string and operand type and determine a weight value.
447 /// The operand object must already have been set up with the operand type.
448 ConstraintWeight getSingleConstraintMatchWeight(
449 AsmOperandInfo &info, const char *constraint) const override;
450
451 /// This function parses registers that appear in inline-asm constraints.
452 /// It returns pair (0, 0) on failure.
453 std::pair<unsigned, const TargetRegisterClass *>
454 parseRegForInlineAsmConstraint(StringRef C, MVT VT) const;
455
456 std::pair<unsigned, const TargetRegisterClass *>
457 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
458 StringRef Constraint, MVT VT) const override;
459
460 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
461 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is
462 /// true it means one of the asm constraint of the inline asm instruction
463 /// being processed is 'm'.
464 void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,
465 std::vector<SDValue> &Ops,
466 SelectionDAG &DAG) const override;
467
469 getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
470 if (ConstraintCode == "o")
472 if (ConstraintCode == "R")
474 if (ConstraintCode == "ZC")
476 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
477 }
478
479 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM,
480 Type *Ty, unsigned AS,
481 Instruction *I = nullptr) const override;
482
483 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
484
485 EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
486 const AttributeList &FuncAttributes) const override;
487
488 /// isFPImmLegal - Returns true if the target can instruction select the
489 /// specified FP immediate natively. If false, the legalizer will
490 /// materialize the FP immediate as a load from a constant pool.
491 bool isFPImmLegal(const APFloat &Imm, EVT VT,
492 bool ForCodeSize) const override;
493
494 bool isLegalICmpImmediate(int64_t Imm) const override;
495 bool isLegalAddImmediate(int64_t Imm) const override;
496
497 unsigned getJumpTableEncoding() const override;
498 SDValue getPICJumpTableRelocBase(SDValue Table,
499 SelectionDAG &DAG) const override;
500 bool useSoftFloat() const override;
501
502 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
503 return true;
504 }
505
506 int getCPURegisterIndex(StringRef Name) const;
507
509
510 /// Emit a sign-extension using sll/sra, seb, or seh appropriately.
511 MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr &MI,
512 MachineBasicBlock *BB,
513 unsigned Size, unsigned DstReg,
514 unsigned SrcRec) const;
515
516 MachineBasicBlock *emitAtomicBinary(MachineInstr &MI,
517 MachineBasicBlock *BB) const;
518 MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr &MI,
519 MachineBasicBlock *BB,
520 unsigned Size) const;
521 MachineBasicBlock *emitAtomicCmpSwap(MachineInstr &MI,
522 MachineBasicBlock *BB) const;
523 MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr &MI,
524 MachineBasicBlock *BB,
525 unsigned Size) const;
526 MachineBasicBlock *emitSEL_D(MachineInstr &MI, MachineBasicBlock *BB) const;
527 MachineBasicBlock *emitPseudoSELECT(MachineInstr &MI, MachineBasicBlock *BB,
528 bool isFPCmp, unsigned Opc) const;
529 MachineBasicBlock *emitPseudoD_SELECT(MachineInstr &MI,
530 MachineBasicBlock *BB) const;
531 MachineBasicBlock *emitLDR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
532 MachineBasicBlock *emitLDR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
533 MachineBasicBlock *emitSTR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
534 MachineBasicBlock *emitSTR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
535 };
536
537 /// Create MipsTargetLowering objects.
538 const MipsTargetLowering *
540 const MipsSubtarget &STI);
541 const MipsTargetLowering *
543 const MipsSubtarget &STI);
544
545namespace Mips {
546
547FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
548 const TargetLibraryInfo *libInfo);
549
550} // end namespace Mips
551
552} // end namespace llvm
553
554#endif // LLVM_LIB_TARGET_MIPS_MIPSISELLOWERING_H
amdgpu aa AMDGPU Address space based Alias Analysis Wrapper
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Function Alias Analysis Results
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
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static TableGen::Emitter::OptClass< SkeletonEmitter > X("gen-skeleton-class", "Generate example skeleton class")
This file describes how to lower LLVM code to machine code.
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:43
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:66
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:68
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...
Register getExceptionSelectorRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception typeid on entry to a la...
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)
Register getExceptionPointerRegister(const Constant *PersonalityFn) const override
If a physical register, this returns the register that receives the exception address on entry to an ...
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.
SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
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
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo) const override
createFastISel - This method returns a target specific FastISel object, or null if the target does no...
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...
SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG) const
SDValue lowerSTORE(SDValue Op, SelectionDAG &DAG) const
void AdjustInstrPostInstrSelection(MachineInstr &MI, SDNode *Node) const override
This method should be implemented by targets that mark instructions with the 'hasPostISelHook' flag.
virtual void getOpndList(SmallVectorImpl< SDValue > &Ops, std::deque< std::pair< unsigned, SDValue > > &RegsToPass, bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage, 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...
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
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.
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 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 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 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...
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Provides information about what library functions are available for the current target.
const TargetMachine & getTargetMachine() const
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:45
bool isVectorTy() const
True if this is an instance of VectorType.
Definition Type.h:273
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
Definition ISDOpcodes.h:41
@ ADD
Simple integer binary arithmetic operators.
Definition ISDOpcodes.h:259
@ SIGN_EXTEND
Conversion operators.
Definition ISDOpcodes.h:838
@ SHL
Shift and rotation operations.
Definition ISDOpcodes.h:759
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
@ Offset
Definition DWP.cpp:532
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.
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 >
const MipsTargetLowering * createMipsSETargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
#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.