LLVM 24.0.0git
HexagonRegisterInfo.cpp
Go to the documentation of this file.
1//===-- HexagonRegisterInfo.cpp - Hexagon Register Information ------------===//
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 Hexagon implementation of the TargetRegisterInfo
10// class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "HexagonRegisterInfo.h"
17#include "HexagonSubtarget.h"
19#include "llvm/ADT/BitVector.h"
20#include "llvm/ADT/STLExtras.h"
21#include "llvm/ADT/SmallSet.h"
31#include "llvm/IR/Function.h"
32#include "llvm/IR/Type.h"
34#include "llvm/Support/Debug.h"
38
39#define GET_REGINFO_TARGET_DESC
40#include "HexagonGenRegisterInfo.inc"
41
42using namespace llvm;
43
45
47 : HexagonGenRegisterInfo(Hexagon::R31, 0/*DwarfFlavor*/, 0/*EHFlavor*/,
48 0/*PC*/, HwMode) {}
49
51 switch (Reg) {
52 case Hexagon::R29:
53 case Hexagon::R30:
54 case Hexagon::R31:
55 return true;
56 }
57 return false;
58}
59
61 // VF0-VF31 are fake registers used as sub-registers in HVX vector pairs
62 if (Reg >= Hexagon::VF0 && Reg <= Hexagon::VF31)
63 return true;
64 // VFR0-VFR31 are fake registers used for reversed vector pairs
65 if (Reg >= Hexagon::VFR0 && Reg <= Hexagon::VFR31)
66 return true;
67 return false;
68}
69
71 return R == Hexagon::R0 || R == Hexagon::R1 || R == Hexagon::R2 ||
72 R == Hexagon::R3 || R == Hexagon::D0 || R == Hexagon::D1;
73}
74
75const MCPhysReg *
77 const TargetRegisterClass *RC) const {
78 using namespace Hexagon;
79
80 static const MCPhysReg Int32[] = {
81 R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, 0
82 };
83 static const MCPhysReg Int64[] = {
84 D0, D1, D2, D3, D4, D5, D6, D7, 0
85 };
86 static const MCPhysReg Pred[] = {
87 P0, P1, P2, P3, 0
88 };
89 static const MCPhysReg VecSgl[] = {
90 V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
91 V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25, V26, V27,
92 V28, V29, V30, V31, 0
93 };
94 static const MCPhysReg VecDbl[] = {
95 W0, W1, W2, W3, W4, W5, W6, W7, W8, W9, W10, W11, W12, W13, W14, W15, 0
96 };
97 static const MCPhysReg VecPred[] = {
98 Q0, Q1, Q2, Q3, 0
99 };
100
101 switch (RC->getID()) {
102 case IntRegsRegClassID:
103 return Int32;
104 case DoubleRegsRegClassID:
105 return Int64;
106 case PredRegsRegClassID:
107 return Pred;
108 case HvxVRRegClassID:
109 return VecSgl;
110 case HvxWRRegClassID:
111 return VecDbl;
112 case HvxQRRegClassID:
113 return VecPred;
114 default:
115 break;
116 }
117
118 static const MCPhysReg Empty[] = { 0 };
119#ifndef NDEBUG
120 dbgs() << "Register class: " << getRegClassName(RC) << "\n";
121#endif
122 llvm_unreachable("Unexpected register class");
123 return Empty;
124}
125
126// Returns true if MF takes HLX arguments or returns an HLX type.
127static bool hasHLXSignature(const MachineFunction &MF) {
128 const auto &HST = MF.getSubtarget<HexagonSubtarget>();
129 const Function &F = MF.getFunction();
130 return HST.isTypeForHLX(F.getReturnType()) ||
131 any_of(F.args(), [&HST](const Argument &A) {
132 return HST.isTypeForHLX(A.getType());
133 });
134}
135
136const MCPhysReg *
138 static const MCPhysReg CalleeSavedRegsV3[] = {
139 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
140 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23,
141 Hexagon::R24, Hexagon::R25, Hexagon::R26, Hexagon::R27, 0
142 };
143
144 // Functions that contain a call to __builtin_eh_return also save the first 4
145 // parameter registers.
146 static const MCPhysReg CalleeSavedRegsV3EHReturn[] = {
147 Hexagon::R0, Hexagon::R1, Hexagon::R2, Hexagon::R3,
148 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19,
149 Hexagon::R20, Hexagon::R21, Hexagon::R22, Hexagon::R23,
150 Hexagon::R24, Hexagon::R25, Hexagon::R26, Hexagon::R27, 0
151 };
152
153 bool HasEHReturn = MF->getInfo<HexagonMachineFunctionInfo>()->hasEHReturn();
154
155 if (hasHLXSignature(*MF))
156 return HasEHReturn ? HexagonCSR_HLX_EH_SaveList : HexagonCSR_HLX_SaveList;
157 return HasEHReturn ? CalleeSavedRegsV3EHReturn : CalleeSavedRegsV3;
158}
159
161 const MachineFunction &MF, CallingConv::ID) const {
162 return HexagonCSR_RegMask;
163}
164
166 return HexagonCSR_HLX_RegMask;
167}
168
171 BitVector Reserved = getBaseReservedRegs(MF);
173 Reserved.set(AP);
174 markSuperRegs(Reserved, AP);
175 }
176 return Reserved;
177}
178
180 const MachineFunction &MF) const {
181 return computeStackAlignBaseRegister(MF, getBaseReservedRegs(MF));
182}
183
185 const MachineFunction &MF, const BitVector &BaseReservedRegs) const {
186 auto &HFI = *MF.getSubtarget<HexagonSubtarget>().getFrameLowering();
187 if (!HFI.needsAligna(MF))
188 return Register();
189
190 // Reserve the first non-volatile register.
191 Register AP;
192 for (const MCPhysReg *R = getCalleeSavedRegs(&MF); *R; ++R) {
193 if (BaseReservedRegs[*R])
194 continue;
195 AP = *R;
196 break;
197 }
198 assert(AP.isValid() && "Couldn't reserve stack align register");
199 return AP;
200}
201
203HexagonRegisterInfo::getBaseReservedRegs(const MachineFunction &MF) const {
204 BitVector Reserved(getNumRegs());
205 Reserved.set(Hexagon::R29);
206 Reserved.set(Hexagon::R30);
207 Reserved.set(Hexagon::R31);
208 Reserved.set(Hexagon::VTMP);
209
210 // Guest registers.
211 Reserved.set(Hexagon::GELR); // G0
212 Reserved.set(Hexagon::GSR); // G1
213 Reserved.set(Hexagon::GOSP); // G2
214 Reserved.set(Hexagon::G3); // G3
215
216 // Control registers.
217 Reserved.set(Hexagon::SA0); // C0
218 Reserved.set(Hexagon::LC0); // C1
219 Reserved.set(Hexagon::SA1); // C2
220 Reserved.set(Hexagon::LC1); // C3
221 Reserved.set(Hexagon::P3_0); // C4
222 Reserved.set(Hexagon::USR); // C8
223 Reserved.set(Hexagon::PC); // C9
224 Reserved.set(Hexagon::UGP); // C10
225 Reserved.set(Hexagon::GP); // C11
226 Reserved.set(Hexagon::UPCYCLELO); // C14
227 Reserved.set(Hexagon::UPCYCLEHI); // C15
228 Reserved.set(Hexagon::FRAMELIMIT); // C16
229 Reserved.set(Hexagon::FRAMEKEY); // C17
230 Reserved.set(Hexagon::PKTCOUNTLO); // C18
231 Reserved.set(Hexagon::PKTCOUNTHI); // C19
232 Reserved.set(Hexagon::VFRAMELIMIT); // C28
233 Reserved.set(Hexagon::VSP); // C29
234 Reserved.set(Hexagon::UTIMERLO); // C30
235 Reserved.set(Hexagon::UTIMERHI); // C31
236 // Out of the control registers, only C8 is explicitly defined in
237 // HexagonRegisterInfo.td. If others are defined, make sure to add
238 // them here as well.
239 Reserved.set(Hexagon::C8);
240 Reserved.set(Hexagon::USR_OVF);
241
242 // For v79, reserve a vector register to store a vector of zeroes if there
243 // are QFloat-generating instructions in the function in legacy mode. For
244 // non-legacy modes, always reserve V30.
245 const HexagonSubtarget &HST = MF.getSubtarget<HexagonSubtarget>();
246 if (HST.useHVXV79OpsOnly()) {
248 HST.getInstrInfo()->hasQFPInstrs(MF))
249 Reserved.set(Hexagon::V30);
250 }
251
252 // Leveraging these registers will require more work to recognize
253 // the new semantics posed, Hi/LoVec patterns, etc.
254 // Note well: if enabled, they should be restricted to only
255 // where `HST.useHVXOps() && HST.hasV67Ops()` is true.
256 for (auto Reg : Hexagon_MC::GetVectRegRev())
257 Reserved.set(Reg);
258
259 static const MCPhysReg RRegs[] = {
260 Hexagon::R6, Hexagon::R7, Hexagon::R8, Hexagon::R9, Hexagon::R10,
261 Hexagon::R11, Hexagon::R12, Hexagon::R13, Hexagon::R14, Hexagon::R15,
262 Hexagon::R16, Hexagon::R17, Hexagon::R18, Hexagon::R19, Hexagon::R20,
263 Hexagon::R21, Hexagon::R22, Hexagon::R23, Hexagon::R24, Hexagon::R25,
264 Hexagon::R26, Hexagon::R27, Hexagon::R28};
265 for (MCPhysReg Reg : RRegs)
267 Reserved.set(Reg);
268
269 for (int x = Reserved.find_first(); x >= 0; x = Reserved.find_next(x))
270 markSuperRegs(Reserved, x);
271
272 return Reserved;
273}
274
276 int SPAdj, unsigned FIOp,
277 RegScavenger *RS) const {
278 static unsigned ReuseCount = 0;
279 //
280 // Hexagon_TODO: Do we need to enforce this for Hexagon?
281 assert(SPAdj == 0 && "Unexpected");
282
283 MachineInstr &MI = *II;
284 MachineBasicBlock &MB = *MI.getParent();
285 MachineFunction &MF = *MB.getParent();
286 auto &HST = MF.getSubtarget<HexagonSubtarget>();
287 auto &HII = *HST.getInstrInfo();
288 auto &HFI = *HST.getFrameLowering();
289
290 Register BP;
291 int FI = MI.getOperand(FIOp).getIndex();
292 // Select the base pointer (BP) and calculate the actual offset from BP
293 // to the beginning of the object at index FI.
294 int Offset = HFI.getFrameIndexReference(MF, FI, BP).getFixed();
295 unsigned Opc = MI.getOpcode();
296 bool IsBaseOnlyHLX =
297 Opc == Hexagon::LX_L16b_pseudo || Opc == Hexagon::LX_S16b_pseudo;
298 // Add the offset from the instruction.
299 int RealOffset =
300 Offset + (IsBaseOnlyHLX ? 0 : MI.getOperand(FIOp + 1).getImm());
301
302 if (BP == Hexagon::VSP) {
303 auto &MRI = MF.getRegInfo();
304 Register VSPCopy = MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
305 BuildMI(MB, II, MI.getDebugLoc(), HII.get(Hexagon::A2_tfrcrr), VSPCopy)
306 .addReg(BP);
307 BP = VSPCopy;
308
309 // HLX memory operations take a complete scalar address and do not have an
310 // immediate offset operand. Materialize the VTCM address before replacing
311 // their frame index.
312 if (IsBaseOnlyHLX) {
313 Register Addr = MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
314 BuildMI(MB, II, MI.getDebugLoc(), HII.get(Hexagon::A2_addi), Addr)
315 .addReg(BP)
316 .addImm(RealOffset);
317 MI.getOperand(FIOp).ChangeToRegister(Addr, false, false, true);
318 return false;
319 }
320 }
321
322 switch (Opc) {
323 case Hexagon::PS_fia:
324 MI.setDesc(HII.get(Hexagon::A2_addi));
325 MI.getOperand(FIOp).ChangeToImmediate(RealOffset);
326 MI.removeOperand(FIOp+1);
327 return false;
328 case Hexagon::PS_fi:
329 // Set up the instruction for updating below.
330 MI.setDesc(HII.get(Hexagon::A2_addi));
331 break;
332 }
333
334 if (!HII.isValidOffset(Opc, RealOffset)) {
335 // If the offset is not valid, calculate the address in a temporary
336 // register and use it with offset 0.
337 int InstOffset = 0;
338 // The actual base register (BP) is typically shared between many
339 // instructions where frame indices are being replaced. In scalar
340 // instructions the offset range is large, and the need for an extra
341 // add instruction is infrequent. Vector loads/stores, however, have
342 // a much smaller offset range: [-8, 7), or #s4. In those cases it
343 // makes sense to "standardize" the immediate in the "addi" instruction
344 // so that multiple loads/stores could be based on it.
345 bool IsPair = false;
346 switch (MI.getOpcode()) {
347 // All of these instructions have the same format: base+#s4.
348 case Hexagon::PS_vloadrw_ai:
349 case Hexagon::PS_vloadrw_nt_ai:
350 case Hexagon::PS_vstorerw_ai:
351 case Hexagon::PS_vstorerw_nt_ai:
352 IsPair = true;
353 [[fallthrough]];
354 case Hexagon::PS_vloadrv_ai:
355 case Hexagon::PS_vloadrv_nt_ai:
356 case Hexagon::PS_vstorerv_ai:
357 case Hexagon::PS_vstorerv_nt_ai:
358 case Hexagon::V6_vL32b_ai:
359 case Hexagon::V6_vS32b_ai: {
360 unsigned HwLen = HST.getVectorLength();
361 if (RealOffset % HwLen == 0) {
362 int VecOffset = RealOffset / HwLen;
363 // Rewrite the offset as "base + [-8, 7)".
364 VecOffset += 8;
365 // Pairs are expanded into two instructions: make sure that both
366 // can use the same base (i.e. VecOffset+1 is not a different
367 // multiple of 16 than VecOffset).
368 if (!IsPair || (VecOffset + 1) % 16 != 0) {
369 RealOffset = (VecOffset & -16) * HwLen;
370 InstOffset = (VecOffset % 16 - 8) * HwLen;
371 }
372 }
373 }
374 }
375
376 // Search backwards in the block for "Reg = A2_addi BP, RealOffset".
377 // This will give us a chance to avoid creating a new register.
378 Register ReuseBP;
379
380 if (ReuseCount < HST.getCLOpts().frame_index_reuse_limit) {
381 unsigned SearchCount = 0,
382 SearchRange = HST.getCLOpts().frame_index_search_range;
383 SmallSet<Register,2> SeenVRegs;
384 bool PassedCall = false;
385 LiveRegUnits Defs(*this), Uses(*this);
386
387 for (auto I = std::next(II.getReverse()), E = MB.rend(); I != E; ++I) {
388 if (SearchCount == SearchRange)
389 break;
390 ++SearchCount;
391 const MachineInstr &BI = *I;
393 PassedCall |= BI.isCall();
394 for (const MachineOperand &Op : BI.operands()) {
395 if (SeenVRegs.size() > 1)
396 break;
397 if (Op.isReg() && Op.getReg().isVirtual())
398 SeenVRegs.insert(Op.getReg());
399 }
400 if (BI.getOpcode() != Hexagon::A2_addi)
401 continue;
402 if (BI.getOperand(1).getReg() != BP)
403 continue;
404 const auto &Op2 = BI.getOperand(2);
405 if (!Op2.isImm() || Op2.getImm() != RealOffset)
406 continue;
407
408 Register R = BI.getOperand(0).getReg();
409 if (R.isPhysical()) {
410 if (Defs.available(R))
411 ReuseBP = R;
412 } else if (R.isVirtual()) {
413 // Extending a range of a virtual register can be dangerous,
414 // since the scavenger will need to find a physical register
415 // for it. Avoid extending the range past a function call,
416 // and avoid overlapping it with another virtual register.
417 if (!PassedCall && SeenVRegs.size() <= 1)
418 ReuseBP = R;
419 }
420 break;
421 }
422 if (ReuseBP)
423 ++ReuseCount;
424 }
425
426 auto &MRI = MF.getRegInfo();
427 if (!ReuseBP) {
428 ReuseBP = MRI.createVirtualRegister(&Hexagon::IntRegsRegClass);
429 const DebugLoc &DL = MI.getDebugLoc();
430 BuildMI(MB, II, DL, HII.get(Hexagon::A2_addi), ReuseBP)
431 .addReg(BP)
432 .addImm(RealOffset);
433 }
434 BP = ReuseBP;
435 RealOffset = InstOffset;
436 }
437
438 MI.getOperand(FIOp).ChangeToRegister(BP, false, false, false);
439 MI.getOperand(FIOp+1).ChangeToImmediate(RealOffset);
440 return false;
441}
442
443
445 const TargetRegisterClass *SrcRC, unsigned SubReg,
446 const TargetRegisterClass *DstRC, unsigned DstSubReg,
447 const TargetRegisterClass *NewRC, LiveIntervals &LIS) const {
448 // Coalescing will extend the live interval of the destination register.
449 // If the destination register is a vector pair, avoid introducing function
450 // calls into the interval, since it could result in a spilling of a pair
451 // instead of a single vector.
452 MachineFunction &MF = *MI->getParent()->getParent();
454 if (!HST.useHVXOps() || NewRC->getID() != Hexagon::HvxWRRegClass.getID())
455 return true;
456 bool SmallSrc = SrcRC->getID() == Hexagon::HvxVRRegClass.getID();
457 bool SmallDst = DstRC->getID() == Hexagon::HvxVRRegClass.getID();
458 if (!SmallSrc && !SmallDst)
459 return true;
460
461 Register DstReg = MI->getOperand(0).getReg();
462 Register SrcReg = MI->getOperand(1).getReg();
463 const SlotIndexes &Indexes = *LIS.getSlotIndexes();
464 auto HasCall = [&Indexes] (const LiveInterval::Segment &S) {
465 for (SlotIndex I = S.start.getBaseIndex(), E = S.end.getBaseIndex();
466 I != E; I = I.getNextIndex()) {
467 if (const MachineInstr *MI = Indexes.getInstructionFromIndex(I))
468 if (MI->isCall())
469 return true;
470 }
471 return false;
472 };
473
474 if (SmallSrc == SmallDst) {
475 // Both must be true, because the case for both being false was
476 // checked earlier. Both registers will be coalesced into a register
477 // of a wider class (HvxWR), and we don't want its live range to
478 // span over calls.
479 return !any_of(LIS.getInterval(DstReg), HasCall) &&
480 !any_of(LIS.getInterval(SrcReg), HasCall);
481 }
482
483 // If one register is large (HvxWR) and the other is small (HvxVR), then
484 // coalescing is ok if the large is already live across a function call,
485 // or if the small one is not.
486 Register SmallReg = SmallSrc ? SrcReg : DstReg;
487 Register LargeReg = SmallSrc ? DstReg : SrcReg;
488 return any_of(LIS.getInterval(LargeReg), HasCall) ||
489 !any_of(LIS.getInterval(SmallReg), HasCall);
490}
491
492
494 &MF) const {
495 const HexagonFrameLowering *TFI = getFrameLowering(MF);
496 if (TFI->hasFP(MF))
497 return getFrameRegister();
498 return getStackRegister();
499}
500
501
503 return Hexagon::R30;
504}
505
506
508 return Hexagon::R29;
509}
510
512 return Hexagon::VSP;
513}
514
516 const TargetRegisterClass &RC, unsigned GenIdx) const {
517 assert(GenIdx == Hexagon::ps_sub_lo || GenIdx == Hexagon::ps_sub_hi);
518
519 static const unsigned ISub[] = { Hexagon::isub_lo, Hexagon::isub_hi };
520 static const unsigned VSub[] = { Hexagon::vsub_lo, Hexagon::vsub_hi };
521 static const unsigned WSub[] = { Hexagon::wsub_lo, Hexagon::wsub_hi };
522
523 switch (RC.getID()) {
524 case Hexagon::CtrRegs64RegClassID:
525 case Hexagon::DoubleRegsRegClassID:
526 case Hexagon::CircRegsRegClassID:
527 return ISub[GenIdx];
528 case Hexagon::HvxWRRegClassID:
529 case Hexagon::HlxLLRRegClassID:
530 return VSub[GenIdx];
531 case Hexagon::HvxVQRRegClassID:
532 return WSub[GenIdx];
533 }
534
535 if (!RC.superclasses().empty())
537 GenIdx);
538
539 llvm_unreachable("Invalid register class");
540}
541
543 const {
544 return MF.getSubtarget<HexagonSubtarget>().getFrameLowering()->hasFP(MF);
545}
static const TargetRegisterClass * getRegClass(const MachineInstr &MI, Register Reg)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file implements the BitVector class.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
cl::opt< QFloatMode > QFloatModeValue
static bool hasHLXSignature(const MachineFunction &MF)
IRTranslator LLVM IR MI
A set of register units.
unsigned Opc
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
#define R4(n)
#define R2(n)
#define R6(n)
Promote Memory to Register
Definition Mem2Reg.cpp:110
uint64_t IntrinsicInst * II
MachineRegisterInfo & MRI
This file declares the machine register scavenger class.
Remove Loads Into Fake Uses
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallSet class.
LocallyHashedType DenseMapInfo< LocallyHashedType >::Empty
This class represents an incoming formal argument to a Function.
Definition Argument.h:32
iterator begin() const
Definition ArrayRef.h:129
bool empty() const
Check if the array is empty.
Definition ArrayRef.h:136
A debug info location.
Definition DebugLoc.h:126
bool hasQFPInstrs(const MachineFunction &MF) const
Hexagon target-specific information for each MachineFunction.
bool eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj, unsigned FIOperandNum, RegScavenger *RS=nullptr) const override
bool isEHReturnCalleeSaveReg(Register Reg) const
BitVector getReservedRegs(const MachineFunction &MF) const override
Register computeStackAlignBaseRegister(const MachineFunction &MF) const
Compute the first available callee-saved register to use as the aligned-stack base register when this...
bool useFPForScavengingIndex(const MachineFunction &MF) const override
Returns true if the frame pointer is valid.
const uint32_t * getHLXCallPreservedMask() const
Mask for calls that pass or return values in HLX registers.
const MCPhysReg * getCalleeSavedRegs(const MachineFunction *MF) const override
Code Generation virtual methods...
unsigned getHexagonSubRegIndex(const TargetRegisterClass &RC, unsigned GenIdx) const
bool shouldCoalesce(MachineInstr *MI, const TargetRegisterClass *SrcRC, unsigned SubReg, const TargetRegisterClass *DstRC, unsigned DstSubReg, const TargetRegisterClass *NewRC, LiveIntervals &LIS) const override
const uint32_t * getCallPreservedMask(const MachineFunction &MF, CallingConv::ID) const override
bool isFakeReg(MCPhysReg Reg) const
Returns true if the given reserved physical register Reg is live across function calls/returns.
const MCPhysReg * getCallerSavedRegs(const MachineFunction *MF, const TargetRegisterClass *RC) const
bool isGlobalReg(MCPhysReg Reg) const
Returns true if the given reserved physical register is live across function calls/returns.
const HexagonInstrInfo * getInstrInfo() const override
const HexagonFrameLowering * getFrameLowering() const override
unsigned getVectorLength() const
const HexagonOptions & getCLOpts() const
SlotIndexes * getSlotIndexes() const
LiveInterval & getInterval(Register Reg)
A set of register units used to track register liveness.
static void accumulateUsedDefed(const MachineInstr &MI, LiveRegUnits &ModifiedRegUnits, LiveRegUnits &UsedRegUnits, const TargetRegisterInfo *TRI)
For a machine instruction MI, adds all register units used in UsedRegUnits and defined or clobbered i...
ArrayRef< unsigned > superclasses() const
Returns a list of super-classes.
unsigned getID() const
getID() - Return the register class ID number.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
MachineInstrBundleIterator< MachineInstr > iterator
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineInstrBuilder & addReg(Register RegNo, RegState Flags={}, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
bool isCall(QueryType Type=AnyInBundle) const
mop_range operands()
const MachineOperand & getOperand(unsigned i) const
MachineOperand class - Representation of each machine instruction operand.
Register getReg() const
getReg - Returns the register number.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
constexpr bool isValid() const
Definition Register.h:109
SlotIndex - An opaque wrapper around machine indexes.
Definition SlotIndexes.h:70
SlotIndexes pass.
MachineInstr * getInstructionFromIndex(SlotIndex index) const
Returns the instruction for the given index, or null if the given index has no instruction associated...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition SmallSet.h:134
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
Definition SmallSet.h:184
size_type size() const
Definition SmallSet.h:171
bool hasFP(const MachineFunction &MF) const
hasFP - Return true if the specified function should have a dedicated frame pointer register.
virtual bool isRegisterReservedByUser(Register R) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
llvm::ArrayRef< MCPhysReg > GetVectRegRev()
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1762
MachineInstr * getImm(const MachineOperand &MO, const MachineRegisterInfo *MRI)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
Definition MCRegister.h:21
DWARFExpression::Operation Op
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
This represents a simple continuous liveness interval for a value.