LLVM 24.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 a MOVri opcode for materializing \p Imm into a 32- or 64-bit GPR.
55unsigned getMOVriOpcode(bool Use64BitReg, int64_t Imm);
56
57/// Return the source operand # for condition code by \p MCID. If the
58/// instruction doesn't have a condition code, return -1.
60
61/// Return the condition code of the instruction. If the instruction doesn't
62/// have a condition code, return X86::COND_INVALID.
63CondCode getCondFromMI(const MachineInstr &MI);
64
65// Turn JCC instruction into condition code.
66CondCode getCondFromBranch(const MachineInstr &MI);
67
68// Turn SETCC instruction into condition code.
69CondCode getCondFromSETCC(const MachineInstr &MI);
70
71// Turn CMOV instruction into condition code.
72CondCode getCondFromCMov(const MachineInstr &MI);
73
74// Turn CFCMOV instruction into condition code.
75CondCode getCondFromCFCMov(const MachineInstr &MI);
76
77// Turn CCMP instruction into condition code.
78CondCode getCondFromCCMP(const MachineInstr &MI);
79
80// Turn condition code into condition flags for CCMP/CTEST.
81int getCCMPCondFlagsFromCondCode(CondCode CC);
82
83// Get the opcode of corresponding NF variant.
84unsigned getNFVariant(unsigned Opc);
85
86// If \p MI clobbers EFLAGS and that clobber can be removed by rewriting the
87// instruction to its NF (no-flags) variant, return that NF opcode; otherwise
88// return 0. The clobber is removable only if the EFLAGS def is dead, an NF
89// variant exists, and (for linker backward-compat) it is not an ADDrm/ADDmr
90// with relocation.
91unsigned
93 const TargetRegisterInfo *TRI = nullptr);
94
95// Get the opcode of corresponding NonND variant.
96unsigned getNonNDVariant(unsigned Opc);
97
98/// GetOppositeBranchCondition - Return the inverse of the specified cond,
99/// e.g. turning COND_E to COND_NE.
100CondCode GetOppositeBranchCondition(CondCode CC);
101
102/// Get the VPCMP immediate for the given condition.
104
105/// Get the VPCMP immediate if the opcodes are swapped.
106unsigned getSwappedVPCMPImm(unsigned Imm);
107
108/// Get the VPCOM immediate if the opcodes are swapped.
109unsigned getSwappedVPCOMImm(unsigned Imm);
110
111/// Get the VCMP immediate if the opcodes are swapped.
112unsigned getSwappedVCMPImm(unsigned Imm);
113
114/// Get the width of the vector register operand.
115unsigned getVectorRegisterWidth(const MCOperandInfo &Info);
116
117/// Check if the instruction is X87 instruction.
119
120/// Return the index of the instruction's first address operand, if it has a
121/// memory reference, or -1 if it has none. Unlike X86II::getMemoryOperandNo(),
122/// this also works for both pseudo instructions (e.g., TCRETURNmi) as well as
123/// real instructions (e.g., JMP64m).
125
126/// Find any constant pool entry associated with a specific instruction operand.
127const Constant *getConstantFromPool(const MachineInstr &MI, unsigned OpNo);
128
129} // namespace X86
130
131/// isGlobalStubReference - Return true if the specified TargetFlag operand is
132/// a reference to a stub for a global, not the global itself.
133inline static bool isGlobalStubReference(unsigned char TargetFlag) {
134 switch (TargetFlag) {
135 case X86II::MO_DLLIMPORT: // dllimport stub.
136 case X86II::MO_GOTPCREL: // rip-relative GOT reference.
137 case X86II::MO_GOTPCREL_NORELAX: // rip-relative GOT reference.
138 case X86II::MO_GOT: // normal GOT reference.
139 case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Normal $non_lazy_ptr ref.
140 case X86II::MO_DARWIN_NONLAZY: // Normal $non_lazy_ptr ref.
141 case X86II::MO_COFFSTUB: // COFF .refptr stub.
142 return true;
143 default:
144 return false;
145 }
146}
147
148/// isGlobalRelativeToPICBase - Return true if the specified global value
149/// reference is relative to a 32-bit PIC base (X86ISD::GlobalBaseReg). If this
150/// is true, the addressing mode has the PIC base register added in (e.g. EBX).
151inline static bool isGlobalRelativeToPICBase(unsigned char TargetFlag) {
152 switch (TargetFlag) {
153 case X86II::MO_GOTOFF: // isPICStyleGOT: local global.
154 case X86II::MO_GOT: // isPICStyleGOT: other global.
155 case X86II::MO_PIC_BASE_OFFSET: // Darwin local global.
156 case X86II::MO_DARWIN_NONLAZY_PIC_BASE: // Darwin/32 external global.
157 case X86II::MO_TLVP: // ??? Pretty sure..
158 return true;
159 default:
160 return false;
161 }
162}
163
164inline static bool isScale(const MachineOperand &MO) {
165 return MO.isImm() && (MO.getImm() == 1 || MO.getImm() == 2 ||
166 MO.getImm() == 4 || MO.getImm() == 8);
167}
168
169inline static bool isLeaMem(const MachineInstr &MI, unsigned Op) {
170 if (MI.getOperand(Op).isFI())
171 return true;
172 return Op + X86::AddrSegmentReg <= MI.getNumOperands() &&
173 MI.getOperand(Op + X86::AddrBaseReg).isReg() &&
174 isScale(MI.getOperand(Op + X86::AddrScaleAmt)) &&
175 MI.getOperand(Op + X86::AddrIndexReg).isReg() &&
176 (MI.getOperand(Op + X86::AddrDisp).isImm() ||
177 MI.getOperand(Op + X86::AddrDisp).isGlobal() ||
178 MI.getOperand(Op + X86::AddrDisp).isCPI() ||
179 MI.getOperand(Op + X86::AddrDisp).isJTI());
180}
181
182inline static bool isMem(const MachineInstr &MI, unsigned Op) {
183 if (MI.getOperand(Op).isFI())
184 return true;
185 return Op + X86::AddrNumOperands <= MI.getNumOperands() &&
186 MI.getOperand(Op + X86::AddrSegmentReg).isReg() && isLeaMem(MI, Op);
187}
188
189inline static bool isAddMemInstrWithRelocation(const MachineInstr &MI) {
190 unsigned Op = MI.getOpcode();
191 if (Op == X86::ADD64rm || Op == X86::ADD64mr_ND || Op == X86::ADD64rm_ND) {
192 int MemOpNo = X86II::getMemoryOperandIdx(MI.getDesc());
193 assert(MemOpNo >= 0 && "Expected a memory operand");
194 const MachineOperand &MO = MI.getOperand(X86::AddrDisp + MemOpNo);
196 return true;
197 }
198
199 return false;
200}
201
202inline static bool isMemInstrWithGOTPCREL(const MachineInstr &MI) {
203 unsigned Op = MI.getOpcode();
204 switch (Op) {
205 case X86::TEST32mr:
206 case X86::TEST64mr:
207 case X86::CMP32rm:
208 case X86::CMP64rm:
209 case X86::MOV32rm:
210 case X86::MOV64rm:
211 case X86::ADC32rm:
212 case X86::ADD32rm:
213 case X86::AND32rm:
214 case X86::OR32rm:
215 case X86::SBB32rm:
216 case X86::SUB32rm:
217 case X86::XOR32rm:
218 case X86::ADC64rm:
219 case X86::ADD64rm:
220 case X86::AND64rm:
221 case X86::OR64rm:
222 case X86::SBB64rm:
223 case X86::SUB64rm:
224 case X86::XOR64rm: {
225 int MemOpNo = X86II::getMemoryOperandIdx(MI.getDesc());
226 assert(MemOpNo >= 0 && "Expected a memory operand");
227 const MachineOperand &MO = MI.getOperand(X86::AddrDisp + MemOpNo);
229 return true;
230 break;
231 }
232 }
233 return false;
234}
235
236class X86InstrInfo final : public X86GenInstrInfo {
237 const X86Subtarget &Subtarget;
238 const X86RegisterInfo RI;
239
241
242 bool analyzeBranchImpl(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
243 MachineBasicBlock *&FBB,
246 bool AllowModify) const;
247
248 bool foldImmediateImpl(MachineInstr &UseMI, MachineInstr *DefMI, Register Reg,
249 int64_t ImmVal, MachineRegisterInfo *MRI,
250 bool MakeChange) const;
251
252public:
253 explicit X86InstrInfo(const X86Subtarget &STI);
254
255 /// Given a machine instruction descriptor, returns the register
256 /// class constraint for OpNum, or NULL. Returned register class
257 /// may be different from the definition in the TD file, e.g.
258 /// GR*RegClass (definition in TD file)
259 /// ->
260 /// GR*_NOREX2RegClass (Returned register class)
262 unsigned OpNum) const override;
263
264 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
265 /// such, whenever a client has an instance of instruction info, it should
266 /// always be able to get register info as well (through this method).
267 ///
268 const X86RegisterInfo &getRegisterInfo() const { return RI; }
269
270 const TargetRegisterClass *
272
273 /// Returns the stack pointer adjustment that happens inside the frame
274 /// setup..destroy sequence (e.g. by pushes, or inside the callee).
275 int64_t getFrameAdjustment(const MachineInstr &I) const {
276 assert(isFrameInstr(I));
277 if (isFrameSetup(I))
278 return I.getOperand(2).getImm();
279 return I.getOperand(1).getImm();
280 }
281
282 /// Sets the stack pointer adjustment made inside the frame made up by this
283 /// instruction.
284 void setFrameAdjustment(MachineInstr &I, int64_t V) const {
285 assert(isFrameInstr(I));
286 if (isFrameSetup(I))
287 I.getOperand(2).setImm(V);
288 else
289 I.getOperand(1).setImm(V);
290 }
291
292 /// getSPAdjust - This returns the stack pointer adjustment made by
293 /// this instruction. For x86, we need to handle more complex call
294 /// sequences involving PUSHes.
295 int getSPAdjust(const MachineInstr &MI) const override;
296
297 /// isCoalescableExtInstr - Return true if the instruction is a "coalescable"
298 /// extension instruction. That is, it's like a copy where it's legal for the
299 /// source to overlap the destination. e.g. X86::MOVSX64rr32. If this returns
300 /// true, then it's expected the pre-extension value is available as a subreg
301 /// of the result register. This also returns the sub-register index in
302 /// SubIdx.
303 bool isCoalescableExtInstr(const MachineInstr &MI, Register &SrcReg,
304 Register &DstReg, unsigned &SubIdx) const override;
305
306 /// Returns true if the instruction has no behavior (specified or otherwise)
307 /// that is based on the value of any of its register operands
308 ///
309 /// Instructions are considered data invariant even if they set EFLAGS.
310 ///
311 /// A classical example of something that is inherently not data invariant is
312 /// an indirect jump -- the destination is loaded into icache based on the
313 /// bits set in the jump destination register.
314 ///
315 /// FIXME: This should become part of our instruction tables.
316 static bool isDataInvariant(MachineInstr &MI);
317
318 /// Returns true if the instruction has no behavior (specified or otherwise)
319 /// that is based on the value loaded from memory or the value of any
320 /// non-address register operands.
321 ///
322 /// For example, if the latency of the instruction is dependent on the
323 /// particular bits set in any of the registers *or* any of the bits loaded
324 /// from memory.
325 ///
326 /// Instructions are considered data invariant even if they set EFLAGS.
327 ///
328 /// A classical example of something that is inherently not data invariant is
329 /// an indirect jump -- the destination is loaded into icache based on the
330 /// bits set in the jump destination register.
331 ///
332 /// FIXME: This should become part of our instruction tables.
333 static bool isDataInvariantLoad(MachineInstr &MI);
334
336 int &FrameIndex) const override;
338 int &FrameIndex,
339 TypeSize &MemBytes) const override;
340 /// isLoadFromStackSlotPostFE - Check for post-frame ptr elimination
341 /// stack locations as well. This uses a heuristic so it isn't
342 /// reliable for correctness.
344 int &FrameIndex) const override;
345
347 int &FrameIndex) const override;
349 int &FrameIndex,
350 TypeSize &MemBytes) const override;
351 /// isStoreToStackSlotPostFE - Check for post-frame ptr elimination
352 /// stack locations as well. This uses a heuristic so it isn't
353 /// reliable for correctness.
355 int &FrameIndex) const override;
356
357 bool isReMaterializableImpl(const MachineInstr &MI) const override;
358 void
360 Register DestReg, unsigned SubIdx, const MachineInstr &Orig,
361 LaneBitmask UsedLanes = LaneBitmask::getAll()) const override;
362
363 /// Given an operand within a MachineInstr, insert preceding code to put it
364 /// into the right format for a particular kind of LEA instruction. This may
365 /// involve using an appropriate super-register instead (with an implicit use
366 /// of the original) or creating a new virtual register and inserting COPY
367 /// instructions to get the data into the right class.
368 ///
369 /// Reference parameters are set to indicate how caller should add this
370 /// operand to the LEA instruction.
372 unsigned LEAOpcode, bool AllowSP, Register &NewSrc,
373 unsigned &NewSrcSubReg, bool &isKill,
374 MachineOperand &ImplicitOp, LiveVariables *LV,
375 LiveIntervals *LIS) const;
376
377 /// convertToThreeAddress - This method must be implemented by targets that
378 /// set the M_CONVERTIBLE_TO_3_ADDR flag. When this flag is set, the target
379 /// may be able to convert a two-address instruction into a true
380 /// three-address instruction on demand. This allows the X86 target (for
381 /// example) to convert ADD and SHL instructions into LEA instructions if they
382 /// would require register copies due to two-addressness.
383 ///
384 /// This method returns a null pointer if the transformation cannot be
385 /// performed, otherwise it returns the new instruction.
386 ///
388 LiveIntervals *LIS) const override;
389
390 /// Returns true iff the routine could find two commutable operands in the
391 /// given machine instruction.
392 /// The 'SrcOpIdx1' and 'SrcOpIdx2' are INPUT and OUTPUT arguments. Their
393 /// input values can be re-defined in this method only if the input values
394 /// are not pre-defined, which is designated by the special value
395 /// 'CommuteAnyOperandIndex' assigned to it.
396 /// If both of indices are pre-defined and refer to some operands, then the
397 /// method simply returns true if the corresponding operands are commutable
398 /// and returns false otherwise.
399 ///
400 /// For example, calling this method this way:
401 /// unsigned Op1 = 1, Op2 = CommuteAnyOperandIndex;
402 /// findCommutedOpIndices(MI, Op1, Op2);
403 /// can be interpreted as a query asking to find an operand that would be
404 /// commutable with the operand#1.
405 bool findCommutedOpIndices(const MachineInstr &MI, unsigned &SrcOpIdx1,
406 unsigned &SrcOpIdx2) const override;
407
408 /// Returns true if we have preference on the operands order in MI, the
409 /// commute decision is returned in Commute.
410 bool hasCommutePreference(MachineInstr &MI, bool &Commute) const override;
411
412 /// Returns an adjusted FMA opcode that must be used in FMA instruction that
413 /// performs the same computations as the given \p MI but which has the
414 /// operands \p SrcOpIdx1 and \p SrcOpIdx2 commuted.
415 /// It may return 0 if it is unsafe to commute the operands.
416 /// Note that a machine instruction (instead of its opcode) is passed as the
417 /// first parameter to make it possible to analyze the instruction's uses and
418 /// commute the first operand of FMA even when it seems unsafe when you look
419 /// at the opcode. For example, it is Ok to commute the first operand of
420 /// VFMADD*SD_Int, if ONLY the lowest 64-bit element of the result is used.
421 ///
422 /// The returned FMA opcode may differ from the opcode in the given \p MI.
423 /// For example, commuting the operands #1 and #3 in the following FMA
424 /// FMA213 #1, #2, #3
425 /// results into instruction with adjusted opcode:
426 /// FMA231 #3, #2, #1
427 unsigned
428 getFMA3OpcodeToCommuteOperands(const MachineInstr &MI, unsigned SrcOpIdx1,
429 unsigned SrcOpIdx2,
430 const X86InstrFMA3Group &FMA3Group) const;
431
432 // Branch analysis.
433 bool isUnconditionalTailCall(const MachineInstr &MI) const override;
435 const MachineInstr &TailCall) const override;
438 const MachineInstr &TailCall) const override;
439
441 MachineBasicBlock *&FBB,
443 bool AllowModify) const override;
444
445 int getJumpTableIndex(const MachineInstr &MI) const override;
446
447 std::optional<ExtAddrMode>
449 const TargetRegisterInfo *TRI) const override;
450
452 int64_t &ImmVal) const override;
453
455 const Register NullValueReg,
456 const TargetRegisterInfo *TRI) const override;
457
459 const MachineInstr &LdSt,
461 bool &OffsetIsScalable, LocationSize &Width,
462 const TargetRegisterInfo *TRI) const override;
465 bool AllowModify = false) const override;
466
468 int *BytesRemoved = nullptr) const override;
471 const DebugLoc &DL,
472 int *BytesAdded = nullptr) const override;
474 Register, Register, Register, int &, int &,
475 int &) const override;
477 const DebugLoc &DL, Register DstReg,
479 Register FalseReg) const override;
481 const DebugLoc &DL, Register DestReg, Register SrcReg,
482 bool KillSrc, bool RenamableDest = false,
483 bool RenamableSrc = false) const override;
486 bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg,
487 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
488
491 int FrameIndex, const TargetRegisterClass *RC, Register VReg,
492 unsigned SubReg = 0,
493 MachineInstr::MIFlag Flags = MachineInstr::NoFlags) const override;
494
496 unsigned Opc, Register Reg, int FrameIdx,
497 bool isKill = false) const;
498
499 bool expandPostRAPseudo(MachineInstr &MI) const override;
500
501 /// Check whether the target can fold a load that feeds a subreg operand
502 /// (or a subreg operand that feeds a store).
503 bool isSubregFoldable() const override { return true; }
504
505 /// Fold a load or store of the specified stack slot into the specified
506 /// machine instruction for the specified operand(s). If folding happens, it
507 /// is likely that the referenced instruction has been changed.
508 ///
509 /// \returns true on success.
511 ArrayRef<unsigned> Ops, int FrameIndex,
512 MachineInstr *&CopyMI,
513 LiveIntervals *LIS = nullptr,
514 VirtRegMap *VRM = nullptr) const override;
515
516 /// Same as the previous version except it allows folding of any load and
517 /// store from / to any address, not just from a specific stack slot.
520 MachineInstr &LoadMI,
521 MachineInstr *&CopyMI,
522 LiveIntervals *LIS = nullptr,
523 VirtRegMap *VRM = nullptr) const override;
524
525 bool
527 bool UnfoldLoad, bool UnfoldStore,
528 SmallVectorImpl<MachineInstr *> &NewMIs) const override;
529
531 SmallVectorImpl<SDNode *> &NewNodes) const override;
532
533 unsigned
534 getOpcodeAfterMemoryUnfold(unsigned Opc, bool UnfoldLoad, bool UnfoldStore,
535 unsigned *LoadRegIndex = nullptr) const override;
536
537 bool areLoadsFromSameBasePtr(SDNode *Load1, SDNode *Load2, int64_t &Offset1,
538 int64_t &Offset2) const override;
539
540 /// Overrides the isSchedulingBoundary from Codegen/TargetInstrInfo.cpp to
541 /// make it capable of identifying ENDBR intructions and prevent it from being
542 /// re-scheduled.
544 const MachineBasicBlock *MBB,
545 const MachineFunction &MF) const override;
546
547 /// This is a used by the pre-regalloc scheduler to determine (in conjunction
548 /// with areLoadsFromSameBasePtr) if two loads should be scheduled togther. On
549 /// some targets if two loads are loading from addresses in the same cache
550 /// line, it's better if they are scheduled together. This function takes two
551 /// integers that represent the load offsets from the common base address. It
552 /// returns true if it decides it's desirable to schedule the two loads
553 /// together. "NumLoads" is the number of loads that have already been
554 /// scheduled after Load1.
555 bool shouldScheduleLoadsNear(SDNode *Load1, SDNode *Load2, int64_t Offset1,
556 int64_t Offset2,
557 unsigned NumLoads) const override;
558
560 MachineBasicBlock::iterator MI) const override;
561
562 MCInst getNop() const override;
563
564 bool
566
567 bool isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const override;
568
569 /// True if MI has a condition code def, e.g. EFLAGS, that is
570 /// not marked dead.
572
573 /// getGlobalBaseReg - Return a virtual register initialized with the
574 /// the global base register value. Output instructions required to
575 /// initialize the register in the function entry block, if necessary.
576 ///
578
579 std::pair<uint16_t, uint16_t>
580 getExecutionDomain(const MachineInstr &MI) const override;
581
583
584 void setExecutionDomain(MachineInstr &MI, unsigned Domain) const override;
585
586 bool setExecutionDomainCustom(MachineInstr &MI, unsigned Domain) const;
587
588 unsigned
589 getPartialRegUpdateClearance(const MachineInstr &MI, unsigned OpNum,
590 const TargetRegisterInfo *TRI) const override;
591 unsigned getUndefRegClearance(const MachineInstr &MI, unsigned OpNum,
592 const TargetRegisterInfo *TRI) const override;
593 void breakPartialRegDependency(MachineInstr &MI, unsigned OpNum,
594 const TargetRegisterInfo *TRI) const override;
595
597 unsigned OpNum,
600 unsigned Size, Align Alignment,
601 bool AllowCommute, MachineInstr *&CopyMI,
602 VirtRegMap *VRM = nullptr) const;
603
604 bool isHighLatencyDef(int opc) const override;
605
606 bool hasHighOperandLatency(const TargetSchedModel &SchedModel,
607 const MachineRegisterInfo *MRI,
608 const MachineInstr &DefMI, unsigned DefIdx,
609 const MachineInstr &UseMI,
610 unsigned UseIdx) const override;
611
612 bool useMachineCombiner() const override { return true; }
613
615 bool Invert) const override;
616
617 bool hasReassociableOperands(const MachineInstr &Inst,
618 const MachineBasicBlock *MBB) const override;
619
620 void setSpecialOperandAttr(MachineInstr &OldMI1, MachineInstr &OldMI2,
621 MachineInstr &NewMI1,
622 MachineInstr &NewMI2) const override;
623
624 bool analyzeCompare(const MachineInstr &MI, Register &SrcReg,
625 Register &SrcReg2, int64_t &CmpMask,
626 int64_t &CmpValue) const override;
627
628 /// Check if there exists an earlier instruction that operates on the same
629 /// source operands and sets eflags in the same way as CMP and remove CMP if
630 /// possible.
631 bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg,
632 Register SrcReg2, int64_t CmpMask, int64_t CmpValue,
633 const MachineRegisterInfo *MRI) const override;
634
636 MachineRegisterInfo *MRI) const override;
637
638 std::pair<unsigned, unsigned>
639 decomposeMachineOperandsTargetFlags(unsigned TF) const override;
640
643
644 std::optional<std::unique_ptr<outliner::OutlinedFunction>>
646 const MachineModuleInfo &MMI,
647 std::vector<outliner::Candidate> &RepeatedSequenceLocs,
648 unsigned MinRepeats) const override;
649
651 bool OutlineFromLinkOnceODRs) const override;
652
655 unsigned Flags) const override;
656
658 const outliner::OutlinedFunction &OF) const override;
659
663 outliner::Candidate &C) const override;
664
667 bool AllowSideEffects = true) const override;
668
670 StringRef &ErrInfo) const override;
671#define GET_INSTRINFO_HELPER_DECLS
672#include "X86GenInstrInfo.inc"
673
674 static bool hasLockPrefix(const MachineInstr &MI) {
675 return MI.getDesc().TSFlags & X86II::LOCK;
676 }
677
678 std::optional<ParamLoadedValue>
679 describeLoadedValue(const MachineInstr &MI, Register Reg) const override;
680
681protected:
683 unsigned CommuteOpIdx1,
684 unsigned CommuteOpIdx2) const override;
685
686 std::optional<DestSourcePair>
687 isCopyInstrImpl(const MachineInstr &MI) const override;
688
691 bool DoRegPressureReduce) const override;
692
693 /// When getMachineCombinerPatterns() finds potential patterns,
694 /// this function generates the instructions that could replace the
695 /// original code sequence.
697 MachineInstr &Root, unsigned Pattern,
700 DenseMap<Register, unsigned> &InstrIdxForVirtReg) const override;
701
702 /// When calculate the latency of the root instruction, accumulate the
703 /// latency of the sequence to the root latency.
704 /// \param Root - Instruction that could be combined with one of its operands
705 /// For X86 instruction (vpmaddwd + vpmaddwd) -> vpdpwssd, the vpmaddwd
706 /// is not in the critical path, so the root latency only include vpmaddwd.
708 return false;
709 }
710
712 int FI) const override;
713
714private:
715 /// This is a helper for convertToThreeAddress for 8 and 16-bit instructions.
716 /// We use 32-bit LEA to form 3-address code by promoting to a 32-bit
717 /// super-register and then truncating back down to a 8/16-bit sub-register.
718 MachineInstr *convertToThreeAddressWithLEA(unsigned MIOpc, MachineInstr &MI,
719 LiveVariables *LV,
720 LiveIntervals *LIS,
721 bool Is8BitOp) const;
722
723 /// Handles memory folding for special case instructions, for instance those
724 /// requiring custom manipulation of the address.
725 MachineInstr *foldMemoryOperandCustom(MachineFunction &MF, MachineInstr &MI,
726 unsigned OpNum,
729 unsigned Size, Align Alignment) const;
730
731 MachineInstr *foldMemoryBroadcast(MachineFunction &MF, MachineInstr &MI,
732 unsigned OpNum,
735 unsigned BitsSize, bool AllowCommute) const;
736
737 /// isFrameOperand - Return true and the FrameIndex if the specified
738 /// operand and follow operands form a reference to the stack frame.
739 bool isFrameOperand(const MachineInstr &MI, unsigned int Op,
740 int &FrameIndex) const;
741
742 /// Returns true iff the routine could find two commutable operands in the
743 /// given machine instruction with 3 vector inputs.
744 /// The 'SrcOpIdx1' and 'SrcOpIdx2' are INPUT and OUTPUT arguments. Their
745 /// input values can be re-defined in this method only if the input values
746 /// are not pre-defined, which is designated by the special value
747 /// 'CommuteAnyOperandIndex' assigned to it.
748 /// If both of indices are pre-defined and refer to some operands, then the
749 /// method simply returns true if the corresponding operands are commutable
750 /// and returns false otherwise.
751 ///
752 /// For example, calling this method this way:
753 /// unsigned Op1 = 1, Op2 = CommuteAnyOperandIndex;
754 /// findThreeSrcCommutedOpIndices(MI, Op1, Op2);
755 /// can be interpreted as a query asking to find an operand that would be
756 /// commutable with the operand#1.
757 ///
758 /// If IsIntrinsic is set, operand 1 will be ignored for commuting.
759 bool findThreeSrcCommutedOpIndices(const MachineInstr &MI,
760 unsigned &SrcOpIdx1,
761 unsigned &SrcOpIdx2,
762 bool IsIntrinsic = false) const;
763
764 /// Returns true when instruction \p FlagI produces the same flags as \p OI.
765 /// The caller should pass in the results of calling analyzeCompare on \p OI:
766 /// \p SrcReg, \p SrcReg2, \p ImmMask, \p ImmValue.
767 /// If the flags match \p OI as if it had the input operands swapped then the
768 /// function succeeds and sets \p IsSwapped to true.
769 ///
770 /// Examples of OI, FlagI pairs returning true:
771 /// CMP %1, 42 and CMP %1, 42
772 /// CMP %1, %2 and %3 = SUB %1, %2
773 /// TEST %1, %1 and %2 = SUB %1, 0
774 /// CMP %1, %2 and %3 = SUB %2, %1 ; IsSwapped=true
775 bool isRedundantFlagInstr(const MachineInstr &FlagI, Register SrcReg,
776 Register SrcReg2, int64_t ImmMask, int64_t ImmValue,
777 const MachineInstr &OI, bool *IsSwapped,
778 int64_t *ImmDelta) const;
779
780 /// Used by optimizeCompareInstr when the backward search for an equivalent
781 /// flag producer reaches a block (\p MultiPredMBB) with multiple
782 /// predecessors. Searches the dominator tree for an instruction that produces
783 /// the same flags as the compare \p CmpInstr and dominates it, such that on
784 /// every path from that producer to \p CmpInstr all EFLAGS clobbers can be
785 /// converted to their NF (no-flags) variants. Those clobbers are appended to
786 /// \p InstsToUpdate as (instruction, NF opcode) pairs for the caller to
787 /// rewrite. Restricted to producers that yield identical flags: it succeeds
788 /// only when isRedundantFlagInstr reports no operand swap and no immediate
789 /// delta, so on success \p IsSwapped is false and \p ImmDelta is 0. Returns
790 /// the flag producer on success, or nullptr otherwise. Requires the NF
791 /// feature (APX).
792 MachineInstr *findDominatingRedundantFlagInstr(
793 MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2,
794 int64_t CmpMask, int64_t CmpValue, MachineBasicBlock *MultiPredMBB,
795 bool &IsSwapped, int64_t &ImmDelta,
796 SmallVectorImpl<std::pair<MachineInstr *, unsigned>> &InstsToUpdate)
797 const;
798
799 /// Commute operands of \p MI for memory fold.
800 ///
801 /// \param Idx1 the index of operand to be commuted.
802 ///
803 /// \returns the index of operand that is commuted with \p Idx1. If the method
804 /// fails to commute the operands, it will return \p Idx1.
805 unsigned commuteOperandsForFold(MachineInstr &MI, unsigned Idx1) const;
806
808 insertCodePrefetchInstr(MachineBasicBlock &MBB,
809 MachineBasicBlock::iterator InsertBefore,
810 const GlobalValue *GV) const override;
811};
812} // namespace llvm
813
814#endif
MachineInstrBuilder & UseMI
MachineInstrBuilder MachineInstrBuilder & DefMI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
unsigned Imm
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
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#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:777
IRTranslator LLVM IR MI
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
const SmallVectorImpl< MachineOperand > & Cond
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition InstrTypes.h:740
This is an important base class in LLVM.
Definition Constant.h:43
A debug info location.
Definition DebugLoc.h:126
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:88
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:68
Wrapper class representing virtual and physical registers.
Definition Register.h:20
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...
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
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
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
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) 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 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
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) 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
const TargetRegisterClass * getInlineAsmMemoryOperandRegClass(InlineAsm::ConstraintCode C) 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...
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.
const TargetRegisterClass * getRegClass(const MCInstrDesc &MCID, unsigned OpNum) const override
Given a machine instruction descriptor, returns the register class constraint for OpNum,...
bool isUnconditionalTailCall(const MachineInstr &MI) const override
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, Register DestReg, unsigned SubIdx, const MachineInstr &Orig, LaneBitmask UsedLanes=LaneBitmask::getAll()) 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
bool useMachineCombiner() const override
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
bool isReMaterializableImpl(const MachineInstr &MI) 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...
MachineInstr * foldMemoryOperandImpl(MachineFunction &MF, MachineInstr &MI, ArrayRef< unsigned > Ops, int FrameIndex, MachineInstr *&CopyMI, 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...
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...
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 getMemoryOperandIdx(const MCInstrDesc &Desc)
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:37
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 getNFVariantIfClobberRemovable(const MachineInstr &MI, const TargetRegisterInfo *TRI=nullptr)
unsigned getMOVriOpcode(bool Use64BitReg, int64_t Imm)
Return a MOVri opcode for materializing Imm into a 32- or 64-bit GPR.
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:577
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
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
#define N
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition Alignment.h:39
static constexpr LaneBitmask getAll()
Definition LaneBitmask.h:82
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.