LLVM 24.0.0git
DelaySlotFiller.cpp
Go to the documentation of this file.
1//===-- DelaySlotFiller.cpp - SPARC delay slot filler ---------------------===//
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 is a simple local pass that attempts to fill delay slots with useful
10// instructions. If no instructions can be moved into the delay slot, then a
11// NOP is placed.
12//===----------------------------------------------------------------------===//
13
14#include "Sparc.h"
15#include "SparcSubtarget.h"
16#include "llvm/ADT/SmallSet.h"
17#include "llvm/ADT/Statistic.h"
25#include "llvm/IR/Analysis.h"
26#include "llvm/Pass.h"
28
29using namespace llvm;
30
31#define DEBUG_TYPE "delay-slot-filler"
32
33STATISTIC(FilledSlots, "Number of delay slots filled");
34
35namespace {
36struct SparcDelaySlotFillerLegacy : public MachineFunctionPass {
37 static char ID;
38 SparcDelaySlotFillerLegacy() : MachineFunctionPass(ID) {}
39
40 StringRef getPassName() const override { return "SPARC Delay Slot Filler"; }
41
42 bool runOnMachineFunction(MachineFunction &MF) override;
43
44 MachineFunctionProperties getRequiredProperties() const override {
45 return MachineFunctionProperties().setNoVRegs();
46 }
47
48 void getAnalysisUsage(AnalysisUsage &AU) const override {
49 AU.setPreservesCFG();
51 }
52};
53char SparcDelaySlotFillerLegacy::ID = 0;
54} // end of anonymous namespace
55
56/// createSparcDelaySlotFillerPass - Returns a pass that fills in delay
57/// slots in Sparc MachineFunctions
58///
60 return new SparcDelaySlotFillerLegacy;
61}
62
66 const TargetInstrInfo *TII) {
67 // Before: add <op0>, <op1>, %i[0-7]
68 // restore %g0, %g0, %i[0-7]
69 //
70 // After : restore <op0>, <op1>, %o[0-7]
71
72 const TargetRegisterInfo *TRI = &TII->getRegisterInfo();
73 Register reg = AddMI->getOperand(0).getReg();
74 if (reg < SP::I0 || reg > SP::I7)
75 return false;
76
77 // Check whether it uses %o7 as its source and the corresponding branch
78 // instruction is a call.
79 MachineBasicBlock::iterator LastInst = MBB.getFirstTerminator();
80 bool IsCall = LastInst != MBB.end() && LastInst->isCall();
81
82 if (IsCall && AddMI->getOpcode() == SP::ADDrr &&
83 AddMI->readsRegister(SP::O7, TRI))
84 return false;
85
86 if (IsCall && AddMI->getOpcode() == SP::ADDri &&
87 AddMI->readsRegister(SP::O7, TRI))
88 return false;
89
90 // Erase RESTORE.
91 RestoreMI->eraseFromParent();
92
93 // Change ADD to RESTORE.
94 AddMI->setDesc(TII->get((AddMI->getOpcode() == SP::ADDrr) ? SP::RESTORErr
95 : SP::RESTOREri));
96
97 // Map the destination register.
98 AddMI->getOperand(0).setReg(reg - SP::I0 + SP::O0);
99
100 return true;
101}
102
106 const TargetInstrInfo *TII) {
107 // Before: or <op0>, <op1>, %i[0-7]
108 // restore %g0, %g0, %i[0-7]
109 // and <op0> or <op1> is zero,
110 //
111 // After : restore <op0>, <op1>, %o[0-7]
112
113 const TargetRegisterInfo *TRI = &TII->getRegisterInfo();
114 Register reg = OrMI->getOperand(0).getReg();
115 if (reg < SP::I0 || reg > SP::I7)
116 return false;
117
118 // check whether it is a copy.
119 if (OrMI->getOpcode() == SP::ORrr && OrMI->getOperand(1).getReg() != SP::G0 &&
120 OrMI->getOperand(2).getReg() != SP::G0)
121 return false;
122
123 if (OrMI->getOpcode() == SP::ORri && OrMI->getOperand(1).getReg() != SP::G0 &&
124 (!OrMI->getOperand(2).isImm() || OrMI->getOperand(2).getImm() != 0))
125 return false;
126
127 // Check whether it uses %o7 as its source and the corresponding branch
128 // instruction is a call.
129 MachineBasicBlock::iterator LastInst = MBB.getFirstTerminator();
130 bool IsCall = LastInst != MBB.end() && LastInst->isCall();
131
132 if (IsCall && OrMI->getOpcode() == SP::ORrr &&
133 OrMI->readsRegister(SP::O7, TRI))
134 return false;
135
136 // Erase RESTORE.
137 RestoreMI->eraseFromParent();
138
139 // Change OR to RESTORE.
140 OrMI->setDesc(TII->get((OrMI->getOpcode() == SP::ORrr) ? SP::RESTORErr
141 : SP::RESTOREri));
142
143 // Map the destination register.
144 OrMI->getOperand(0).setReg(reg - SP::I0 + SP::O0);
145
146 return true;
147}
148
151 const TargetInstrInfo *TII) {
152 // Before: sethi imm3, %i[0-7]
153 // restore %g0, %g0, %g0
154 //
155 // After : restore %g0, (imm3<<10), %o[0-7]
156
157 Register reg = SetHiMI->getOperand(0).getReg();
158 if (reg < SP::I0 || reg > SP::I7)
159 return false;
160
161 if (!SetHiMI->getOperand(1).isImm())
162 return false;
163
164 int64_t imm = SetHiMI->getOperand(1).getImm();
165
166 // Is it a 3 bit immediate?
167 if (!isInt<3>(imm))
168 return false;
169
170 // Make it a 13 bit immediate.
171 imm = (imm << 10) & 0x1FFF;
172
173 assert(RestoreMI->getOpcode() == SP::RESTORErr);
174
175 RestoreMI->setDesc(TII->get(SP::RESTOREri));
176
177 RestoreMI->getOperand(0).setReg(reg - SP::I0 + SP::O0);
178 RestoreMI->getOperand(1).setReg(SP::G0);
179 RestoreMI->getOperand(2).ChangeToImmediate(imm);
180
181 // Erase the original SETHI.
182 SetHiMI->eraseFromParent();
183
184 return true;
185}
186
189 const SparcSubtarget *Subtarget) {
190 // No previous instruction.
191 if (MBBI == MBB.begin())
192 return false;
193
194 // assert that MBBI is a "restore %g0, %g0, %g0".
195 assert(MBBI->getOpcode() == SP::RESTORErr &&
196 MBBI->getOperand(0).getReg() == SP::G0 &&
197 MBBI->getOperand(1).getReg() == SP::G0 &&
198 MBBI->getOperand(2).getReg() == SP::G0);
199
200 // Debug instructions between the two must not prevent the combination, so
201 // that the code does not depend on the debug info.
203 skipDebugInstructionsBackward(std::prev(MBBI), MBB.begin());
204 if (PrevInst->isDebugInstr())
205 return false;
206
207 // It cannot be combined with a bundled instruction.
208 if (PrevInst->isBundledWithSucc())
209 return false;
210
211 const TargetInstrInfo *TII = Subtarget->getInstrInfo();
212
213 // The debug values between PrevInst and the restore that refer to the
214 // register PrevInst defines. The combined restore defines an output register
215 // of the caller's window instead, so they become invalid.
217 if (PrevInst->getNumOperands() && PrevInst->getOperand(0).isReg())
218 for (MachineInstr &MI : make_range(std::next(PrevInst), MBBI))
219 if (MI.isDebugValue() &&
220 MI.hasDebugOperandForReg(PrevInst->getOperand(0).getReg()))
221 DbgValues.push_back(&MI);
222
223 bool Combined = false;
224 switch (PrevInst->getOpcode()) {
225 default:
226 break;
227 case SP::ADDrr:
228 case SP::ADDri:
229 Combined = combineRestoreADD(MBB, MBBI, PrevInst, TII);
230 break;
231 case SP::ORrr:
232 case SP::ORri:
233 Combined = combineRestoreOR(MBB, MBBI, PrevInst, TII);
234 break;
235 case SP::SETHIi:
236 Combined = combineRestoreSETHIi(MBBI, PrevInst, TII);
237 break;
238 }
239 if (Combined)
240 for (MachineInstr *MI : DbgValues)
241 MI->setDebugValueUndef();
242 return Combined;
243}
244
245/// The restore before a tail call must run in its delay slot: `jmp %reg`
246/// reads a register of the current window, and `call` writes %o7. For the
247/// same reason a leaf `call` needs the copy of %o7 back from %g1 that
248/// SparcFrameLowering emits.
252 unsigned Opc = slot->getOpcode();
253 if ((Opc != SP::TAIL_CALL && Opc != SP::TAIL_CALLri) || slot == MBB.begin())
254 return MBB.end();
255
257 skipMetaInstructionsBackward(std::prev(slot), MBB.begin());
258
259 if (J->getOpcode() == SP::RESTORErr || J->getOpcode() == SP::RESTOREri)
260 return J;
261 if (Opc == SP::TAIL_CALL && J->getOpcode() == SP::ORrr &&
262 J->getOperand(0).getReg() == SP::O7)
263 return J;
264 return MBB.end();
265}
266
268 SmallSet<unsigned, 32> &RegDefs,
269 SmallSet<unsigned, 32> &RegUses) {
270 // Regular calls define o7, which is visible to the instruction in delay slot.
271 // On the other hand, tail calls preserve it.
272 switch (MI->getOpcode()) {
273 default:
274 llvm_unreachable("Unknown opcode.");
275 case SP::CALL:
276 RegDefs.insert(SP::O7);
277 break;
278 case SP::TAIL_CALL:
279 break;
280 case SP::CALLrr:
281 case SP::CALLri:
282 RegDefs.insert(SP::O7);
283 [[fallthrough]];
284 case SP::TAIL_CALLri:
285 assert(MI->getNumOperands() >= 2);
286 const MachineOperand &Reg = MI->getOperand(0);
287 assert(Reg.isReg() && "CALL first operand is not a register.");
288 assert(Reg.isUse() && "CALL first operand is not a use.");
289 RegUses.insert(Reg.getReg());
290
291 const MachineOperand &Operand1 = MI->getOperand(1);
292 if (Operand1.isImm() || Operand1.isGlobal())
293 break;
294 assert(Operand1.isReg() && "CALLrr second operand is not a register.");
295 assert(Operand1.isUse() && "CALLrr second operand is not a use.");
296 RegUses.insert(Operand1.getReg());
297 break;
298 }
299}
300
301// Insert Defs and Uses of MI into the sets RegDefs and RegUses.
303 SmallSet<unsigned, 32> &RegDefs,
304 SmallSet<unsigned, 32> &RegUses,
305 const SparcSubtarget *Subtarget) {
306 for (const MachineOperand &MO : MI->operands()) {
307 if (!MO.isReg())
308 continue;
309
310 Register Reg = MO.getReg();
311 if (Reg == 0 || Subtarget->getRegisterInfo()->isConstantPhysReg(Reg))
312 continue;
313 if (MO.isDef())
314 RegDefs.insert(Reg);
315 if (MO.isUse()) {
316 // Implicit register uses of retl are return values and
317 // retl does not use them.
318 if (MO.isImplicit() && MI->getOpcode() == SP::RETL)
319 continue;
320 RegUses.insert(Reg);
321 }
322 }
323}
324
325// returns true if the Reg or its alias is in the RegSet.
326static bool IsRegInSet(SmallSet<unsigned, 32> &RegSet, unsigned Reg,
327 const SparcSubtarget *Subtarget) {
328 // Check Reg and all aliased Registers.
329 for (MCRegAliasIterator AI(Reg, Subtarget->getRegisterInfo(), true);
330 AI.isValid(); ++AI)
331 if (RegSet.count(*AI))
332 return true;
333 return false;
334}
335
336static bool delayHasHazard(MachineBasicBlock::iterator candidate, bool &sawLoad,
337 bool &sawStore, SmallSet<unsigned, 32> &RegDefs,
338 SmallSet<unsigned, 32> &RegUses,
339 const SparcSubtarget *Subtarget) {
340
341 if (candidate->isImplicitDef() || candidate->isKill())
342 return true;
343
344 if (candidate->mayLoad()) {
345 sawLoad = true;
346 if (sawStore)
347 return true;
348 }
349
350 if (candidate->mayStore()) {
351 if (sawStore)
352 return true;
353 sawStore = true;
354 if (sawLoad)
355 return true;
356 }
357
358 for (const MachineOperand &MO : candidate->operands()) {
359 if (!MO.isReg())
360 continue; // skip
361
362 Register Reg = MO.getReg();
363
364 if (MO.isDef()) {
365 // check whether Reg is defined or used before delay slot.
366 if (IsRegInSet(RegDefs, Reg, Subtarget) ||
367 IsRegInSet(RegUses, Reg, Subtarget))
368 return true;
369 }
370 if (MO.isUse()) {
371 // check whether Reg is defined before delay slot.
372 if (IsRegInSet(RegDefs, Reg, Subtarget))
373 return true;
374 }
375 }
376
377 unsigned Opcode = candidate->getOpcode();
378 // LD and LDD may have NOPs inserted afterwards in the case of some LEON
379 // processors, so we can't use the delay slot if this feature is switched-on.
380 if (Subtarget->insertNOPLoad()
381 &&
382 Opcode >= SP::LDDArr && Opcode <= SP::LDrr)
383 return true;
384
385 if (Subtarget->fixTN0009() && candidate->mayStore())
386 return true;
387
388 if (Subtarget->fixTN0013()) {
389 switch (Opcode) {
390 case SP::FDIVS:
391 case SP::FDIVD:
392 case SP::FSQRTS:
393 case SP::FSQRTD:
394 return true;
395 default:
396 break;
397 }
398 }
399
400 return false;
401}
402
405 const SparcSubtarget *Subtarget) {
408 bool sawLoad = false;
409 bool sawStore = false;
410
411 if (slot == MBB.begin())
412 return MBB.end();
413
414 unsigned Opc = slot->getOpcode();
415
416 if (Opc == SP::RET || Opc == SP::TLS_CALL)
417 return MBB.end();
418
419 if (Opc == SP::RETL || Opc == SP::TAIL_CALL || Opc == SP::TAIL_CALLri) {
420 // A debug instruction may sit between the restore and the return.
422 skipDebugInstructionsBackward(std::prev(slot), MBB.begin());
423
424 if (J->getOpcode() == SP::RESTORErr || J->getOpcode() == SP::RESTOREri) {
425 // change retl to ret.
426 if (Opc == SP::RETL)
427 slot->setDesc(Subtarget->getInstrInfo()->get(SP::RET));
428 return J;
429 }
430 }
431
432 // Call's delay filler can def some of call's uses.
433 if (slot->isCall())
434 insertCallDefsUses(slot, RegDefs, RegUses);
435 else
436 insertDefsUses(slot, RegDefs, RegUses, Subtarget);
437
438 bool done = false;
439
441
442 while (!done) {
443 done = (I == MBB.begin());
444
445 if (!done)
446 --I;
447
448 // Skip meta instructions.
449 if (I->isMetaInstruction())
450 continue;
451
452 if (I->hasUnmodeledSideEffects() || I->isInlineAsm() || I->isPosition() ||
453 I->hasDelaySlot() || I->isBundledWithSucc())
454 break;
455
456 if (delayHasHazard(I, sawLoad, sawStore, RegDefs, RegUses, Subtarget)) {
457 insertDefsUses(I, RegDefs, RegUses, Subtarget);
458 continue;
459 }
460
461 return I;
462 }
463 return MBB.end();
464}
465
466static bool isWriteY(const MachineInstr &MI) {
467 return (MI.getOpcode() == SP::WRASRrr || MI.getOpcode() == SP::WRASRri) &&
468 MI.getOperand(0).getReg() == SP::Y;
469}
470
471/// On SPARC V8 a write to %y may take until the third instruction after it
472/// completes to take effect, so an instruction that reads %y within that
473/// window (MULScc, RDY, SDIV, SDIVcc, UDIV, UDIVcc) gets an undefined value.
474/// V9 removed the delay. As in GCC, make sure there are at least three
475/// instructions between a WRY and the next reader of %y. This runs after the
476/// delay slots are filled so that the instructions are counted in the order
477/// they execute, and a filled delay slot can no longer shrink the gap.
479 const SparcSubtarget *Subtarget) {
480 if (Subtarget->isV9())
481 return false;
482
483 const SparcInstrInfo *TII = Subtarget->getInstrInfo();
484 const TargetRegisterInfo *TRI = Subtarget->getRegisterInfo();
485 bool Changed = false;
486 // Number of instructions since the last WRY, saturated at 3.
487 unsigned Since = 3;
488 for (auto I = MBB.instr_begin(), E = MBB.instr_end(); I != E; ++I) {
489 // The unimp after a call that returns a struct is skipped by the return.
490 if (I->isMetaInstruction() || I->getOpcode() == SP::UNIMP)
491 continue;
492
493 if (Since < 3 && I->readsRegister(SP::Y, TRI)) {
494 // Never insert inside a bundle, that is between an instruction and its
495 // delay slot. Padding before the bundle also counts the instruction
496 // that owns the delay slot.
497 auto Pos = I;
498 while (Pos->isBundledWithPred())
499 --Pos;
500 for (; Since < 3; ++Since)
501 BuildMI(MBB, Pos, I->getDebugLoc(), TII->get(SP::NOP));
502 Changed = true;
503 }
504
505 if (isWriteY(*I))
506 Since = 0;
507 else if (Since < 3)
508 ++Since;
509 }
510 return Changed;
511}
512
513/// runOnMachineBasicBlock - Fill in delay slots for the given basic block.
514/// We assume there is only one delay slot per delayed instruction.
515///
517 bool Changed = false;
519 &MBB.getParent()->getSubtarget<SparcSubtarget>();
520 bool FillSlots =
521 !Subtarget->getCLOpts().disable_sparc_delay_filler &&
522 MBB.getParent()->getTarget().getOptLevel() != CodeGenOptLevel::None;
523 const SparcInstrInfo *TII = Subtarget->getInstrInfo();
524
525 for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end();) {
527 ++I;
528
529 // If MI is restore, try combining it with previous inst.
530 if (FillSlots && (MI->getOpcode() == SP::RESTORErr ||
531 MI->getOpcode() == SP::RESTOREri)) {
533 continue;
534 }
535
536 // TODO: If we ever want to support v7, this needs to be extended
537 // to cover all floating point operations.
538 if (!Subtarget->isV9() &&
539 (MI->getOpcode() == SP::FCMPS || MI->getOpcode() == SP::FCMPD ||
540 MI->getOpcode() == SP::FCMPQ || MI->getOpcode() == SP::FCMPES ||
541 MI->getOpcode() == SP::FCMPED || MI->getOpcode() == SP::FCMPEQ)) {
542 BuildMI(MBB, I, MI->getDebugLoc(), TII->get(SP::NOP));
543 Changed = true;
544 continue;
545 }
546
547 // If MI has no delay slot, skip.
548 if (!MI->hasDelaySlot())
549 continue;
550
552
553 if (D == MBB.end() && FillSlots)
555
556 ++FilledSlots;
557 Changed = true;
558
559 if (D == MBB.end())
560 BuildMI(MBB, I, MI->getDebugLoc(), TII->get(SP::NOP));
561 else
562 MBB.splice(I, &MBB, D);
563
564 unsigned structSize = 0;
565 if (TII->needsUnimp(*MI, structSize)) {
567 ++J; // skip the delay filler.
568 assert(J != MBB.end() && "MI needs a delay instruction.");
569 BuildMI(MBB, ++J, MI->getDebugLoc(), TII->get(SP::UNIMP))
570 .addImm(structSize);
571 // Bundle the delay filler and unimp with the instruction.
573 } else {
575 }
576 }
578 return Changed;
579}
580
582 bool Changed = false;
583
584 // This pass invalidates liveness information when it reorders
585 // instructions to fill delay slot.
587
588 for (MachineBasicBlock &MBB : MF)
590 return Changed;
591}
592
593bool SparcDelaySlotFillerLegacy::runOnMachineFunction(MachineFunction &MF) {
595}
596
597PreservedAnalyses
const AArch64Subtarget & Subtarget
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const AArch64InstrInfo & TII
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static bool tryCombineRestoreWithPrevInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const SparcSubtarget *Subtarget)
static void insertDefsUses(MachineBasicBlock::iterator MI, SmallSet< unsigned, 32 > &RegDefs, SmallSet< unsigned, 32 > &RegUses, const SparcSubtarget *Subtarget)
static bool combineRestoreADD(MachineBasicBlock &MBB, MachineBasicBlock::iterator RestoreMI, MachineBasicBlock::iterator AddMI, const TargetInstrInfo *TII)
static void insertCallDefsUses(MachineBasicBlock::iterator MI, SmallSet< unsigned, 32 > &RegDefs, SmallSet< unsigned, 32 > &RegUses)
static bool combineRestoreSETHIi(MachineBasicBlock::iterator RestoreMI, MachineBasicBlock::iterator SetHiMI, const TargetInstrInfo *TII)
static MachineBasicBlock::iterator findRequiredDelayInstr(MachineBasicBlock &MBB, MachineBasicBlock::iterator slot)
The restore before a tail call must run in its delay slot: jmp reg reads a register of the current wi...
static bool runDelaySlotFillerOnMachineFunction(MachineFunction &MF)
static bool runOnMachineBasicBlock(MachineBasicBlock &MBB)
runOnMachineBasicBlock - Fill in delay slots for the given basic block.
static MachineBasicBlock::iterator findDelayInstr(MachineBasicBlock &MBB, MachineBasicBlock::iterator slot, const SparcSubtarget *Subtarget)
static bool combineRestoreOR(MachineBasicBlock &MBB, MachineBasicBlock::iterator RestoreMI, MachineBasicBlock::iterator OrMI, const TargetInstrInfo *TII)
static bool isWriteY(const MachineInstr &MI)
static bool padWriteYHazards(MachineBasicBlock &MBB, const SparcSubtarget *Subtarget)
On SPARC V8 a write to y may take until the third instruction after it completes to take effect,...
static bool delayHasHazard(MachineBasicBlock::iterator candidate, bool &sawLoad, bool &sawStore, SmallSet< unsigned, 32 > &RegDefs, SmallSet< unsigned, 32 > &RegUses, const SparcSubtarget *Subtarget)
static bool IsRegInSet(SmallSet< unsigned, 32 > &RegSet, unsigned Reg, const SparcSubtarget *Subtarget)
#define _
IRTranslator LLVM IR MI
unsigned Opc
#define I(x, y, z)
Definition MD5.cpp:57
Register Reg
Register const TargetRegisterInfo * TRI
This file defines the SmallSet class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Definition Statistic.h:170
static bool readsRegister(const MCInst &Inst, const MCInstrDesc &Desc, MCRegister Reg, const MCRegisterInfo &RI)
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Definition Pass.cpp:280
Represents analyses that only rely on functions' control flow.
Definition Analysis.h:73
FunctionPass class - This class is used to implement most global optimizations.
Definition Pass.h:312
MCRegAliasIterator enumerates all registers aliasing Reg.
An RAII based helper class to modify MachineFunctionProperties when running pass.
Helper class for constructing bundles of MachineInstrs.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
Register getReg() const
getReg - Returns the register number.
void invalidateLiveness()
invalidateLiveness - Indicates that register liveness is no longer being tracked accurately.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Definition Analysis.h:151
Wrapper class representing virtual and physical registers.
Definition Register.h:20
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Definition SmallSet.h:134
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
Definition SmallSet.h:176
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
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Pass manager infrastructure for declaring and invalidating analyses.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
constexpr bool isInt(int64_t x)
Checks if an integer fits into the given bit width.
Definition MathExtras.h:166
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
IterT skipMetaInstructionsBackward(IterT It, IterT Begin)
Decrement It until it points to a non-meta instruction or to Begin and return the resulting iterator.
IterT skipDebugInstructionsBackward(IterT It, IterT Begin, bool SkipPseudoOp=true)
Decrement It until it points to a non-debug instruction or to Begin and return the resulting iterator...
FunctionPass * createSparcDelaySlotFillerLegacyPass()
createSparcDelaySlotFillerPass - Returns a pass that fills in delay slots in Sparc MachineFunctions