LLVM 22.0.0git
X86InstrInfo.h
Go to the documentation of this file.
1//===-- X86InstrInfo.h - X86 Instruction Information ------------*- 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 contains the X86 implementation of the TargetInstrInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_X86_X86INSTRINFO_H
14#define LLVM_LIB_TARGET_X86_X86INSTRINFO_H
15
17#include "X86InstrFMA3Info.h"
18#include "X86RegisterInfo.h"
21#include <vector>
22
23#define GET_INSTRINFO_HEADER
24#include "X86GenInstrInfo.inc"
25
26namespace llvm {
27class X86Subtarget;
28
29// X86 MachineCombiner patterns
34
35namespace X86 {
36
38 // For instr that was compressed from EVEX to LEGACY.
40 // For instr that was compressed from EVEX to VEX.
42 // For instr that was compressed from EVEX to EVEX.
44};
45
46/// Return a pair of condition code for the given predicate and whether
47/// the instruction operands should be swaped to match the condition code.
48std::pair<CondCode, bool> getX86ConditionCode(CmpInst::Predicate Predicate);
49
50/// Return a cmov opcode for the given register size in bytes, and operand type.
51unsigned getCMovOpcode(unsigned RegBytes, bool HasMemoryOperand = false,
52 bool HasNDD = false);
53
54/// Return the source operand # for condition code by \p MCID. If the
55/// instruction doesn't have a condition code, return -1.
57
58/// Return the condition code of the instruction. If the instruction doesn't
59/// have a condition code, return X86::COND_INVALID.
60CondCode getCondFromMI(const MachineInstr &MI);
61
62// Turn JCC instruction into condition code.
63CondCode getCondFromBranch(const MachineInstr &MI);
64
65// Turn SETCC instruction into condition code.
66CondCode getCondFromSETCC(const MachineInstr &MI);
67
68// Turn CMOV instruction into condition code.
69CondCode getCondFromCMov(const MachineInstr &MI);
70
71// Turn CFCMOV instruction into condition code.
72CondCode getCondFromCFCMov(const MachineInstr &MI);
73
74// Turn CCMP instruction into condition code.
75CondCode getCondFromCCMP(const MachineInstr &MI);
76
77// Turn condition code into condition flags for CCMP/CTEST.
78int getCCMPCondFlagsFromCondCode(CondCode CC);
79
80// Get the opcode of corresponding NF variant.
81unsigned getNFVariant(unsigned Opc);
82
83// Get the opcode of corresponding NonND variant.
84unsigned getNonNDVariant(unsigned Opc);
85
86/// GetOppositeBranchCondition - Return the inverse of the specified cond,
87/// e.g. turning COND_E to COND_NE.
88CondCode GetOppositeBranchCondition(CondCode CC);
89
90/// Get the VPCMP immediate for the given condition.
92
93/// Get the VPCMP immediate if the opcodes are swapped.
94unsigned getSwappedVPCMPImm(unsigned Imm);
95
96/// Get the VPCOM immediate if the opcodes are swapped.
97unsigned getSwappedVPCOMImm(unsigned Imm);
98
99/// Get the VCMP immediate if the opcodes are swapped.
100unsigned getSwappedVCMPImm(unsigned Imm);
101
102/// Get the width of the vector register operand.
104
105/// Check if the instruction is X87 instruction.
107
108/// Return the index of the instruction's first address operand, if it has a
109/// memory reference, or -1 if it has none. Unlike X86II::getMemoryOperandNo(),
110/// this also works for both pseudo instructions (e.g., TCRETURNmi) as well as
111/// real instructions (e.g., JMP64m).
113
114/// Find any constant pool entry associated with a specific instruction operand.
115const Constant *getConstantFromPool(const MachineInstr &MI, unsigned OpNo);
116
117} // namespace X86
118
119/// isGlobalStubReference - Return true if the specified TargetFlag operand is
120/// a reference to a stub for a global, not the global itself.
121inline static bool isGlobalStubReference(unsigned char TargetFlag) {
122 switch (TargetFlag) {
123 case X86II::MO_DLLIMPORT: // dllimport stub.
124 case X86II::MO_GOTPCREL: // rip-relative GOT reference.
125 case X86II::MO_GOTPCREL_NORELAX: // rip-relative GOT reference.
126 case X86II::MO_GOT: // normal GOT reference.
127 case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Normal $non_lazy_ptr ref.
128 case X86II::MO_DARWIN_NONLAZY: // Normal $non_lazy_ptr ref.
129 case X86II::MO_COFFSTUB: // COFF .refptr stub.
130 return true;
131 default:
132 return false;
133 }
134}
135
136/// isGlobalRelativeToPICBase - Return true if the specified global value
137/// reference is relative to a 32-bit PIC base (X86ISD::GlobalBaseReg). If this
138/// is true, the addressing mode has the PIC base register added in (e.g. EBX).
139inline static bool isGlobalRelativeToPICBase(unsigned char TargetFlag) {
140 switch (TargetFlag) {
141 case X86II::MO_GOTOFF: // isPICStyleGOT: local global.
142 case X86II::MO_GOT: // isPICStyleGOT: other global.
143 case X86II::MO_PIC_BASE_OFFSET: // Darwin local global.
144 case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Darwin/32 external global.
145 case X86II::MO_TLVP: // ??? Pretty sure..
146 return true;
147 default:
148 return false;
149 }
150}
151
152inline static bool isScale(const MachineOperand &MO) {
153 return MO.isImm() && (MO.getImm() == 1 || MO.getImm() == 2 ||
154 MO.getImm() == 4 || MO.getImm() == 8);
155}
156
157inline static bool isLeaMem(const MachineInstr &MI, unsigned Op) {
158 if (MI.getOperand(Op).isFI())
159 return true;
160 return Op + X86::AddrSegmentReg <= MI.getNumOperands() &&
161 MI.getOperand(Op + X86::AddrBaseReg).isReg() &&
162 isScale(MI.getOperand(Op + X86::AddrScaleAmt)) &&
163 MI.getOperand(Op + X86::AddrIndexReg).isReg() &&
164 (MI.getOperand(Op + X86::AddrDisp).isImm() ||
165 MI.getOperand(Op + X86::AddrDisp).isGlobal() ||
166 MI.getOperand(Op + X86::AddrDisp).isCPI() ||
167 MI.getOperand(Op + X86::AddrDisp).isJTI());
168}
169
170inline static bool isMem(const MachineInstr &MI, unsigned Op) {
171 if (MI.getOperand(Op).isFI())
172 return true;
173 return Op + X86::AddrNumOperands <= MI.getNumOperands() &&
174 MI.getOperand(Op + X86::AddrSegmentReg).isReg() && isLeaMem(MI, Op);
175}
176
177inline static bool isAddMemInstrWithRelocation(const MachineInstr &MI) {
178 unsigned Op = MI.getOpcode();
179 if (Op == X86::ADD64rm || Op == X86::ADD64mr_ND || Op == X86::ADD64rm_ND) {
180 int MemOpNo = X86II::getMemoryOperandNo(MI.getDesc().TSFlags) +
181 X86II::getOperandBias(MI.getDesc());
182 const MachineOperand &MO = MI.getOperand(X86::AddrDisp + MemOpNo);
184 return true;
185 }
186
187 return false;
188}
189
190inline static bool isMemInstrWithGOTPCREL(const MachineInstr &MI) {
191 unsigned Op = MI.getOpcode();
192 switch (Op) {
193 case X86::TEST32mr:
194 case X86::TEST64mr:
195 case X86::CMP32rm:
196 case X86::CMP64rm:
197 case X86::MOV32rm:
198 case X86::MOV64rm:
199 case X86::ADC32rm:
200 case X86::ADD32rm:
201 case X86::AND32rm:
202 case X86::OR32rm:
203 case X86::SBB32rm:
204 case X86::SUB32rm:
205 case X86::XOR32rm:
206 case X86::ADC64rm:
207 case X86::ADD64rm:
208 case X86::AND64rm:
209 case X86::OR64rm:
210 case X86::SBB64rm:
211 case X86::SUB64rm:
212 case X86::XOR64rm: {
213 int MemOpNo = X86II::getMemoryOperandNo(MI.getDesc().TSFlags) +
214 X86II::getOperandBias(MI.getDesc());
215 const MachineOperand &MO = MI.getOperand(X86::AddrDisp + MemOpNo);
217 return true;
218 break;
219 }
220 }
221 return false;
222}
223
224class X86InstrInfo final : public X86GenInstrInfo {
225 const X86Subtarget &Subtarget;
226 const X86RegisterInfo RI;
227
229
230 bool analyzeBranchImpl(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
231 MachineBasicBlock *&FBB,
234 bool AllowModify) const;
235
236 bool foldImmediateImpl(MachineInstr &UseMI, MachineInstr *DefMI, Register Reg,
237 int64_t ImmVal, MachineRegisterInfo *MRI,
238 bool MakeChange) const;
239
240public:
241 explicit X86InstrInfo(const X86Subtarget &STI);
242
243 /// Given a machine instruction descriptor, returns the register
244 /// class constraint for OpNum, or NULL. Returned register class
245 /// may be different from the definition in the TD file, e.g.
246 /// GR*RegClass (definition in TD file)
247 /// ->
248 /// GR*_NOREX2RegClass (Returned register class)
249 const TargetRegisterClass *
250 getRegClass(const MCInstrDesc &MCID, unsigned OpNum,
251 const TargetRegisterInfo *TRI) const override;
252
253 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
254 /// such, whenever a client has an instance of instruction info, it should
255 /// always be able to get register info as well (through this method).
256 ///
257 const X86RegisterInfo &getRegisterInfo() const { return RI; }
258
259 /// Returns the stack pointer adjustment that happens inside the frame
260 /// setup..destroy sequence (e.g. by pushes, or inside the callee).
261 int64_t getFrameAdjustment(const MachineInstr &I) const {
262 assert(isFrameInstr(I));
263 if (isFrameSetup(I))
264 return I.getOperand(2).getImm();
265 return I.getOperand(1).getImm();
266 }
267
268 /// Sets the stack pointer adjustment made inside the frame made up by this
269 /// instruction.
270 void setFrameAdjustment(MachineInstr &I, int64_t V) const {
271 assert(isFrameInstr(I));
272 if (isFrameSetup(I))
273 I.getOperand(2).setImm(V);
274 else
275 I.getOperand(1).setImm(V);
276 }
277
278 /// getSPAdjust - This returns the stack pointer adjustment made by
279 /// this instruction. For x86, we need to handle more complex call
280 /// sequences involving PUSHes.
281 int getSPAdjust(const MachineInstr &MI) const override;
282
283 /// isCoalescableExtInstr - Return true if the instruction is a "coalescable"
284 /// extension instruction. That is, it's like a copy where it's legal for the
285 /// source to overlap the destination. e.g. X86::MOVSX64rr32. If this returns
286 /// true, then it's expected the pre-extension value is available as a subreg
287 /// of the result register. This also returns the sub-register index in
288 /// SubIdx.
289 bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg,
290 Register &DstReg, unsigned &SubIdx) const override;
291
292 /// Returns true if the instruction has no behavior (specified or otherwise)
293 /// that is based on the value of any of its register operands
294 ///
295 /// Instructions are considered data invariant even if they set EFLAGS.
296 ///
297 /// A classical example of something that is inherently not data invariant is
298 /// an indirect jump -- the destination is loaded into icache based on the
299 /// bits set in the jump destination register.
300 ///
301 /// FIXME: This should become part of our instruction tables.
302 static bool isDataInvariant(MachineInstr &MI);
303
304 /// Returns true if the instruction has no behavior (specified or otherwise)
305 /// that is based on the value loaded from memory or the value of any
306 /// non-address register operands.
307 ///
308 /// For example, if the latency of the instruction is dependent on the
309 /// particular bits set in any of the registers *or* any of the bits loaded
310 /// from memory.
311 ///
312 /// Instructions are considered data invariant even if they set EFLAGS.
313 ///
314 /// A classical example of something that is inherently not data invariant is
315 /// an indirect jump -- the destination is loaded into icache based on the
316 /// bits set in the jump destination register.
317 ///
318 /// FIXME: This should become part of our instruction tables.
319 static bool isDataInvariantLoad(MachineInstr &MI);
320
322 int &FrameIndex) const override;
324 int &FrameIndex,
325 TypeSize &MemBytes) const override;
326 /// isLoadFromStackSlotPostFE - Check for post-frame ptr elimination
327 /// stack locations as well. This uses a heuristic so it isn't
328 /// reliable for correctness.
330 int &FrameIndex) const override;
331
333 int &FrameIndex) const override;
335 int &FrameIndex,
336 TypeSize &MemBytes) const override;
337 /// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
338 /// stack locations as well. This uses a heuristic so it isn't
339 /// reliable for correctness.
341 int &FrameIndex) const override;
342
343 bool isReallyTriviallyReMaterializable(const MachineInstr &MI) const override;
345 Register DestReg, unsigned SubIdx,
346 const MachineInstr &Orig,
347 const TargetRegisterInfo &TRI) const override;
348
349 /// Given an operand within a MachineInstr, insert preceding code to put it
350 /// into the right format for a particular kind of LEA instruction. This may
351 /// involve using an appropriate super-register instead (with an implicit use
352 /// of the original) or creating a new virtual register and inserting COPY
353 /// instructions to get the data into the right class.
354 ///
355 /// Reference parameters are set to indicate how caller should add this
356 /// operand to the LEA instruction.
358 unsigned LEAOpcode, bool AllowSP, Register &NewSrc,
359 unsigned &NewSrcSubReg, bool &isKill,
360 MachineOperand &ImplicitOp, LiveVariables *LV,
361 LiveIntervals *LIS) const;
362
363 /// convertToThreeAddress - This method must be implemented by targets that
364 /// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
365 /// may be able to convert a two-address instruction into a true
366 /// three-address instruction on demand. This allows the X86 target (for
367 /// example) to convert ADD and SHL instructions into LEA instructions if they
368 /// would require register copies due to two-addressness.
369 ///
370 /// This method returns a null pointer if the transformation cannot be
371 /// performed, otherwise it returns the new instruction.
372 ///
374 LiveIntervals *LIS) const override;
375
376 /// Returns true iff the routine could find two commutable operands in the
377 /// given machine instruction.
378 /// The 'SrcOpIdx1' and 'SrcOpIdx2' are INPUT and OUTPUT arguments. Their
379 /// input values can be re-defined in this method only if the input values
380 /// are not pre-defined, which is designated by the special value
381 /// 'CommuteAnyOperandIndex' assigned to it.
382 /// If both of indices are pre-defined and refer to some operands, then the
383 /// method simply returns true if the corresponding operands are commutable
384 /// and returns false otherwise.
385 ///
386 /// For example, calling this method this way:
387 /// unsigned Op1 = 1, Op2 = CommuteAnyOperandIndex;
388 /// findCommutedOpIndices(MI, Op1, Op2);
389 /// can be interpreted as a query asking to find an operand that would be
390 /// commutable with the operand#1.
391 bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1,
392 unsigned &SrcOpIdx2) const override;
393
394 /// Returns true if we have preference on the operands order in MI, the
395 /// commute decision is returned in Commute.
396 bool hasCommutePreference(MachineInstr &MI, bool &Commute) const override;
397
398 /// Returns an adjusted FMA opcode that must be used in FMA instruction that
399 /// performs the same computations as the given \p MI but which has the
400 /// operands \p SrcOpIdx1 and \p SrcOpIdx2 commuted.
401 /// It may return 0 if it is unsafe to commute the operands.
402 /// Note that a machine instruction (instead of its opcode) is passed as the
403 /// first parameter to make it possible to analyze the instruction's uses and
404 /// commute the first operand of FMA even when it seems unsafe when you look
405 /// at the opcode. For example, it is Ok to commute the first operand of
406 /// VFMADD*SD_Int, if ONLY the lowest 64-bit element of the result is used.
407 ///
408 /// The returned FMA opcode may differ from the opcode in the given \p MI.
409 /// For example, commuting the operands #1 and #3 in the following FMA
410 /// FMA213 #1, #2, #3
411 /// results into instruction with adjusted opcode:
412 /// FMA231 #3, #2, #1
413 unsigned
414 getFMA3OpcodeToCommuteOperands(const MachineInstr &MI, unsigned SrcOpIdx1,
415 unsigned SrcOpIdx2,
416 const X86InstrFMA3Group &FMA3Group) const;
417
418 // Branch analysis.
419 bool isUnconditionalTailCall(const MachineInstr &MI) const override;
421 const MachineInstr &TailCall) const override;
424 const MachineInstr &TailCall) const override;
425
427 MachineBasicBlock *&FBB,
429 bool AllowModify) const override;
430
431 int getJumpTableIndex(const MachineInstr &MI) const override;
432
433 std::optional<ExtAddrMode>
435 const TargetRegisterInfo *TRI) const override;
436
438 int64_t &ImmVal) const override;
439
441 const Register NullValueReg,
442 const TargetRegisterInfo *TRI) const override;
443
445 const MachineInstr &LdSt,
447 bool &OffsetIsScalable, LocationSize &Width,
448 const TargetRegisterInfo *TRI) const override;
451 bool AllowModify = false) const override;
452
454 int *BytesRemoved = nullptr) const override;
457 const DebugLoc &DL,
458 int *BytesAdded = nullptr) const override;
460 Register, Register, Register, int &, int &,
461 int &) const override;
463 const DebugLoc &DL, Register DstReg,
465 Register FalseReg) const override;
467 const DebugLoc &DL, Register DestReg, Register SrcReg,
468 bool KillSrc, bool RenamableDest = false,
469 bool RenamableSrc = false) const override;
472 bool isKill, int FrameIndex, const TargetRegisterClass *RC,
473 const TargetRegisterInfo *TRI, Register VReg,
474 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
475
478 int FrameIndex, const TargetRegisterClass *RC,
479 const TargetRegisterInfo *TRI, Register VReg,
480 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
481
483 unsigned Opc, Register Reg, int FrameIdx,
484 bool isKill = false) const;
485
486 bool expandPostRAPseudo(MachineInstr &MI) const override;
487
488 /// Check whether the target can fold a load that feeds a subreg operand
489 /// (or a subreg operand that feeds a store).
490 bool isSubregFoldable() const override { return true; }
491
492 /// Fold a load or store of the specified stack slot into the specified
493 /// machine instruction for the specified operand(s). If folding happens, it
494 /// is likely that the referenced instruction has been changed.
495 ///
496 /// \returns true on success.
500 MachineBasicBlock::iterator InsertPt, int FrameIndex,
501 LiveIntervals *LIS = nullptr,
502 VirtRegMap *VRM = nullptr) const override;
503
504 /// Same as the previous version except it allows folding of any load and
505 /// store from / to any address, not just from a specific stack slot.
509 LiveIntervals *LIS = nullptr) const override;
510
511 bool
513 bool UnfoldLoad, bool UnfoldStore,
514 SmallVectorImpl<MachineInstr *> &NewMIs) const override;
515
517 SmallVectorImpl<SDNode *> &NewNodes) const override;
518
519 unsigned
520 getOpcodeAfterMemoryUnfold(unsigned Opc, bool UnfoldLoad, bool UnfoldStore,
521 unsigned *LoadRegIndex = nullptr) const override;
522
523 bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, int64_t &Offset1,
524 int64_t &Offset2) const override;
525
526 /// Overrides the isSchedulingBoundary from Codegen/TargetInstrInfo.cpp to
527 /// make it capable of identifying ENDBR intructions and prevent it from being
528 /// re-scheduled.
530 const MachineBasicBlock *MBB,
531 const MachineFunction &MF) const override;
532
533 /// This is a used by the pre-regalloc scheduler to determine (in conjunction
534 /// with areLoadsFromSameBasePtr) if two loads should be scheduled togther. On
535 /// some targets if two loads are loading from addresses in the same cache
536 /// line, it's better if they are scheduled together. This function takes two
537 /// integers that represent the load offsets from the common base address. It
538 /// returns true if it decides it's desirable to schedule the two loads
539 /// together. "NumLoads" is the number of loads that have already been
540 /// scheduled after Load1.
541 bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, int64_t Offset1,
542 int64_t Offset2,
543 unsigned NumLoads) const override;
544
546 MachineBasicBlock::iterator MI) const override;
547
548 MCInst getNop() const override;
549
550 bool
552
553 bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const override;
554
555 /// True if MI has a condition code def, e.g. EFLAGS, that is
556 /// not marked dead.
558
559 /// getGlobalBaseReg - Return a virtual register initialized with the
560 /// the global base register value. Output instructions required to
561 /// initialize the register in the function entry block, if necessary.
562 ///
564
565 std::pair<uint16_t, uint16_t>
566 getExecutionDomain(const MachineInstr &MI) const override;
567
569
570 void setExecutionDomain(MachineInstr &MI, unsigned Domain) const override;
571
572 bool setExecutionDomainCustom(MachineInstr &MI, unsigned Domain) const;
573
574 unsigned
575 getPartialRegUpdateClearance(const MachineInstr &MI, unsigned OpNum,
576 const TargetRegisterInfo *TRI) const override;
577 unsigned getUndefRegClearance(const MachineInstr &MI, unsigned OpNum,
578 const TargetRegisterInfo *TRI) const override;
579 void breakPartialRegDependency(MachineInstr &MI, unsigned OpNum,
580 const TargetRegisterInfo *TRI) const override;
581
583 unsigned OpNum,
586 unsigned Size, Align Alignment,
587 bool AllowCommute) const;
588
589 bool isHighLatencyDef(int opc) const override;
590
591 bool hasHighOperandLatency(const TargetSchedModel &SchedModel,
593 const MachineInstr &DefMI, unsigned DefIdx,
594 const MachineInstr &UseMI,
595 unsigned UseIdx) const override;
596
597 bool useMachineCombiner() const override { return true; }
598
600 bool Invert) const override;
601
602 bool hasReassociableOperands(const MachineInstr &Inst,
603 const MachineBasicBlock *MBB) const override;
604
605 void setSpecialOperandAttr(MachineInstr &OldMI1, MachineInstr &OldMI2,
606 MachineInstr &NewMI1,
607 MachineInstr &NewMI2) const override;
608
609 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
610 Register &SrcReg2, int64_t &CmpMask,
611 int64_t &CmpValue) const override;
612
613 /// Check if there exists an earlier instruction that operates on the same
614 /// source operands and sets eflags in the same way as CMP and remove CMP if
615 /// possible.
616 bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
617 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
618 const MachineRegisterInfo *MRI) const override;
619
621 MachineRegisterInfo *MRI) const override;
622
623 std::pair<unsigned, unsigned>
624 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
625
628
629 std::optional<std::unique_ptr<outliner::OutlinedFunction>>
631 const MachineModuleInfo &MMI,
632 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
633 unsigned MinRepeats) const override;
634
636 bool OutlineFromLinkOnceODRs) const override;
637
640 unsigned Flags) const override;
641
643 const outliner::OutlinedFunction &OF) const override;
644
648 outliner::Candidate &C) const override;
649
652 bool AllowSideEffects = true) const override;
653
655 StringRef &ErrInfo) const override;
656#define GET_INSTRINFO_HELPER_DECLS
657#include "X86GenInstrInfo.inc"
658
659 static bool hasLockPrefix(const MachineInstr &MI) {
660 return MI.getDesc().TSFlags & X86II::LOCK;
661 }
662
663 std::optional<ParamLoadedValue>
664 describeLoadedValue(const MachineInstr &MI, Register Reg) const override;
665
666protected:
668 unsigned CommuteOpIdx1,
669 unsigned CommuteOpIdx2) const override;
670
671 std::optional<DestSourcePair>
672 isCopyInstrImpl(const MachineInstr &MI) const override;
673
676 bool DoRegPressureReduce) const override;
677
678 /// When getMachineCombinerPatterns() finds potential patterns,
679 /// this function generates the instructions that could replace the
680 /// original code sequence.
682 MachineInstr &Root, unsigned Pattern,
685 DenseMap<Register, unsigned> &InstrIdxForVirtReg) const override;
686
687 /// When calculate the latency of the root instruction, accumulate the
688 /// latency of the sequence to the root latency.
689 /// \param Root - Instruction that could be combined with one of its operands
690 /// For X86 instruction (vpmaddwd + vpmaddwd) -> vpdpwssd, the vpmaddwd
691 /// is not in the critical path, so the root latency only include vpmaddwd.
693 return false;
694 }
695
697 int FI) const override;
698
699private:
700 /// This is a helper for convertToThreeAddress for 8 and 16-bit instructions.
701 /// We use 32-bit LEA to form 3-address code by promoting to a 32-bit
702 /// super-register and then truncating back down to a 8/16-bit sub-register.
703 MachineInstr *convertToThreeAddressWithLEA(unsigned MIOpc, MachineInstr &MI,
704 LiveVariables *LV,
705 LiveIntervals *LIS,
706 bool Is8BitOp) const;
707
708 /// Handles memory folding for special case instructions, for instance those
709 /// requiring custom manipulation of the address.
710 MachineInstr *foldMemoryOperandCustom(MachineFunction &MF, MachineInstr &MI,
711 unsigned OpNum,
714 unsigned Size, Align Alignment) const;
715
716 MachineInstr *foldMemoryBroadcast(MachineFunction &MF, MachineInstr &MI,
717 unsigned OpNum,
720 unsigned BitsSize, bool AllowCommute) const;
721
722 /// isFrameOperand - Return true and the FrameIndex if the specified
723 /// operand and follow operands form a reference to the stack frame.
724 bool isFrameOperand(const MachineInstr &MI, unsigned int Op,
725 int &FrameIndex) const;
726
727 /// Returns true iff the routine could find two commutable operands in the
728 /// given machine instruction with 3 vector inputs.
729 /// The 'SrcOpIdx1' and 'SrcOpIdx2' are INPUT and OUTPUT arguments. Their
730 /// input values can be re-defined in this method only if the input values
731 /// are not pre-defined, which is designated by the special value
732 /// 'CommuteAnyOperandIndex' assigned to it.
733 /// If both of indices are pre-defined and refer to some operands, then the
734 /// method simply returns true if the corresponding operands are commutable
735 /// and returns false otherwise.
736 ///
737 /// For example, calling this method this way:
738 /// unsigned Op1 = 1, Op2 = CommuteAnyOperandIndex;
739 /// findThreeSrcCommutedOpIndices(MI, Op1, Op2);
740 /// can be interpreted as a query asking to find an operand that would be
741 /// commutable with the operand#1.
742 ///
743 /// If IsIntrinsic is set, operand 1 will be ignored for commuting.
744 bool findThreeSrcCommutedOpIndices(const MachineInstr &MI,
745 unsigned &SrcOpIdx1,
746 unsigned &SrcOpIdx2,
747 bool IsIntrinsic = false) const;
748
749 /// Returns true when instruction \p FlagI produces the same flags as \p OI.
750 /// The caller should pass in the results of calling analyzeCompare on \p OI:
751 /// \p SrcReg, \p SrcReg2, \p ImmMask, \p ImmValue.
752 /// If the flags match \p OI as if it had the input operands swapped then the
753 /// function succeeds and sets \p IsSwapped to true.
754 ///
755 /// Examples of OI, FlagI pairs returning true:
756 /// CMP %1, 42 and CMP %1, 42
757 /// CMP %1, %2 and %3 = SUB %1, %2
758 /// TEST %1, %1 and %2 = SUB %1, 0
759 /// CMP %1, %2 and %3 = SUB %2, %1 ; IsSwapped=true
760 bool isRedundantFlagInstr(const MachineInstr &FlagI, Register SrcReg,
761 Register SrcReg2, int64_t ImmMask, int64_t ImmValue,
762 const MachineInstr &OI, bool *IsSwapped,
763 int64_t *ImmDelta) const;
764
765 /// Commute operands of \p MI for memory fold.
766 ///
767 /// \param Idx1 the index of operand to be commuted.
768 ///
769 /// \returns the index of operand that is commuted with \p Idx1. If the method
770 /// fails to commute the operands, it will return \p Idx1.
771 unsigned commuteOperandsForFold(MachineInstr &MI, unsigned Idx1) const;
772};
773} // namespace llvm
774
775#endif
unsigned const MachineRegisterInfo * MRI
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool isRedundantFlagInstr(const MachineInstr *CmpI, Register SrcReg, Register SrcReg2, int64_t ImmValue, const MachineInstr *OI, bool &IsThumb1)
isRedundantFlagInstr - check whether the first instruction, whose only purpose is to update flags,...
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Analysis containing CSE Info
Definition CSEInfo.cpp:27
#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION()
\macro LLVM_VIRTUAL_ANCHOR_FUNCTION This macro is used to adhere to LLVM's policy that each class wit...
Definition Compiler.h:737
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define I(x, y, z)
Definition MD5.cpp:58
Register Reg
Register const TargetRegisterInfo * TRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:678
This is an important base class in LLVM.
Definition Constant.h:43
A debug info location.
Definition DebugLoc.h:124
Instances of this class represent a single low-level machine instruction.
Definition MCInst.h:188
Describe properties that are true of each instruction in the target description file.
This holds information about one operand of a machine instruction, indicating the register class for ...
Definition MCInstrDesc.h:86
MachineInstrBundleIterator< MachineInstr > iterator
Representation of each machine instruction.
This class contains meta information specific to a module.
MachineOperand class - Representation of each machine instruction operand.
int64_t getImm() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
unsigned getTargetFlags() const
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:67
Wrapper class representing virtual and physical registers.
Definition Register.h:19
Represents one node in the SelectionDAG.
This is used to represent a portion of an LLVM function in a low-level Data Dependence DAG representa...
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
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
bool accumulateInstrSeqToRootLatency(MachineInstr &Root) const override
When calculate the latency of the root instruction, accumulate the latency of the sequence to the roo...
void getFrameIndexOperands(SmallVectorImpl< MachineOperand > &Ops, int FI) const override
bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2, int64_t CmpMask, int64_t CmpValue, const MachineRegisterInfo *MRI) const override
Check if there exists an earlier instruction that operates on the same source operands and sets eflag...
bool getMachineCombinerPatterns(MachineInstr &Root, SmallVectorImpl< unsigned > &Patterns, bool DoRegPressureReduce) const override
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
Overrides the isSchedulingBoundary from Codegen/TargetInstrInfo.cpp to make it capable of identifying...
MachineBasicBlock::iterator insertOutlinedCall(Module &M, MachineBasicBlock &MBB, MachineBasicBlock::iterator &It, MachineFunction &MF, outliner::Candidate &C) const override
void replaceBranchWithTailCall(MachineBasicBlock &MBB, SmallVectorImpl< MachineOperand > &Cond, const MachineInstr &TailCall) const override
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, unsigned SubIdx, const MachineInstr &Orig, const TargetRegisterInfo &TRI) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify) const override
bool canInsertSelect(const MachineBasicBlock &, ArrayRef< MachineOperand > Cond, Register, Register, Register, int &, int &, int &) const override
void insertSelect(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, Register DstReg, ArrayRef< MachineOperand > Cond, Register TrueReg, Register FalseReg) const override
unsigned getOpcodeAfterMemoryUnfold(unsigned Opc, bool UnfoldLoad, bool UnfoldStore, unsigned *LoadRegIndex=nullptr) const override
bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1, unsigned &SrcOpIdx2) const override
Returns true iff the routine could find two commutable operands in the given machine instruction.
bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, int64_t &Offset1, int64_t &Offset2) const override
X86InstrInfo(const X86Subtarget &STI)
static bool isDataInvariantLoad(MachineInstr &MI)
Returns true if the instruction has no behavior (specified or otherwise) that is based on the value l...
MachineInstr * commuteInstructionImpl(MachineInstr &MI, bool NewMI, unsigned CommuteOpIdx1, unsigned CommuteOpIdx2) const override
bool isFunctionSafeToOutlineFrom(MachineFunction &MF, bool OutlineFromLinkOnceODRs) const override
const X86RegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
bool isReallyTriviallyReMaterializable(const MachineInstr &MI) const override
bool hasCommutePreference(MachineInstr &MI, bool &Commute) const override
Returns true if we have preference on the operands order in MI, the commute decision is returned in C...
bool hasLiveCondCodeDef(MachineInstr &MI) const
True if MI has a condition code def, e.g.
std::optional< ParamLoadedValue > describeLoadedValue(const MachineInstr &MI, Register Reg) const override
bool canMakeTailCallConditional(SmallVectorImpl< MachineOperand > &Cond, const MachineInstr &TailCall) const override
bool getMemOperandsWithOffsetWidth(const MachineInstr &LdSt, SmallVectorImpl< const MachineOperand * > &BaseOps, int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width, const TargetRegisterInfo *TRI) const override
bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr &MI, Register Reg, bool UnfoldLoad, bool UnfoldStore, SmallVectorImpl< MachineInstr * > &NewMIs) const override
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
MachineInstr * convertToThreeAddress(MachineInstr &MI, LiveVariables *LV, LiveIntervals *LIS) const override
convertToThreeAddress - This method must be implemented by targets that set the M_CONVERTIBLE_TO_3_AD...
static bool hasLockPrefix(const MachineInstr &MI)
std::pair< unsigned, unsigned > decomposeMachineOperandsTargetFlags(unsigned TF) const override
bool expandPostRAPseudo(MachineInstr &MI) const override
bool isAssociativeAndCommutative(const MachineInstr &Inst, bool Invert) const override
MCInst getNop() const override
Return the noop instruction to use for a noop.
outliner::InstrType getOutliningTypeImpl(const MachineModuleInfo &MMI, MachineBasicBlock::iterator &MIT, unsigned Flags) const override
bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, int64_t Offset1, int64_t Offset2, unsigned NumLoads) const override
This is a used by the pre-regalloc scheduler to determine (in conjunction with areLoadsFromSameBasePt...
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, MachineBasicBlock::iterator InsertPt, int FrameIndex, LiveIntervals *LIS=nullptr, VirtRegMap *VRM=nullptr) const override
Fold a load or store of the specified stack slot into the specified machine instruction for the speci...
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &CmpMask, int64_t &CmpValue) const override
bool getConstValDefinedInReg(const MachineInstr &MI, const Register Reg, int64_t &ImmVal) const override
std::optional< ExtAddrMode > getAddrModeFromMemoryOp(const MachineInstr &MemI, const TargetRegisterInfo *TRI) const override
Register isStoreToStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
isStoreToStackSlotPostFE - Check for post-frame ptr elimination stack locations as well.
bool isUnconditionalTailCall(const MachineInstr &MI) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
std::optional< std::unique_ptr< outliner::OutlinedFunction > > getOutliningCandidateInfo(const MachineModuleInfo &MMI, std::vector< outliner::Candidate > &RepeatedSequenceLocs, unsigned MinRepeats) const override
bool classifyLEAReg(MachineInstr &MI, const MachineOperand &Src, unsigned LEAOpcode, bool AllowSP, Register &NewSrc, unsigned &NewSrcSubReg, bool &isKill, MachineOperand &ImplicitOp, LiveVariables *LV, LiveIntervals *LIS) const
Given an operand within a MachineInstr, insert preceding code to put it into the right format for a p...
Register isLoadFromStackSlotPostFE(const MachineInstr &MI, int &FrameIndex) const override
isLoadFromStackSlotPostFE - Check for post-frame ptr elimination stack locations as well.
void setExecutionDomain(MachineInstr &MI, unsigned Domain) const override
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
bool useMachineCombiner() const override
const TargetRegisterClass * getRegClass(const MCInstrDesc &MCID, unsigned OpNum, const TargetRegisterInfo *TRI) const override
Given a machine instruction descriptor, returns the register class constraint for OpNum,...
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
ArrayRef< std::pair< unsigned, const char * > > getSerializableDirectMachineOperandTargetFlags() const override
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
bool setExecutionDomainCustom(MachineInstr &MI, unsigned Domain) const
int getSPAdjust(const MachineInstr &MI) const override
getSPAdjust - This returns the stack pointer adjustment made by this instruction.
bool verifyInstruction(const MachineInstr &MI, StringRef &ErrInfo) const override
Register getGlobalBaseReg(MachineFunction *MF) const
getGlobalBaseReg - Return a virtual register initialized with the the global base register value.
int getJumpTableIndex(const MachineInstr &MI) const override
void insertNoop(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
void setSpecialOperandAttr(MachineInstr &OldMI1, MachineInstr &OldMI2, MachineInstr &NewMI1, MachineInstr &NewMI2) const override
This is an architecture-specific helper function of reassociateOps.
void setFrameAdjustment(MachineInstr &I, int64_t V) const
Sets the stack pointer adjustment made inside the frame made up by this instruction.
std::pair< uint16_t, uint16_t > getExecutionDomain(const MachineInstr &MI) const override
bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg, Register &DstReg, unsigned &SubIdx) const override
isCoalescableExtInstr - Return true if the instruction is a "coalescable" extension instruction.
void loadStoreTileReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, unsigned Opc, Register Reg, int FrameIdx, bool isKill=false) const
void genAlternativeCodeSequence(MachineInstr &Root, unsigned Pattern, SmallVectorImpl< MachineInstr * > &InsInstrs, SmallVectorImpl< MachineInstr * > &DelInstrs, DenseMap< Register, unsigned > &InstrIdxForVirtReg) const override
When getMachineCombinerPatterns() finds potential patterns, this function generates the instructions ...
bool hasReassociableOperands(const MachineInstr &Inst, const MachineBasicBlock *MBB) const override
bool analyzeBranchPredicate(MachineBasicBlock &MBB, TargetInstrInfo::MachineBranchPredicate &MBP, bool AllowModify=false) const override
static bool isDataInvariant(MachineInstr &MI)
Returns true if the instruction has no behavior (specified or otherwise) that is based on the value o...
unsigned getUndefRegClearance(const MachineInstr &MI, unsigned OpNum, const TargetRegisterInfo *TRI) const override
Inform the BreakFalseDeps pass how many idle instructions we would like before certain undef register...
void breakPartialRegDependency(MachineInstr &MI, unsigned OpNum, const TargetRegisterInfo *TRI) const override
void buildClearRegister(Register Reg, MachineBasicBlock &MBB, MachineBasicBlock::iterator Iter, DebugLoc &DL, bool AllowSideEffects=true) const override
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
int64_t getFrameAdjustment(const MachineInstr &I) const
Returns the stack pointer adjustment that happens inside the frame setup..destroy sequence (e....
bool hasHighOperandLatency(const TargetSchedModel &SchedModel, const MachineRegisterInfo *MRI, const MachineInstr &DefMI, unsigned DefIdx, const MachineInstr &UseMI, unsigned UseIdx) const override
bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const override
bool isSubregFoldable() const override
Check whether the target can fold a load that feeds a subreg operand (or a subreg operand that feeds ...
uint16_t getExecutionDomainCustom(const MachineInstr &MI) const
bool isHighLatencyDef(int opc) const override
void buildOutlinedFrame(MachineBasicBlock &MBB, MachineFunction &MF, const outliner::OutlinedFunction &OF) const override
bool foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI, Register Reg, MachineRegisterInfo *MRI) const override
foldImmediate - 'Reg' is known to be defined by a move immediate instruction, try to fold the immedia...
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
unsigned getFMA3OpcodeToCommuteOperands(const MachineInstr &MI, unsigned SrcOpIdx1, unsigned SrcOpIdx2, const X86InstrFMA3Group &FMA3Group) const
Returns an adjusted FMA opcode that must be used in FMA instruction that performs the same computatio...
bool preservesZeroValueInReg(const MachineInstr *MI, const Register NullValueReg, const TargetRegisterInfo *TRI) const override
unsigned getPartialRegUpdateClearance(const MachineInstr &MI, unsigned OpNum, const TargetRegisterInfo *TRI) const override
Inform the BreakFalseDeps pass how many idle instructions we would like before a partial register upd...
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
CondCode
ISD::CondCode enum - These are ordered carefully to make the bitfields below work out,...
@ MO_GOTPCREL_NORELAX
MO_GOTPCREL_NORELAX - Same as MO_GOTPCREL except that R_X86_64_GOTPCREL relocations are guaranteed to...
@ MO_GOTOFF
MO_GOTOFF - On a symbol operand this indicates that the immediate is the offset to the location of th...
@ MO_DARWIN_NONLAZY_PIC_BASE
MO_DARWIN_NONLAZY_PIC_BASE - On a symbol operand "FOO", this indicates that the reference is actually...
@ MO_COFFSTUB
MO_COFFSTUB - On a symbol operand "FOO", this indicates that the reference is actually to the "....
@ MO_DARWIN_NONLAZY
MO_DARWIN_NONLAZY - On a symbol operand "FOO", this indicates that the reference is actually to the "...
@ MO_GOT
MO_GOT - On a symbol operand this indicates that the immediate is the offset to the GOT entry for the...
@ MO_TLVP
MO_TLVP - On a symbol operand this indicates that the immediate is some TLS offset.
@ MO_DLLIMPORT
MO_DLLIMPORT - On a symbol operand "FOO", this indicates that the reference is actually to the "__imp...
@ MO_GOTTPOFF
MO_GOTTPOFF - On a symbol operand this indicates that the immediate is the offset of the GOT entry wi...
@ MO_PIC_BASE_OFFSET
MO_PIC_BASE_OFFSET - On a symbol operand this indicates that the immediate should get the value of th...
@ MO_GOTPCREL
MO_GOTPCREL - On a symbol operand this indicates that the immediate is offset to the GOT entry for th...
int getMemoryOperandNo(uint64_t TSFlags)
unsigned getOperandBias(const MCInstrDesc &Desc)
Compute whether all of the def operands are repeated in the uses and therefore should be skipped.
CondCode getCondFromBranch(const MachineInstr &MI)
CondCode getCondFromCFCMov(const MachineInstr &MI)
CondCode getCondFromMI(const MachineInstr &MI)
Return the condition code of the instruction.
int getFirstAddrOperandIdx(const MachineInstr &MI)
Return the index of the instruction's first address operand, if it has a memory reference,...
@ AddrNumOperands
Definition X86BaseInfo.h:36
unsigned getSwappedVCMPImm(unsigned Imm)
Get the VCMP immediate if the opcodes are swapped.
CondCode GetOppositeBranchCondition(CondCode CC)
GetOppositeBranchCondition - Return the inverse of the specified cond, e.g.
unsigned getSwappedVPCOMImm(unsigned Imm)
Get the VPCOM immediate if the opcodes are swapped.
bool isX87Instruction(MachineInstr &MI)
Check if the instruction is X87 instruction.
unsigned getNonNDVariant(unsigned Opc)
unsigned getVPCMPImmForCond(ISD::CondCode CC)
Get the VPCMP immediate for the given condition.
std::pair< CondCode, bool > getX86ConditionCode(CmpInst::Predicate Predicate)
Return a pair of condition code for the given predicate and whether the instruction operands should b...
CondCode getCondFromSETCC(const MachineInstr &MI)
unsigned getSwappedVPCMPImm(unsigned Imm)
Get the VPCMP immediate if the opcodes are swapped.
CondCode getCondFromCCMP(const MachineInstr &MI)
int getCCMPCondFlagsFromCondCode(CondCode CC)
int getCondSrcNoFromDesc(const MCInstrDesc &MCID)
Return the source operand # for condition code by MCID.
const Constant * getConstantFromPool(const MachineInstr &MI, unsigned OpNo)
Find any constant pool entry associated with a specific instruction operand.
unsigned getCMovOpcode(unsigned RegBytes, bool HasMemoryOperand=false, bool HasNDD=false)
Return a cmov opcode for the given register size in bytes, and operand type.
unsigned getNFVariant(unsigned Opc)
unsigned getVectorRegisterWidth(const MCOperandInfo &Info)
Get the width of the vector register operand.
CondCode getCondFromCMov(const MachineInstr &MI)
InstrType
Represents how an instruction should be mapped by the outliner.
This is an optimization pass for GlobalISel generic memory operations.
static bool isGlobalStubReference(unsigned char TargetFlag)
isGlobalStubReference - Return true if the specified TargetFlag operand is a reference to a stub for ...
@ Offset
Definition DWP.cpp:477
static bool isGlobalRelativeToPICBase(unsigned char TargetFlag)
isGlobalRelativeToPICBase - Return true if the specified global value reference is relative to a 32-b...
static bool isAddMemInstrWithRelocation(const MachineInstr &MI)
static bool isMem(const MachineInstr &MI, unsigned Op)
static bool isScale(const MachineOperand &MO)
static bool isMemInstrWithGOTPCREL(const MachineInstr &MI)
static bool isLeaMem(const MachineInstr &MI, unsigned Op)
DWARFExpression::Operation Op
X86MachineCombinerPattern
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
Represents a predicate at the MachineFunction level.
This class is used to group {132, 213, 231} forms of FMA opcodes together.
An individual sequence of instructions to be replaced with a call to an outlined function.
The information necessary to create an outlined function for some class of candidate.