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"
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;
45class MachineInstr;
46class MipsCCState;
48class MipsSubtarget;
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;
293 bool shouldFoldConstantShiftPairToMask(const SDNode *N) const override;
294
295 /// Return the register type for a given MVT, ensuring vectors are treated
296 /// as a series of gpr sized integers.
298 EVT VT) const override;
299
300 /// Return the number of registers for a given MVT, ensuring vectors are
301 /// treated as a series of gpr sized integers.
304 EVT VT) const override;
305
306 /// Break down vectors to the correct number of gpr sized integers.
308 LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
309 unsigned &NumIntermediates, MVT &RegisterVT) const override;
310
311 /// Return the correct alignment for the current calling convention.
313 const DataLayout &DL) const override {
314 const Align ABIAlign = DL.getABITypeAlign(ArgTy);
315 if (ArgTy->isVectorTy())
316 return std::min(ABIAlign, Align(8));
317 return ABIAlign;
318 }
319
321 return ISD::SIGN_EXTEND;
322 }
323
324 /// LowerOperation - Provide custom lowering hooks for some operations.
325 SDValue LowerOperation(SDValue Op, SelectionDAG &DAG) const override;
326
327 /// ReplaceNodeResults - Replace the results of node with an illegal result
328 /// type with new values built out of custom code.
329 ///
331 SelectionDAG &DAG) const override;
332
333 /// getTargetNodeName - This method returns the name of a target specific
334 // DAG node.
335 const char *getTargetNodeName(unsigned Opcode) const override;
336
337 /// getSetCCResultType - get the ISD::SETCC result ValueType
339 EVT VT) const override;
340
341 SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
342
345 MachineBasicBlock *MBB) const override;
346
348 SDNode *Node) const override;
349
350 void HandleByVal(CCState *, unsigned &, Align) const override;
351
352 Register getRegisterByName(const char* RegName, LLT VT,
353 const MachineFunction &MF) const override;
354
355 /// If a physical register, this returns the register that receives the
356 /// exception address on entry to an EH pad.
358 getExceptionPointerRegister(const Constant *PersonalityFn) const override {
359 return ABI.IsN64() ? Mips::A0_64 : Mips::A0;
360 }
361
362 /// If a physical register, this returns the register that receives the
363 /// exception typeid on entry to a landing pad.
365 getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
366 return ABI.IsN64() ? Mips::A1_64 : Mips::A1;
367 }
368
369 bool softPromoteHalfType() const override { return true; }
370
371 bool isJumpTableRelative() const override {
373 }
374
376
378
379 protected:
380 SDValue getGlobalReg(SelectionDAG &DAG, EVT Ty) const;
381
382 // This method creates the following nodes, which are necessary for
383 // computing a local symbol's address:
384 //
385 // (add (load (wrapper $gp, %got(sym)), %lo(sym))
386 template <class NodeTy>
387 SDValue getAddrLocal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
388 bool IsN32OrN64) const {
389 unsigned GOTFlag = IsN32OrN64 ? MipsII::MO_GOT_PAGE : MipsII::MO_GOT;
390 SDValue GOT = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
391 getTargetNode(N, Ty, DAG, GOTFlag));
392 SDValue Load =
393 DAG.getLoad(Ty, DL, DAG.getEntryNode(), GOT,
395 unsigned LoFlag = IsN32OrN64 ? MipsII::MO_GOT_OFST : MipsII::MO_ABS_LO;
396 SDValue Lo = DAG.getNode(MipsISD::Lo, DL, Ty,
397 getTargetNode(N, Ty, DAG, LoFlag));
398 return DAG.getNode(ISD::ADD, DL, Ty, Load, Lo);
399 }
400
401 // This method creates the following nodes, which are necessary for
402 // computing a global symbol's address:
403 //
404 // (load (wrapper $gp, %got(sym)))
405 template <class NodeTy>
406 SDValue getAddrGlobal(NodeTy *N, const SDLoc &DL, EVT Ty, SelectionDAG &DAG,
407 unsigned Flag, SDValue Chain,
408 const MachinePointerInfo &PtrInfo) const {
409 SDValue Tgt = DAG.getNode(MipsISD::Wrapper, DL, Ty, getGlobalReg(DAG, Ty),
410 getTargetNode(N, Ty, DAG, Flag));
411 return DAG.getLoad(Ty, DL, Chain, Tgt, PtrInfo);
412 }
413
414 // This method creates the following nodes, which are necessary for
415 // computing a global symbol's address in large-GOT mode:
416 //
417 // (load (wrapper (add %hi(sym), $gp), %lo(sym)))
418 template <class NodeTy>
420 SelectionDAG &DAG, unsigned HiFlag,
421 unsigned LoFlag, SDValue Chain,
422 const MachinePointerInfo &PtrInfo) const {
424 getTargetNode(N, Ty, DAG, HiFlag));
425 Hi = DAG.getNode(ISD::ADD, DL, Ty, Hi, getGlobalReg(DAG, Ty));
427 getTargetNode(N, Ty, DAG, LoFlag));
428 return DAG.getLoad(Ty, DL, Chain, Wrapper, PtrInfo);
429 }
430
431 // This method creates the following nodes, which are necessary for
432 // computing a symbol's address in non-PIC mode:
433 //
434 // (add %hi(sym), %lo(sym))
435 //
436 // This method covers O32, N32 and N64 in sym32 mode.
437 template <class NodeTy>
438 SDValue getAddrNonPIC(NodeTy *N, const SDLoc &DL, EVT Ty,
439 SelectionDAG &DAG) const {
440 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
441 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
442 return DAG.getNode(ISD::ADD, DL, Ty,
443 DAG.getNode(MipsISD::Hi, DL, Ty, Hi),
444 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
445 }
446
447 // This method creates the following nodes, which are necessary for
448 // computing a symbol's address in non-PIC mode for N64.
449 //
450 // (add (shl (add (shl (add %highest(sym), %higher(sim)), 16), %high(sym)),
451 // 16), %lo(%sym))
452 //
453 // FIXME: This method is not efficent for (micro)MIPS64R6.
454 template <class NodeTy>
455 SDValue getAddrNonPICSym64(NodeTy *N, const SDLoc &DL, EVT Ty,
456 SelectionDAG &DAG) const {
457 SDValue Hi = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI);
458 SDValue Lo = getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO);
459
460 SDValue Highest =
461 DAG.getNode(MipsISD::Highest, DL, Ty,
462 getTargetNode(N, Ty, DAG, MipsII::MO_HIGHEST));
463 SDValue Higher = getTargetNode(N, Ty, DAG, MipsII::MO_HIGHER);
464 SDValue HigherPart =
465 DAG.getNode(ISD::ADD, DL, Ty, Highest,
466 DAG.getNode(MipsISD::Higher, DL, Ty, Higher));
467 SDValue Cst = DAG.getConstant(16, DL, MVT::i32);
468 SDValue Shift = DAG.getNode(ISD::SHL, DL, Ty, HigherPart, Cst);
469 SDValue Add = DAG.getNode(ISD::ADD, DL, Ty, Shift,
470 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
471 SDValue Shift2 = DAG.getNode(ISD::SHL, DL, Ty, Add, Cst);
472
473 return DAG.getNode(ISD::ADD, DL, Ty, Shift2,
474 DAG.getNode(MipsISD::Lo, DL, Ty, Lo));
475 }
476
477 // This method creates the following nodes, which are necessary for
478 // computing a symbol's address using gp-relative addressing:
479 //
480 // (add $gp, %gp_rel(sym))
481 template <class NodeTy>
482 SDValue getAddrGPRel(NodeTy *N, const SDLoc &DL, EVT Ty,
483 SelectionDAG &DAG, bool IsN64) const {
484 SDValue GPRel = getTargetNode(N, Ty, DAG, MipsII::MO_GPREL);
485 return DAG.getNode(
486 ISD::ADD, DL, Ty,
487 DAG.getRegister(IsN64 ? Mips::GP_64 : Mips::GP, Ty),
488 DAG.getNode(MipsISD::GPRel, DL, DAG.getVTList(Ty), GPRel));
489 }
490
491 // This method creates the following nodes, which are necessary for
492 // loading a dllimported symbol:
493 //
494 // (lw (add (shl(%high(sym), 16), %low(sym)))
495 template <class NodeTy>
496 SDValue getDllimportSymbol(NodeTy *N, const SDLoc &DL, EVT Ty,
497 SelectionDAG &DAG) const {
498 SDValue Hi =
499 getTargetNode(N, Ty, DAG, MipsII::MO_ABS_HI | MipsII::MO_DLLIMPORT);
500 SDValue Lo =
501 getTargetNode(N, Ty, DAG, MipsII::MO_ABS_LO | MipsII::MO_DLLIMPORT);
502 return DAG.getNode(ISD::ADD, DL, Ty, DAG.getNode(MipsISD::Lo, DL, Ty, Lo),
503 DAG.getNode(MipsISD::Hi, DL, Ty, Hi));
504 }
505
506 // This method creates the following nodes, which are necessary for
507 // loading a dllimported global variable:
508 //
509 // (lw (lw (add (shl(%high(sym), 16), %low(sym))))
510 template <class NodeTy>
512 SelectionDAG &DAG, SDValue Chain,
513 const MachinePointerInfo &PtrInfo) const {
514 return DAG.getLoad(Ty, DL, Chain, getDllimportSymbol(N, DL, Ty, DAG),
515 PtrInfo);
516 }
517
518 /// This function fills Ops, which is the list of operands that will later
519 /// be used when a function call node is created. It also generates
520 /// copyToReg nodes to set up argument registers.
521 virtual void
523 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
524 bool IsPICCall, bool GlobalOrExternal, bool InternalLinkage,
525 bool IsCallReloc, CallLoweringInfo &CLI, SDValue Callee,
526 SDValue Chain) const;
527
528 protected:
531
532 // Subtarget Info
534 // Cache the ABI from the TargetMachine, we use it everywhere.
536
537 private:
538 // Create a TargetGlobalAddress node.
539 SDValue getTargetNode(GlobalAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
540 unsigned Flag) const;
541
542 // Create a TargetExternalSymbol node.
543 SDValue getTargetNode(ExternalSymbolSDNode *N, EVT Ty, SelectionDAG &DAG,
544 unsigned Flag) const;
545
546 // Create a TargetBlockAddress node.
547 SDValue getTargetNode(BlockAddressSDNode *N, EVT Ty, SelectionDAG &DAG,
548 unsigned Flag) const;
549
550 // Create a TargetJumpTable node.
551 SDValue getTargetNode(JumpTableSDNode *N, EVT Ty, SelectionDAG &DAG,
552 unsigned Flag) const;
553
554 // Create a TargetConstantPool node.
555 SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG,
556 unsigned Flag) const;
557
558 // Lower Operand helpers
559 SDValue LowerCallResult(SDValue Chain, SDValue InGlue,
560 CallingConv::ID CallConv, bool isVarArg,
562 const SDLoc &dl, SelectionDAG &DAG,
565
566 // Lower Operand specifics
567 SDValue lowerBRCOND(SDValue Op, SelectionDAG &DAG) const;
568 SDValue lowerConstantPool(SDValue Op, SelectionDAG &DAG) const;
569 SDValue lowerGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
570 SDValue lowerBlockAddress(SDValue Op, SelectionDAG &DAG) const;
571 SDValue lowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
572 SDValue lowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
573 SDValue lowerSELECT(SDValue Op, SelectionDAG &DAG) const;
574 SDValue lowerSETCC(SDValue Op, SelectionDAG &DAG) const;
575 SDValue lowerVASTART(SDValue Op, SelectionDAG &DAG) const;
576 SDValue lowerVAARG(SDValue Op, SelectionDAG &DAG) const;
577 SDValue lowerFCOPYSIGN(SDValue Op, SelectionDAG &DAG) const;
578 SDValue lowerFABS(SDValue Op, SelectionDAG &DAG) const;
579 SDValue lowerFABS32(SDValue Op, SelectionDAG &DAG,
580 bool HasExtractInsert) const;
581 SDValue lowerFABS64(SDValue Op, SelectionDAG &DAG,
582 bool HasExtractInsert) const;
583 SDValue lowerFCANONICALIZE(SDValue Op, SelectionDAG &DAG) const;
584 SDValue lowerFRAMEADDR(SDValue Op, SelectionDAG &DAG) const;
585 SDValue lowerRETURNADDR(SDValue Op, SelectionDAG &DAG) const;
586 SDValue lowerEH_RETURN(SDValue Op, SelectionDAG &DAG) const;
587 SDValue lowerATOMIC_FENCE(SDValue Op, SelectionDAG& DAG) const;
588 SDValue lowerShiftLeftParts(SDValue Op, SelectionDAG& DAG) const;
589 SDValue lowerShiftRightParts(SDValue Op, SelectionDAG& DAG,
590 bool IsSRA) const;
591 SDValue lowerEH_DWARF_CFA(SDValue Op, SelectionDAG &DAG) const;
592 SDValue lowerFP_TO_SINT(SDValue Op, SelectionDAG &DAG) const;
593 SDValue lowerREADCYCLECOUNTER(SDValue Op, SelectionDAG &DAG) const;
594
595 /// isEligibleForTailCallOptimization - Check whether the call is eligible
596 /// for tail call optimization.
597 virtual bool
598 isEligibleForTailCallOptimization(const CCState &CCInfo,
599 unsigned NextStackOffset,
600 const MipsFunctionInfo &FI) const = 0;
601
602 /// copyByValArg - Copy argument registers which were used to pass a byval
603 /// argument to the stack. Create a stack frame object for the byval
604 /// argument.
605 void copyByValRegs(SDValue Chain, const SDLoc &DL,
606 std::vector<SDValue> &OutChains, SelectionDAG &DAG,
607 const ISD::ArgFlagsTy &Flags,
609 const Argument *FuncArg, unsigned FirstReg,
610 unsigned LastReg, const CCValAssign &VA,
611 MipsCCState &State) const;
612
613 /// passByValArg - Pass a byval argument in registers or on stack.
614 void passByValArg(SDValue Chain, const SDLoc &DL,
615 std::deque<std::pair<unsigned, SDValue>> &RegsToPass,
616 SmallVectorImpl<SDValue> &MemOpChains, SDValue StackPtr,
617 MachineFrameInfo &MFI, SelectionDAG &DAG, SDValue Arg,
618 unsigned FirstReg, unsigned LastReg,
619 const ISD::ArgFlagsTy &Flags, bool isLittle,
620 const CCValAssign &VA) const;
621
622 /// writeVarArgRegs - Write variable function arguments passed in registers
623 /// to the stack. Also create a stack frame object for the first variable
624 /// argument.
625 void writeVarArgRegs(std::vector<SDValue> &OutChains, SDValue Chain,
626 const SDLoc &DL, SelectionDAG &DAG,
627 CCState &State) const;
628
629 SDValue
630 LowerFormalArguments(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
632 const SDLoc &dl, SelectionDAG &DAG,
633 SmallVectorImpl<SDValue> &InVals) const override;
634
635 SDValue passArgOnStack(SDValue StackPtr, unsigned Offset, SDValue Chain,
636 SDValue Arg, const SDLoc &DL, bool IsTailCall,
637 SelectionDAG &DAG) const;
638
640 SmallVectorImpl<SDValue> &InVals) const override;
641
642 bool CanLowerReturn(CallingConv::ID CallConv, MachineFunction &MF,
643 bool isVarArg,
645 LLVMContext &Context, const Type *RetTy) const override;
646
647 SDValue LowerReturn(SDValue Chain, CallingConv::ID CallConv, bool isVarArg,
649 const SmallVectorImpl<SDValue> &OutVals,
650 const SDLoc &dl, SelectionDAG &DAG) const override;
651
652 SDValue LowerInterruptReturn(SmallVectorImpl<SDValue> &RetOps,
653 const SDLoc &DL, SelectionDAG &DAG) const;
654
655 bool shouldSignExtendTypeInLibCall(Type *Ty, bool IsSigned) const override;
656
657 // Inline asm support
658 ConstraintType getConstraintType(StringRef Constraint) const override;
659
660 /// Examine constraint string and operand type and determine a weight value.
661 /// The operand object must already have been set up with the operand type.
662 ConstraintWeight getSingleConstraintMatchWeight(
663 AsmOperandInfo &info, const char *constraint) const override;
664
665 /// This function parses registers that appear in inline-asm constraints.
666 /// It returns pair (0, 0) on failure.
667 std::pair<unsigned, const TargetRegisterClass *>
668 parseRegForInlineAsmConstraint(StringRef C, MVT VT) const;
669
670 std::pair<unsigned, const TargetRegisterClass *>
671 getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
672 StringRef Constraint, MVT VT) const override;
673
674 /// LowerAsmOperandForConstraint - Lower the specified operand into the Ops
675 /// vector. If it is invalid, don't add anything to Ops. If hasMemory is
676 /// true it means one of the asm constraint of the inline asm instruction
677 /// being processed is 'm'.
678 void LowerAsmOperandForConstraint(SDValue Op, StringRef Constraint,
679 std::vector<SDValue> &Ops,
680 SelectionDAG &DAG) const override;
681
683 getInlineAsmMemConstraint(StringRef ConstraintCode) const override {
684 if (ConstraintCode == "o")
686 if (ConstraintCode == "R")
688 if (ConstraintCode == "ZC")
690 return TargetLowering::getInlineAsmMemConstraint(ConstraintCode);
691 }
692
693 bool isLegalAddressingMode(const DataLayout &DL, const AddrMode &AM,
694 Type *Ty, unsigned AS,
695 Instruction *I = nullptr) const override;
696
697 bool isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const override;
698
699 EVT getOptimalMemOpType(LLVMContext &Context, const MemOp &Op,
700 const AttributeList &FuncAttributes) const override;
701
702 /// isFPImmLegal - Returns true if the target can instruction select the
703 /// specified FP immediate natively. If false, the legalizer will
704 /// materialize the FP immediate as a load from a constant pool.
705 bool isFPImmLegal(const APFloat &Imm, EVT VT,
706 bool ForCodeSize) const override;
707
708 bool isLegalICmpImmediate(int64_t Imm) const override;
709 bool isLegalAddImmediate(int64_t Imm) const override;
710
711 unsigned getJumpTableEncoding() const override;
712 SDValue getPICJumpTableRelocBase(SDValue Table,
713 SelectionDAG &DAG) const override;
714 bool useSoftFloat() const override;
715
716 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
717 return true;
718 }
719
720 /// Emit a sign-extension using sll/sra, seb, or seh appropriately.
721 MachineBasicBlock *emitSignExtendToI32InReg(MachineInstr &MI,
722 MachineBasicBlock *BB,
723 unsigned Size, unsigned DstReg,
724 unsigned SrcRec) const;
725
726 MachineBasicBlock *emitAtomicBinary(MachineInstr &MI,
727 MachineBasicBlock *BB) const;
728 MachineBasicBlock *emitAtomicBinaryPartword(MachineInstr &MI,
729 MachineBasicBlock *BB,
730 unsigned Size) const;
731 MachineBasicBlock *emitAtomicCmpSwap(MachineInstr &MI,
732 MachineBasicBlock *BB) const;
733 MachineBasicBlock *emitAtomicCmpSwapPartword(MachineInstr &MI,
734 MachineBasicBlock *BB,
735 unsigned Size) const;
736 MachineBasicBlock *emitSEL_D(MachineInstr &MI, MachineBasicBlock *BB) const;
737 MachineBasicBlock *emitPseudoSELECT(MachineInstr &MI, MachineBasicBlock *BB,
738 bool isFPCmp, unsigned Opc) const;
739 MachineBasicBlock *emitPseudoD_SELECT(MachineInstr &MI,
740 MachineBasicBlock *BB) const;
741 MachineBasicBlock *emitLDR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
742 MachineBasicBlock *emitLDR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
743 MachineBasicBlock *emitSTR_W(MachineInstr &MI, MachineBasicBlock *BB) const;
744 MachineBasicBlock *emitSTR_D(MachineInstr &MI, MachineBasicBlock *BB) const;
745 };
746
747 /// Create MipsTargetLowering objects.
748 const MipsTargetLowering *
750 const MipsSubtarget &STI);
751 const MipsTargetLowering *
753 const MipsSubtarget &STI);
754
755namespace Mips {
756
757FastISel *createFastISel(FunctionLoweringInfo &funcInfo,
758 const TargetLibraryInfo *libInfo);
759
760} // end namespace Mips
761
762} // end namespace llvm
763
764#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:58
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: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: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.
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...
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
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...
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 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
@ BUILTIN_OP_END
BUILTIN_OP_END - This must be the last enum value in this list.
@ SIGN_EXTEND
Conversion operators.
Definition ISDOpcodes.h:826
@ SHL
Shift and rotation operations.
Definition ISDOpcodes.h:756
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:477
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
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.