LLVM 20.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"
29#include "llvm/IR/CallingConv.h"
30#include "llvm/IR/InlineAsm.h"
31#include "llvm/IR/Type.h"
33#include <algorithm>
34#include <deque>
35#include <utility>
36#include <vector>
37
38namespace llvm {
39
40class Argument;
41class FastISel;
42class FunctionLoweringInfo;
43class MachineBasicBlock;
44class MachineFrameInfo;
45class MachineInstr;
46class MipsCCState;
47class MipsFunctionInfo;
48class MipsSubtarget;
49class MipsTargetMachine;
50class TargetLibraryInfo;
51class TargetRegisterClass;
52
53 namespace MipsISD {
54
55 enum NodeType : unsigned {
56 // Start the numbering from where ISD NodeType finishes.
58
59 // Jump and link (call)
61
62 // Tail call
64
65 // Get the Highest (63-48) 16 bits from a 64-bit immediate
67
68 // Get the Higher (47-32) 16 bits from a 64-bit immediate
70
71 // Get the High 16 bits from a 32/64-bit immediate
72 // No relation with Mips Hi register
74
75 // Get the Lower 16 bits from a 32/64-bit immediate
76 // No relation with Mips Lo register
78
79 // Get the High 16 bits from a 32 bit immediate for accessing the GOT.
81
82 // Get the High 16 bits from a 32-bit immediate for accessing TLS.
84
85 // Handle gp_rel (small data/bss sections) relocation.
87
88 // Thread Pointer
90
91 // Vector Floating Point Multiply and Subtract
93
94 // Floating Point Branch Conditional
96
97 // Floating Point Compare
99
100 // Floating point Abs
102
103 // Floating point select
105
106 // Node used to generate an MTC1 i32 to f64 instruction
108
109 // Floating Point Conditional Moves
112
113 // FP-to-int truncation node.
115
116 // Return
118
119 // Interrupt, exception, error trap Return
121
122 // Software Exception Return.
124
125 // Node used to extract integer from accumulator.
128
129 // Node used to insert integers to accumulator.
131
132 // Mult nodes.
135
136 // MAdd/Sub nodes
141
142 // DivRem(u)
147
150
152
154
156
160
161 // EXTR.W intrinsic nodes.
170
171 // DPA.W intrinsic nodes.
194
201
202 // DSP shift nodes.
206
207 // DSP setcc and select_cc nodes.
210
211 // Vector comparisons.
212 // These take a vector and return a boolean.
217
218 // These take a vector and return a vector bitmask.
224
225 // Vector Shuffle with mask as an operand
226 VSHF, // Generic shuffle
227 SHF, // 4-element set shuffle.
228 ILVEV, // Interleave even elements
229 ILVOD, // Interleave odd elements
230 ILVL, // Interleave left elements
231 ILVR, // Interleave right elements
232 PCKEV, // Pack even elements
233 PCKOD, // Pack odd elements
234
235 // Vector Lane Copy
236 INSVE, // Copy element from one vector to another
237
238 // Combined (XOR (OR $a, $b), -1)
240
241 // Extended vector element extraction
244
245 // Double select nodes for machines without conditional-move.
248
249 // Load/Store Left/Right nodes.
260 };
261
262 } // ene namespace MipsISD
263
264 //===--------------------------------------------------------------------===//
265 // TargetLowering Implementation
266 //===--------------------------------------------------------------------===//
267
269 bool isMicroMips;
270
271 public:
272 explicit MipsTargetLowering(const MipsTargetMachine &TM,
273 const MipsSubtarget &STI);
274
275 static const MipsTargetLowering *create(const MipsTargetMachine &TM,
276 const MipsSubtarget &STI);
277
278 /// createFastISel - This method returns a target specific FastISel object,
279 /// or null if the target does not support "fast" ISel.
281 const TargetLibraryInfo *libInfo) const override;
282
283 MVT getScalarShiftAmountTy(const DataLayout &, EVT) const override {
284 return MVT::i32;
285 }
286
288 ISD::NodeType) const override;
289
290 bool isCheapToSpeculateCttz(Type *Ty) const override;
291 bool isCheapToSpeculateCtlz(Type *Ty) const override;
292 bool hasBitTest(SDValue X, SDValue Y) const override;
294 CombineLevel Level) const override;
295
296 /// Return the register type for a given MVT, ensuring vectors are treated
297 /// as a series of gpr sized integers.
299 EVT VT) const override;
300
301 /// Return the number of registers for a given MVT, ensuring vectors are
302 /// treated as a series of gpr sized integers.
305 EVT VT) const override;
306
307 /// Break down vectors to the correct number of gpr sized integers.
309 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
310 unsigned &NumIntermediates, MVT &RegisterVT) const override;
311
312 /// Return the correct alignment for the current calling convention.
314 const DataLayout &DL) const override {
315 const Align ABIAlign = DL.getABITypeAlign(ArgTy);
316 if (ArgTy->isVectorTy())
317 return std::min(ABIAlign, Align(8));
318 return ABIAlign;
319 }
320
322 return ISD::SIGN_EXTEND;
323 }
324
325 /// LowerOperation - Provide custom lowering hooks for some operations.
326 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
327
328 /// ReplaceNodeResults - Replace the results of node with an illegal result
329 /// type with new values built out of custom code.
330 ///
332 SelectionDAG &DAG) const override;
333
334 /// getTargetNodeName - This method returns the name of a target specific
335 // DAG node.
336 const char *getTargetNodeName(unsigned Opcode) const override;
337
338 /// getSetCCResultType - get the ISD::SETCC result ValueType
340 EVT VT) const override;
341
342 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
343
346 MachineBasicBlock *MBB) const override;
347
349 SDNode *Node) const override;
350
351 void HandleByVal(CCState *, unsigned &, Align) const override;
352
353 Register getRegisterByName(const char* RegName, LLT VT,
354 const MachineFunction &MF) const override;
355
356 /// If a physical register, this returns the register that receives the
357 /// exception address on entry to an EH pad.
359 getExceptionPointerRegister(const Constant *PersonalityFn) const override {
360 return ABI.IsN64() ? Mips::A0_64 : Mips::A0;
361 }
362
363 /// If a physical register, this returns the register that receives the
364 /// exception typeid on entry to a landing pad.
366 getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
367 return ABI.IsN64() ? Mips::A1_64 : Mips::A1;
368 }
369
370 bool softPromoteHalfType() const override { return true; }
371
372 bool isJumpTableRelative() const override {
374 }
375
377
379
380 protected:
381 SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;
382
383 // This method creates the following nodes, which are necessary for
384 // computing a local symbol's address:
385 //
386 // (add (load (wrapper $gp, %got(sym)), %lo(sym))
387 template <class NodeTy>
388 SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
389 bool IsN32OrN64) const {
390 unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
391 SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
392 getTargetNode(N, Ty, DAG, GOTFlag));
393 SDValue Load =
394 DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
396 unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
397 SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
398 getTargetNode(N, Ty, DAG, LoFlag));
399 return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
400 }
401
402 // This method creates the following nodes, which are necessary for
403 // computing a global symbol's address:
404 //
405 // (load (wrapper $gp, %got(sym)))
406 template <class NodeTy>
407 SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
408 unsigned Flag, SDValue Chain,
409 const MachinePointerInfo &PtrInfo) const {
410 SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
411 getTargetNode(N, Ty, DAG, Flag));
412 return DAG.getLoad(Ty, DL, Chain, Tgt, PtrInfo);
413 }
414
415 // This method creates the following nodes, which are necessary for
416 // computing a global symbol's address in large-GOT mode:
417 //
418 // (load (wrapper (add %hi(sym), $gp), %lo(sym)))
419 template <class NodeTy>
421 SelectionDAG &DAG, unsigned HiFlag,
422 unsigned LoFlag, SDValue Chain,
423 const MachinePointerInfo &PtrInfo) const {
425 getTargetNode(N, Ty, DAG, HiFlag));
426 Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, getGlobalReg(DAG, Ty));
428 getTargetNode(N, Ty, DAG, LoFlag));
429 return DAG.getLoad(Ty, DL, Chain, Wrapper, PtrInfo);
430 }
431
432 // This method creates the following nodes, which are necessary for
433 // computing a symbol's address in non-PIC mode:
434 //
435 // (add %hi(sym), %lo(sym))
436 //
437 // This method covers O32, N32 and N64 in sym32 mode.
438 template <class NodeTy>
439 SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty,
440 SelectionDAG &DAG) const {
441 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
442 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
443 return DAG.getNode(ISD::ADD, DL, Ty,
444 DAG.getNode(MipsISD::Hi, DL, Ty, Hi),
445 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
446 }
447
448 // This method creates the following nodes, which are necessary for
449 // computing a symbol's address in non-PIC mode for N64.
450 //
451 // (add (shl (add (shl (add %highest(sym), %higher(sim)), 16), %high(sym)),
452 // 16), %lo(%sym))
453 //
454 // FIXME: This method is not efficent for (micro)MIPS64R6.
455 template <class NodeTy>
456 SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty,
457 SelectionDAG &DAG) const {
458 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
459 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
460
461 SDValue Highest =
462 DAG.getNode(MipsISD::Highest, DL, Ty,
463 getTargetNode(N, Ty, DAG, MipsII::MO_HIGHEST));
464 SDValue Higher = getTargetNode(N, Ty, DAG, MipsII::MO_HIGHER);
465 SDValue HigherPart =
466 DAG.getNode(ISD::ADD, DL, Ty, Highest,
467 DAG.getNode(MipsISD::Higher, DL, Ty, Higher));
468 SDValue Cst = DAG.getConstant(16, DL, MVT::i32);
469 SDValue Shift = DAG.getNode(ISD::SHL, DL, Ty, HigherPart, Cst);
470 SDValue Add = DAG.getNode(ISD::ADD, DL, Ty, Shift,
471 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
472 SDValue Shift2 = DAG.getNode(ISD::SHL, DL, Ty, Add, Cst);
473
474 return DAG.getNode(ISD::ADD, DL, Ty, Shift2,
475 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
476 }
477
478 // This method creates the following nodes, which are necessary for
479 // computing a symbol's address using gp-relative addressing:
480 //
481 // (add $gp, %gp_rel(sym))
482 template <class NodeTy>
483 SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty,
484 SelectionDAG &DAG, bool IsN64) const {
485 SDValue GPRel = getTargetNode(N, Ty, DAG, MipsII::MO_GPREL);
486 return DAG.getNode(
487 ISD::ADD, DL, Ty,
488 DAG.getRegister(IsN64 ? Mips::GP_64 : Mips::GP, Ty),
489 DAG.getNode(MipsISD::GPRel, DL, DAG.getVTList(Ty), GPRel));
490 }
491
492 /// This function fills Ops, which is the list of operands that will later
493 /// be used when a function call node is created. It also generates
494 /// copyToReg nodes to set up argument registers.
495 virtual void
497 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
498 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
499 bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee,
500 SDValue Chain) const;
501
502 protected:
505
506 // Subtarget Info
508 // Cache the ABI from the TargetMachine, we use it everywhere.
510
511 private:
512 // Create a TargetGlobalAddress node.
513 SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
514 unsigned Flag) const;
515
516 // Create a TargetExternalSymbol node.
517 SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG,
518 unsigned Flag) const;
519
520 // Create a TargetBlockAddress node.
521 SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
522 unsigned Flag) const;
523
524 // Create a TargetJumpTable node.
525 SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,
526 unsigned Flag) const;
527
528 // Create a TargetConstantPool node.
529 SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,
530 unsigned Flag) const;
531
532 // Lower Operand helpers
533 SDValue LowerCallResult(SDValue Chain, SDValue InGlue,
534 CallingConv::ID CallConv, bool isVarArg,
536 const SDLoc &dl, SelectionDAG &DAG,
539
540 // Lower Operand specifics
541 SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
542 SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
543 SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
544 SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
545 SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
546 SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
547 SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const;
548 SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
549 SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
550 SDValue lowerVAARG(SDValue Op, SelectionDAG &DAG) const;
551 SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
552 SDValue lowerFABS(SDValue Op, SelectionDAG &DAG) const;
553 SDValue lowerFABS32(SDValue Op, SelectionDAG &DAG,
554 bool HasExtractInsert) const;
555 SDValue lowerFABS64(SDValue Op, SelectionDAG &DAG,
556 bool HasExtractInsert) const;
557 SDValue lowerFCANONICALIZE(SDValue Op, SelectionDAG &DAG) const;
558 SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
559 SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
560 SDValue lowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
561 SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const;
562 SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG& DAG) const;
563 SDValue lowerShiftRightParts(SDValue Op, SelectionDAG& DAG,
564 bool IsSRA) const;
565 SDValue lowerEH_DWARF_CFA(SDValue Op, SelectionDAG &DAG) const;
566 SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const;
567
568 /// isEligibleForTailCallOptimization - Check whether the call is eligible
569 /// for tail call optimization.
570 virtual bool
571 isEligibleForTailCallOptimization(const CCState &CCInfo,
572 unsigned NextStackOffset,
573 const MipsFunctionInfo &FI) const = 0;
574
575 /// copyByValArg - Copy argument registers which were used to pass a byval
576 /// argument to the stack. Create a stack frame object for the byval
577 /// argument.
578 void copyByValRegs(SDValue Chain, const SDLoc &DL,
579 std::vector<SDValue> &OutChains, SelectionDAG &DAG,
580 const ISD::ArgFlagsTy &Flags,
582 const Argument *FuncArg, unsigned FirstReg,
583 unsigned LastReg, const CCValAssign &VA,
584 MipsCCState &State) const;
585
586 /// passByValArg - Pass a byval argument in registers or on stack.
587 void passByValArg(SDValue Chain, const SDLoc &DL,
588 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
589 SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
590 MachineFrameInfo &MFI, SelectionDAG &DAG, SDValue Arg,
591 unsigned FirstReg, unsigned LastReg,
592 const ISD::ArgFlagsTy &Flags, bool isLittle,
593 const CCValAssign &VA) const;
594
595 /// writeVarArgRegs - Write variable function arguments passed in registers
596 /// to the stack. Also create a stack frame object for the first variable
597 /// argument.
598 void writeVarArgRegs(std::vector<SDValue> &OutChains, SDValue Chain,
599 const SDLoc &DL, SelectionDAG &DAG,
600 CCState &State) const;
601
602 SDValue
603 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
605 const SDLoc &dl, SelectionDAG &DAG,
606 SmallVectorImpl<SDValue> &InVals) const override;
607
608 SDValue passArgOnStack(SDValue StackPtr, unsigned Offset, SDValue Chain,
609 SDValue Arg, const SDLoc &DL, bool IsTailCall,
610 SelectionDAG &DAG) const;
611
613 SmallVectorImpl<SDValue> &InVals) const override;
614
615 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
616 bool isVarArg,
618 LLVMContext &Context) const override;
619
620 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
622 const SmallVectorImpl<SDValue> &OutVals,
623 const SDLoc &dl, SelectionDAG &DAG) const override;
624
625 SDValue LowerInterruptReturn(SmallVectorImpl<SDValue> &RetOps,
626 const SDLoc &DL, SelectionDAG &DAG) const;
627
628 bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override;
629
630 // Inline asm support
631 ConstraintType getConstraintType(StringRef Constraint) const override;
632
633 /// Examine constraint string and operand type and determine a weight value.
634 /// The operand object must already have been set up with the operand type.
635 ConstraintWeight getSingleConstraintMatchWeight(
636 AsmOperandInfo &info, const char *constraint) const override;
637
638 /// This function parses registers that appear in inline-asm constraints.
639 /// It returns pair (0, 0) on failure.
640 std::pair<unsigned, const TargetRegisterClass *>
641 parseRegForInlineAsmConstraint(StringRef C, MVT VT) const;
642
643 std::pair<unsigned, const TargetRegisterClass *>
644 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
645 StringRef Constraint, MVT VT) const override;
646
647 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
648 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is
649 /// true it means one of the asm constraint of the inline asm instruction
650 /// being processed is 'm'.
651 void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,
652 std::vector<SDValue> &Ops,
653 SelectionDAG &DAG) const override;
654
656 getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
657 if (ConstraintCode == "o")
659 if (ConstraintCode == "R")
661 if (ConstraintCode == "ZC")
663 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
664 }
665
666 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM,
667 Type *Ty, unsigned AS,
668 Instruction *I = nullptr) const override;
669
670 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
671
672 EVT getOptimalMemOpType(const MemOp &Op,
673 const AttributeList &FuncAttributes) const override;
674
675 /// isFPImmLegal - Returns true if the target can instruction select the
676 /// specified FP immediate natively. If false, the legalizer will
677 /// materialize the FP immediate as a load from a constant pool.
678 bool isFPImmLegal(const APFloat &Imm, EVT VT,
679 bool ForCodeSize) const override;
680
681 unsigned getJumpTableEncoding() const override;
682 bool useSoftFloat() const override;
683
684 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
685 return true;
686 }
687
688 /// Emit a sign-extension using sll/sra, seb, or seh appropriately.
689 MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr &MI,
690 MachineBasicBlock *BB,
691 unsigned Size, unsigned DstReg,
692 unsigned SrcRec) const;
693
694 MachineBasicBlock *emitAtomicBinary(MachineInstr &MI,
695 MachineBasicBlock *BB) const;
696 MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr &MI,
697 MachineBasicBlock *BB,
698 unsigned Size) const;
699 MachineBasicBlock *emitAtomicCmpSwap(MachineInstr &MI,
700 MachineBasicBlock *BB) const;
701 MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr &MI,
702 MachineBasicBlock *BB,
703 unsigned Size) const;
704 MachineBasicBlock *emitSEL_D(MachineInstr &MI, MachineBasicBlock *BB) const;
705 MachineBasicBlock *emitPseudoSELECT(MachineInstr &MI, MachineBasicBlock *BB,
706 bool isFPCmp, unsigned Opc) const;
707 MachineBasicBlock *emitPseudoD_SELECT(MachineInstr &MI,
708 MachineBasicBlock *BB) const;
709 MachineBasicBlock *emitLDR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
710 MachineBasicBlock *emitLDR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
711 MachineBasicBlock *emitSTR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
712 MachineBasicBlock *emitSTR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
713 };
714
715 /// Create MipsTargetLowering objects.
716 const MipsTargetLowering *
717 createMips16TargetLowering(const MipsTargetMachine &TM,
718 const MipsSubtarget &STI);
719 const MipsTargetLowering *
720 createMipsSETargetLowering(const MipsTargetMachine &TM,
721 const MipsSubtarget &STI);
722
723namespace Mips {
724
725FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
726 const TargetLibraryInfo *libInfo);
727
728} // end namespace Mips
729
730} // end namespace llvm
731
732#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
uint64_t Size
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
IRTranslator LLVM IR MI
#define RegName(no)
lazy value info
#define I(x, y, z)
Definition: MD5.cpp:58
unsigned const TargetRegisterInfo * TRI
static GCMetadataPrinterRegistry::Add< OcamlGCMetadataPrinter > Y("ocaml", "ocaml 3.10-compatible collector")
This file describes how to lower LLVM code to machine code.
This class represents an incoming formal argument to a Function.
Definition: Argument.h:31
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:42
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
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:67
Machine Value Type.
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Representation of each machine instruction.
Definition: MachineInstr.h:69
bool IsN64() const
Definition: MipsABIInfo.h:42
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.
const char * getTargetNodeName(unsigned Opcode) const override
getTargetNodeName - This method returns the name of a target specific
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...
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 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...
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.
bool shouldFoldConstantShiftPairToMask(const SDNode *N, CombineLevel Level) const override
Return true if it is profitable to fold a pair of shifts into a mask.
SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG, bool IsN32OrN64) const
bool softPromoteHalfType() const override
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:19
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...
Definition: SelectionDAG.h:228
SDVTList getVTList(EVT VT)
Return an SDVTList that represents the list of values specified.
SDValue getRegister(Register Reg, EVT VT)
SDValue getLoad(EVT VT, const SDLoc &dl, SDValue Chain, SDValue Ptr, MachinePointerInfo PtrInfo, MaybeAlign Alignment=MaybeAlign(), MachineMemOperand::Flags MMOFlags=MachineMemOperand::MONone, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr)
Loads are not normal binary operators: their result type is not determined by their operands,...
SDValue getConstant(uint64_t Val, const SDLoc &DL, EVT VT, bool isTarget=false, bool isOpaque=false)
Create a ConstantSDNode wrapping a constant value.
SDValue getNode(unsigned Opcode, const SDLoc &DL, EVT VT, ArrayRef< SDUse > Ops)
Gets or creates the specified node.
MachineFunction & getMachineFunction() const
Definition: SelectionDAG.h:490
SDValue getEntryNode() const
Return the token chain corresponding to the entry of the function.
Definition: SelectionDAG.h:578
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Provides information about what library functions are available for the current target.
const TargetMachine & getTargetMachine() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
virtual InlineAsm::ConstraintCode getInlineAsmMemConstraint(StringRef ConstraintCode) const
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:270
@ 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:40
@ ADD
Simple integer binary arithmetic operators.
Definition: ISDOpcodes.h:246
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
Definition: ISDOpcodes.h:1490
@ SIGN_EXTEND
Conversion operators.
Definition: ISDOpcodes.h:805
@ SHL
Shift and rotation operations.
Definition: ISDOpcodes.h:735
@ MO_GOT
MO_GOT - Represents the offset into the global offset table at which the address the relocation entry...
Definition: MipsBaseInfo.h:38
@ MO_ABS_HI
MO_ABS_HI/LO - Represents the hi or low part of an absolute symbol address.
Definition: MipsBaseInfo.h:52
@ MO_GPREL
MO_GPREL - Represents the offset from the current gp value to be used for the relocatable object file...
Definition: MipsBaseInfo.h:48
@ MO_HIGHER
MO_HIGHER/HIGHEST - Represents the highest or higher half word of a 64-bit symbol address.
Definition: MipsBaseInfo.h:85
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:480
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.
CombineLevel
Definition: DAGCombine.h:15
const MipsTargetLowering * createMips16TargetLowering(const MipsTargetMachine &TM, const MipsSubtarget &STI)
Create MipsTargetLowering objects.
@ Add
Sum of integers.
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 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.