@@ -155,7 +155,7 @@ class X86InstrInfo final : public X86GenInstrInfo {
155155
156156 virtual void anchor ();
157157
158- bool AnalyzeBranchImpl (MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
158+ bool analyzeBranchImpl (MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
159159 MachineBasicBlock *&FBB,
160160 SmallVectorImpl<MachineOperand> &Cond,
161161 SmallVectorImpl<MachineInstr *> &CondBranches,
@@ -417,30 +417,25 @@ class X86InstrInfo final : public X86GenInstrInfo {
417417 // / (or a subreg operand that feeds a store).
418418 bool isSubregFoldable () const override { return true ; }
419419
420- // / foldMemoryOperand - If this target supports it, fold a load or store of
421- // / the specified stack slot into the specified machine instruction for the
422- // / specified operand(s). If this is possible, the target should perform the
423- // / folding and return true, otherwise it should return false. If it folds
424- // / the instruction, it is likely that the MachineInstruction the iterator
425- // / references has been changed.
420+ // / Fold a load or store of the specified stack slot into the specified
421+ // / machine instruction for the specified operand(s). If folding happens, it
422+ // / is likely that the referenced instruction has been changed.
423+ // /
424+ // / \returns true on success.
426425 MachineInstr *
427426 foldMemoryOperandImpl (MachineFunction &MF, MachineInstr &MI,
428427 ArrayRef<unsigned > Ops,
429428 MachineBasicBlock::iterator InsertPt, int FrameIndex,
430429 LiveIntervals *LIS = nullptr ,
431430 VirtRegMap *VRM = nullptr ) const override ;
432431
433- // / foldMemoryOperand - Same as the previous version except it allows folding
434- // / of any load and store from / to any address, not just from a specific
435- // / stack slot.
432+ // / Same as the previous version except it allows folding of any load and
433+ // / store from / to any address, not just from a specific stack slot.
436434 MachineInstr *foldMemoryOperandImpl (
437435 MachineFunction &MF, MachineInstr &MI, ArrayRef<unsigned > Ops,
438436 MachineBasicBlock::iterator InsertPt, MachineInstr &LoadMI,
439437 LiveIntervals *LIS = nullptr ) const override ;
440438
441- // / unfoldMemoryOperand - Separate a single instruction which folded a load or
442- // / a store or a load and a store into two or more instruction. If this is
443- // / possible, returns true as well as the new instructions by reference.
444439 bool
445440 unfoldMemoryOperand (MachineFunction &MF, MachineInstr &MI, unsigned Reg,
446441 bool UnfoldLoad, bool UnfoldStore,
@@ -449,39 +444,28 @@ class X86InstrInfo final : public X86GenInstrInfo {
449444 bool unfoldMemoryOperand (SelectionDAG &DAG, SDNode *N,
450445 SmallVectorImpl<SDNode *> &NewNodes) const override ;
451446
452- // / getOpcodeAfterMemoryUnfold - Returns the opcode of the would be new
453- // / instruction after load / store are unfolded from an instruction of the
454- // / specified opcode. It returns zero if the specified unfolding is not
455- // / possible. If LoadRegIndex is non-null, it is filled in with the operand
456- // / index of the operand which will hold the register holding the loaded
457- // / value.
458447 unsigned
459448 getOpcodeAfterMemoryUnfold (unsigned Opc, bool UnfoldLoad, bool UnfoldStore,
460449 unsigned *LoadRegIndex = nullptr ) const override ;
461450
462- // / areLoadsFromSameBasePtr - This is used by the pre-regalloc scheduler
463- // / to determine if two loads are loading from the same base address. It
464- // / should only return true if the base pointers are the same and the
465- // / only differences between the two addresses are the offset. It also returns
466- // / the offsets by reference.
467451 bool areLoadsFromSameBasePtr (SDNode *Load1, SDNode *Load2, int64_t &Offset1,
468452 int64_t &Offset2) const override ;
469453
470- // / isSchedulingBoundary - Overrides the isSchedulingBoundary from
471- // / Codegen/TargetInstrInfo.cpp to make it capable of identifying ENDBR
472- // / intructions and prevent it from being re-scheduled.
454+ // / Overrides the isSchedulingBoundary from Codegen/TargetInstrInfo.cpp to
455+ // / make it capable of identifying ENDBR intructions and prevent it from being
456+ // / re-scheduled.
473457 bool isSchedulingBoundary (const MachineInstr &MI,
474458 const MachineBasicBlock *MBB,
475459 const MachineFunction &MF) const override ;
476460
477- // / shouldScheduleLoadsNear - This is a used by the pre-regalloc scheduler to
478- // / determine (in conjunction with areLoadsFromSameBasePtr) if two loads
479- // / should be scheduled togther. On some targets if two loads are loading from
480- // / addresses in the same cache line, it's better if they are scheduled
481- // / together. This function takes two integers that represent the load offsets
482- // / from the common base address. It returns true if it decides it's desirable
483- // / to schedule the two loads together. "NumLoads" is the number of loads that
484- // / have already been scheduled after Load1.
461+ // / This is a used by the pre-regalloc scheduler to determine (in conjunction
462+ // / with areLoadsFromSameBasePtr) if two loads should be scheduled togther. On
463+ // / some targets if two loads are loading from addresses in the same cache
464+ // / line, it's better if they are scheduled together. This function takes two
465+ // / integers that represent the load offsets from the common base address. It
466+ // / returns true if it decides it's desirable to schedule the two loads
467+ // / together. "NumLoads" is the number of loads that have already been
468+ // / scheduled after Load1.
485469 bool shouldScheduleLoadsNear (SDNode *Load1, SDNode *Load2, int64_t Offset1,
486470 int64_t Offset2,
487471 unsigned NumLoads) const override ;
@@ -494,8 +478,6 @@ class X86InstrInfo final : public X86GenInstrInfo {
494478 bool
495479 reverseBranchCondition (SmallVectorImpl<MachineOperand> &Cond) const override ;
496480
497- // / isSafeToMoveRegClassDefs - Return true if it's safe to move a machine
498- // / instruction that defines the specified register class.
499481 bool isSafeToMoveRegClassDefs (const TargetRegisterClass *RC) const override ;
500482
501483 // / True if MI has a condition code def, e.g. EFLAGS, that is
@@ -552,35 +534,22 @@ class X86InstrInfo final : public X86GenInstrInfo {
552534 MachineInstr &NewMI1,
553535 MachineInstr &NewMI2) const override ;
554536
555- // / analyzeCompare - For a comparison instruction, return the source registers
556- // / in SrcReg and SrcReg2 if having two register operands, and the value it
557- // / compares against in CmpValue. Return true if the comparison instruction
558- // / can be analyzed.
559537 bool analyzeCompare (const MachineInstr &MI, Register &SrcReg,
560538 Register &SrcReg2, int64_t &CmpMask,
561539 int64_t &CmpValue) const override ;
562540
563- // / optimizeCompareInstr - Check if there exists an earlier instruction that
564- // / operates on the same source operands and sets flags in the same way as
565- // / Compare; remove Compare if possible.
541+ // / Check if there exists an earlier instruction that operates on the same
542+ // / source operands and sets eflags in the same way as CMP and remove CMP if
543+ // / possible.
566544 bool optimizeCompareInstr (MachineInstr &CmpInstr, Register SrcReg,
567545 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
568546 const MachineRegisterInfo *MRI) const override ;
569547
570- // / optimizeLoadInstr - Try to remove the load by folding it to a register
571- // / operand at the use. We fold the load instructions if and only if the
572- // / def and use are in the same BB. We only look at one load and see
573- // / whether it can be folded into MI. FoldAsLoadDefReg is the virtual register
574- // / defined by the load we are trying to fold. DefMI returns the machine
575- // / instruction that defines FoldAsLoadDefReg, and the function returns
576- // / the machine instruction generated due to folding.
577548 MachineInstr *optimizeLoadInstr (MachineInstr &MI,
578549 const MachineRegisterInfo *MRI,
579550 Register &FoldAsLoadDefReg,
580551 MachineInstr *&DefMI) const override ;
581552
582- // / Reg is known to be defined by a move immediate instruction, try to fold
583- // / the immediate into the use instruction.
584553 bool foldImmediate (MachineInstr &UseMI, MachineInstr &DefMI, Register Reg,
585554 MachineRegisterInfo *MRI) const override ;
586555
@@ -624,32 +593,13 @@ class X86InstrInfo final : public X86GenInstrInfo {
624593 describeLoadedValue (const MachineInstr &MI, Register Reg) const override ;
625594
626595protected:
627- // / Commutes the operands in the given instruction by changing the operands
628- // / order and/or changing the instruction's opcode and/or the immediate value
629- // / operand.
630- // /
631- // / The arguments 'CommuteOpIdx1' and 'CommuteOpIdx2' specify the operands
632- // / to be commuted.
633- // /
634- // / Do not call this method for a non-commutable instruction or
635- // / non-commutable operands.
636- // / Even though the instruction is commutable, the method may still
637- // / fail to commute the operands, null pointer is returned in such cases.
638596 MachineInstr *commuteInstructionImpl (MachineInstr &MI, bool NewMI,
639597 unsigned CommuteOpIdx1,
640598 unsigned CommuteOpIdx2) const override ;
641599
642- // / If the specific machine instruction is a instruction that moves/copies
643- // / value from one register to another register return destination and source
644- // / registers as machine operands.
645600 std::optional<DestSourcePair>
646601 isCopyInstrImpl (const MachineInstr &MI) const override ;
647602
648- // / Return true when there is potentially a faster code sequence for an
649- // / instruction chain ending in \p Root. All potential patterns are listed in
650- // / the \p Pattern vector. Pattern should be sorted in priority order since
651- // / the pattern evaluator stops checking as soon as it finds a faster
652- // / sequence.
653603 bool
654604 getMachineCombinerPatterns (MachineInstr &Root,
655605 SmallVectorImpl<MachineCombinerPattern> &Patterns,
0 commit comments