LLVM 24.0.0git
SparcInstrInfo.cpp
Go to the documentation of this file.
1//===-- SparcInstrInfo.cpp - Sparc Instruction 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 Sparc implementation of the TargetInstrInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "SparcInstrInfo.h"
14#include "Sparc.h"
16#include "SparcSubtarget.h"
24
25using namespace llvm;
26
27#define GET_INSTRINFO_CTOR_DTOR
28#include "SparcGenInstrInfo.inc"
29
30// Pin the vtable to this file.
31void SparcInstrInfo::anchor() {}
32
34 : SparcGenInstrInfo(ST, RI, SP::ADJCALLSTACKDOWN, SP::ADJCALLSTACKUP),
35 RI(ST), Subtarget(ST) {}
36
39 return Subtarget.is64Bit() ? &SP::I64RegsRegClass : &SP::IntRegsRegClass;
40}
41
44 const MachineFunction &MF) const {
45 if (MI.getFlag(MachineInstr::FrameDestroy))
46 return true;
47 switch (MI.getOpcode()) {
48 case SP::SAVErr:
49 case SP::SAVEri:
50 case SP::RESTORErr:
51 case SP::RESTOREri:
52 return true;
53 }
55}
56
57/// isLoadFromStackSlot - If the specified machine instruction is a direct
58/// load from a stack slot, return the virtual or physical register number of
59/// the destination along with the FrameIndex of the loaded stack slot. If
60/// not, return 0. This predicate must return 0 if the instruction has
61/// any side effects other than loading from the stack slot.
63 int &FrameIndex,
64 TypeSize &MemBytes) const {
65 switch (MI.getOpcode()) {
66 default:
67 return 0;
68 case SP::LDri:
69 MemBytes = TypeSize::getFixed(4);
70 break;
71 case SP::LDXri:
72 MemBytes = TypeSize::getFixed(8);
73 break;
74 case SP::LDFri:
75 MemBytes = TypeSize::getFixed(4);
76 break;
77 case SP::LDDFri:
78 MemBytes = TypeSize::getFixed(8);
79 break;
80 case SP::LDQFri:
81 MemBytes = TypeSize::getFixed(16);
82 break;
83 }
84 if (MI.getOperand(1).isFI() && MI.getOperand(2).isImm() &&
85 MI.getOperand(2).getImm() == 0) {
86 FrameIndex = MI.getOperand(1).getIndex();
87 return MI.getOperand(0).getReg();
88 }
89 return 0;
90}
91
92/// isStoreToStackSlot - If the specified machine instruction is a direct
93/// store to a stack slot, return the virtual or physical register number of
94/// the source reg along with the FrameIndex of the loaded stack slot. If
95/// not, return 0. This predicate must return 0 if the instruction has
96/// any side effects other than storing to the stack slot.
98 int &FrameIndex,
99 TypeSize &MemBytes) const {
100 switch (MI.getOpcode()) {
101 default:
102 return 0;
103 case SP::STri:
104 MemBytes = TypeSize::getFixed(4);
105 break;
106 case SP::STXri:
107 MemBytes = TypeSize::getFixed(8);
108 break;
109 case SP::STFri:
110 MemBytes = TypeSize::getFixed(4);
111 break;
112 case SP::STDFri:
113 MemBytes = TypeSize::getFixed(8);
114 break;
115 case SP::STQFri:
116 MemBytes = TypeSize::getFixed(16);
117 break;
118 }
119 if (MI.getOperand(0).isFI() && MI.getOperand(1).isImm() &&
120 MI.getOperand(1).getImm() == 0) {
121 FrameIndex = MI.getOperand(0).getIndex();
122 return MI.getOperand(2).getReg();
123 }
124 return 0;
125}
126
128{
129 switch(CC) {
130 case SPCC::ICC_A: return SPCC::ICC_N;
131 case SPCC::ICC_N: return SPCC::ICC_A;
132 case SPCC::ICC_NE: return SPCC::ICC_E;
133 case SPCC::ICC_E: return SPCC::ICC_NE;
134 case SPCC::ICC_G: return SPCC::ICC_LE;
135 case SPCC::ICC_LE: return SPCC::ICC_G;
136 case SPCC::ICC_GE: return SPCC::ICC_L;
137 case SPCC::ICC_L: return SPCC::ICC_GE;
138 case SPCC::ICC_GU: return SPCC::ICC_LEU;
139 case SPCC::ICC_LEU: return SPCC::ICC_GU;
140 case SPCC::ICC_CC: return SPCC::ICC_CS;
141 case SPCC::ICC_CS: return SPCC::ICC_CC;
142 case SPCC::ICC_POS: return SPCC::ICC_NEG;
143 case SPCC::ICC_NEG: return SPCC::ICC_POS;
144 case SPCC::ICC_VC: return SPCC::ICC_VS;
145 case SPCC::ICC_VS: return SPCC::ICC_VC;
146
147 case SPCC::FCC_A: return SPCC::FCC_N;
148 case SPCC::FCC_N: return SPCC::FCC_A;
149 case SPCC::FCC_U: return SPCC::FCC_O;
150 case SPCC::FCC_O: return SPCC::FCC_U;
151 case SPCC::FCC_G: return SPCC::FCC_ULE;
152 case SPCC::FCC_LE: return SPCC::FCC_UG;
153 case SPCC::FCC_UG: return SPCC::FCC_LE;
154 case SPCC::FCC_ULE: return SPCC::FCC_G;
155 case SPCC::FCC_L: return SPCC::FCC_UGE;
156 case SPCC::FCC_GE: return SPCC::FCC_UL;
157 case SPCC::FCC_UL: return SPCC::FCC_GE;
158 case SPCC::FCC_UGE: return SPCC::FCC_L;
159 case SPCC::FCC_LG: return SPCC::FCC_UE;
160 case SPCC::FCC_UE: return SPCC::FCC_LG;
161 case SPCC::FCC_NE: return SPCC::FCC_E;
162 case SPCC::FCC_E: return SPCC::FCC_NE;
163
164 case SPCC::CPCC_A: return SPCC::CPCC_N;
165 case SPCC::CPCC_N: return SPCC::CPCC_A;
166 case SPCC::CPCC_3: [[fallthrough]];
167 case SPCC::CPCC_2: [[fallthrough]];
168 case SPCC::CPCC_23: [[fallthrough]];
169 case SPCC::CPCC_1: [[fallthrough]];
170 case SPCC::CPCC_13: [[fallthrough]];
171 case SPCC::CPCC_12: [[fallthrough]];
172 case SPCC::CPCC_123: [[fallthrough]];
173 case SPCC::CPCC_0: [[fallthrough]];
174 case SPCC::CPCC_03: [[fallthrough]];
175 case SPCC::CPCC_02: [[fallthrough]];
176 case SPCC::CPCC_023: [[fallthrough]];
177 case SPCC::CPCC_01: [[fallthrough]];
178 case SPCC::CPCC_013: [[fallthrough]];
179 case SPCC::CPCC_012:
180 // "Opposite" code is not meaningful, as we don't know
181 // what the CoProc condition means here. The cond-code will
182 // only be used in inline assembler, so this code should
183 // not be reached in a normal compilation pass.
184 llvm_unreachable("Meaningless inversion of co-processor cond code");
185
186 case SPCC::REG_BEGIN:
187 llvm_unreachable("Use of reserved cond code");
188 case SPCC::REG_Z:
189 return SPCC::REG_NZ;
190 case SPCC::REG_LEZ:
191 return SPCC::REG_GZ;
192 case SPCC::REG_LZ:
193 return SPCC::REG_GEZ;
194 case SPCC::REG_NZ:
195 return SPCC::REG_Z;
196 case SPCC::REG_GZ:
197 return SPCC::REG_LEZ;
198 case SPCC::REG_GEZ:
199 return SPCC::REG_LZ;
200 }
201 llvm_unreachable("Invalid cond code");
202}
203
204static bool isUncondBranchOpcode(int Opc) { return Opc == SP::BA; }
205
206static bool isI32CondBranchOpcode(int Opc) {
207 return Opc == SP::BCOND || Opc == SP::BPICC || Opc == SP::BPICCA ||
208 Opc == SP::BPICCNT || Opc == SP::BPICCANT;
209}
210
211static bool isI64CondBranchOpcode(int Opc) {
212 return Opc == SP::BPXCC || Opc == SP::BPXCCA || Opc == SP::BPXCCNT ||
213 Opc == SP::BPXCCANT;
214}
215
216static bool isRegCondBranchOpcode(int Opc) {
217 return Opc == SP::BPR || Opc == SP::BPRA || Opc == SP::BPRNT ||
218 Opc == SP::BPRANT;
219}
220
221static bool isFCondBranchOpcode(int Opc) {
222 return Opc == SP::FBCOND || Opc == SP::FBCONDA || Opc == SP::FBCOND_V9 ||
223 Opc == SP::FBCONDA_V9;
224}
225
230
231static bool isIndirectBranchOpcode(int Opc) {
232 return Opc == SP::BINDrr || Opc == SP::BINDri;
233}
234
237 unsigned Opc = LastInst->getOpcode();
238 int64_t CC = LastInst->getOperand(1).getImm();
239
240 // Push the branch opcode into Cond too so later in insertBranch
241 // it can use the information to emit the correct SPARC branch opcode.
244
245 // Branch on register contents need another argument to indicate
246 // the register it branches on.
248 Cond.push_back(LastInst->getOperand(2));
249
250 Target = LastInst->getOperand(0).getMBB();
251}
252
255 switch (MI.getOpcode()) {
256 default:
257 llvm_unreachable("unexpected opcode!");
258 case SP::BA:
259 case SP::BCOND:
260 case SP::BCONDA:
261 case SP::FBCOND:
262 case SP::FBCONDA:
263 case SP::BPICC:
264 case SP::BPICCA:
265 case SP::BPICCNT:
266 case SP::BPICCANT:
267 case SP::BPXCC:
268 case SP::BPXCCA:
269 case SP::BPXCCNT:
270 case SP::BPXCCANT:
271 case SP::BPFCC:
272 case SP::BPFCCA:
273 case SP::BPFCCNT:
274 case SP::BPFCCANT:
275 case SP::FBCOND_V9:
276 case SP::FBCONDA_V9:
277 case SP::BPR:
278 case SP::BPRA:
279 case SP::BPRNT:
280 case SP::BPRANT:
281 case SP::CALL_LONGJUMP:
282 return MI.getOperand(0).getMBB();
283 }
284}
285
288 MachineBasicBlock *&FBB,
290 bool AllowModify) const {
291 MachineBasicBlock::iterator I = MBB.getLastNonDebugInstr();
292 if (I == MBB.end())
293 return false;
294
295 if (!isUnpredicatedTerminator(*I))
296 return false;
297
298 // Get the last instruction in the block.
299 MachineInstr *LastInst = &*I;
300 unsigned LastOpc = LastInst->getOpcode();
301
302 // If there is only one terminator instruction, process it.
303 if (I == MBB.begin() || !isUnpredicatedTerminator(*--I)) {
304 if (isUncondBranchOpcode(LastOpc)) {
305 TBB = LastInst->getOperand(0).getMBB();
306 return false;
307 }
308 if (isCondBranchOpcode(LastOpc)) {
309 // Block ends with fall-through condbranch.
310 parseCondBranch(LastInst, TBB, Cond);
311 return false;
312 }
313 return true; // Can't handle indirect branch.
314 }
315
316 // Get the instruction before it if it is a terminator.
317 MachineInstr *SecondLastInst = &*I;
318 unsigned SecondLastOpc = SecondLastInst->getOpcode();
319
320 // If AllowModify is true and the block ends with two or more unconditional
321 // branches, delete all but the first unconditional branch.
322 if (AllowModify && isUncondBranchOpcode(LastOpc)) {
323 while (isUncondBranchOpcode(SecondLastOpc)) {
324 LastInst->eraseFromParent();
325 LastInst = SecondLastInst;
326 LastOpc = LastInst->getOpcode();
327 if (I == MBB.begin() || !isUnpredicatedTerminator(*--I)) {
328 // Return now the only terminator is an unconditional branch.
329 TBB = LastInst->getOperand(0).getMBB();
330 return false;
331 } else {
332 SecondLastInst = &*I;
333 SecondLastOpc = SecondLastInst->getOpcode();
334 }
335 }
336 }
337
338 // If there are three terminators, we don't know what sort of block this is.
339 if (SecondLastInst && I != MBB.begin() && isUnpredicatedTerminator(*--I))
340 return true;
341
342 // If the block ends with a B and a Bcc, handle it.
343 if (isCondBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) {
344 parseCondBranch(SecondLastInst, TBB, Cond);
345 FBB = LastInst->getOperand(0).getMBB();
346 return false;
347 }
348
349 // If the block ends with two unconditional branches, handle it. The second
350 // one is not executed.
351 if (isUncondBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) {
352 TBB = SecondLastInst->getOperand(0).getMBB();
353 return false;
354 }
355
356 // ...likewise if it ends with an indirect branch followed by an unconditional
357 // branch.
358 if (isIndirectBranchOpcode(SecondLastOpc) && isUncondBranchOpcode(LastOpc)) {
359 I = LastInst;
360 if (AllowModify)
361 I->eraseFromParent();
362 return true;
363 }
364
365 // Otherwise, can't handle this.
366 return true;
367}
368
373 const DebugLoc &DL,
374 int *BytesAdded) const {
375 assert(TBB && "insertBranch must not be told to insert a fallthrough");
376 assert((Cond.size() <= 3) &&
377 "Sparc branch conditions should have at most three components!");
378
379 if (Cond.empty()) {
380 assert(!FBB && "Unconditional branch with multiple successors!");
381 BuildMI(&MBB, DL, get(SP::BA)).addMBB(TBB);
382 if (BytesAdded)
383 *BytesAdded = 8;
384 return 1;
385 }
386
387 // Conditional branch
388 unsigned Opc = Cond[0].getImm();
389 unsigned CC = Cond[1].getImm();
392 } else {
394 }
395
396 if (!FBB) {
397 if (BytesAdded)
398 *BytesAdded = 8;
399 return 1;
400 }
401
402 BuildMI(&MBB, DL, get(SP::BA)).addMBB(FBB);
403 if (BytesAdded)
404 *BytesAdded = 16;
405 return 2;
406}
407
409 MachineBasicBlock &NewDestBB,
410 MachineBasicBlock &RestoreBB,
411 const DebugLoc &DL, int64_t BrOffset,
412 RegScavenger *RS) const {
413 assert(RS && "RegScavenger required for long branching");
414 assert(MBB.empty() &&
415 "new block should be inserted for expanding unconditional branch");
416 assert(MBB.pred_size() == 1 && "should only have a single predecessor");
417 assert(RestoreBB.empty() &&
418 "restore block should be inserted for restoring clobbered registers");
419
420 MachineFunction *MF = MBB.getParent();
422
423 if (!isInt<32>(BrOffset))
425 "Branch offsets outside of the signed 32-bit range not supported");
426 RS->enterBasicBlockEnd(MBB);
427
428 // A SPARC CALL instruction already has signed 32-bit range, so we'll use it
429 // instead of actually emitting an indirect branch.
430 //
431 // Note that using CALLs to do unconditional long-range branch in this manner
432 // should only be done if the target is out of range of a regular BA
433 // instruction, given that CALLS will always clobber %o7 and interfere with
434 // the processor's predictor machinery.
435 bool IsO7Used = RS->isRegUsed(SP::O7);
436 Register ScratchReg = RS->FindUnusedReg(&SP::IntRegsRegClass);
437 int FI = SMFI->getBranchRelaxationSpillFrameIndex();
438 if (IsO7Used) {
439 if (ScratchReg.isValid()) {
440 BuildMI(&MBB, DL, get(SP::ORrr), ScratchReg)
441 .addReg(SP::G0)
442 .addReg(SP::O7, RegState::Kill);
443 RS->setRegUsed(ScratchReg);
444 } else {
445 // In case we run out of usable registers we'll spill it into the stack.
446 if (FI == -1)
447 report_fatal_error("The function size is incorrectly estimated.");
448 const MCRegisterClass &RC =
449 Subtarget.is64Bit() ? SP::I64RegsRegClass : SP::IntRegsRegClass;
450
452 storeRegToStackSlot(MBB, I, SP::O7, true, FI, &RC, Register());
453 TRI.eliminateFrameIndex(std::prev(I), 0, 0, RS);
454 }
455 }
456
457 BuildMI(&MBB, DL, get(SP::CALL_LONGJUMP))
458 .addMBB(IsO7Used ? &RestoreBB : &NewDestBB);
459
460 if (IsO7Used) {
461 if (ScratchReg.isValid()) {
462 BuildMI(&RestoreBB, DL, get(SP::ORrr), SP::O7)
463 .addReg(SP::G0)
464 .addReg(ScratchReg, RegState::Kill);
465 } else {
466 const MCRegisterClass &RC =
467 Subtarget.is64Bit() ? SP::I64RegsRegClass : SP::IntRegsRegClass;
468
469 MachineBasicBlock::iterator I = RestoreBB.begin();
470 loadRegFromStackSlot(RestoreBB, I, SP::O7, FI, &RC, Register());
471 TRI.eliminateFrameIndex(std::prev(I), 0, 1, RS);
472 }
473 }
474}
475
477 int *BytesRemoved) const {
479 unsigned Count = 0;
480 int Removed = 0;
481 while (I != MBB.begin()) {
482 --I;
483
484 if (I->isDebugInstr())
485 continue;
486
487 if (!isCondBranchOpcode(I->getOpcode()) &&
488 !isUncondBranchOpcode(I->getOpcode()))
489 break; // Not a branch
490
491 Removed += getInstSizeInBytes(*I);
492 I->eraseFromParent();
493 I = MBB.end();
494 ++Count;
495 }
496
497 if (BytesRemoved)
498 *BytesRemoved = Removed;
499 return Count;
500}
501
504 assert(Cond.size() <= 3);
505 SPCC::CondCodes CC = static_cast<SPCC::CondCodes>(Cond[1].getImm());
507 return false;
508}
509
511 int64_t Offset) const {
512 assert((Offset & 0b11) == 0 && "Malformed branch offset");
513 switch (BranchOpc) {
514 case SP::CALL_LONGJUMP:
515 return isIntN(30, Offset >> 2);
516
517 case SP::BA:
518 case SP::BCOND:
519 case SP::BCONDA:
520 case SP::FBCOND:
521 case SP::FBCONDA:
522 return isIntN(22, Offset >> 2);
523
524 case SP::BPICC:
525 case SP::BPICCA:
526 case SP::BPICCNT:
527 case SP::BPICCANT:
528 case SP::BPXCC:
529 case SP::BPXCCA:
530 case SP::BPXCCNT:
531 case SP::BPXCCANT:
532 case SP::BPFCC:
533 case SP::BPFCCA:
534 case SP::BPFCCNT:
535 case SP::BPFCCANT:
536 case SP::FBCOND_V9:
537 case SP::FBCONDA_V9:
538 return isIntN(Subtarget.getCLOpts().bpcc_offset_bits, Offset >> 2);
539
540 case SP::BPR:
541 case SP::BPRA:
542 case SP::BPRNT:
543 case SP::BPRANT:
544 return isIntN(Subtarget.getCLOpts().bpr_offset_bits, Offset >> 2);
545 }
546
547 llvm_unreachable("Unknown branch instruction!");
548}
549
552 const DebugLoc &DL, Register DestReg,
553 Register SrcReg, bool KillSrc,
554 bool RenamableDest, bool RenamableSrc) const {
555 unsigned numSubRegs = 0;
556 unsigned movOpc = 0;
557 const unsigned *subRegIdx = nullptr;
558 bool ExtraG0 = false;
559
560 const unsigned DW_SubRegsIdx[] = { SP::sub_even, SP::sub_odd };
561 const unsigned DFP_FP_SubRegsIdx[] = { SP::sub_even, SP::sub_odd };
562 const unsigned QFP_DFP_SubRegsIdx[] = { SP::sub_even64, SP::sub_odd64 };
563 const unsigned QFP_FP_SubRegsIdx[] = { SP::sub_even, SP::sub_odd,
564 SP::sub_odd64_then_sub_even,
565 SP::sub_odd64_then_sub_odd };
566
567 if (SP::IntRegsRegClass.contains(DestReg, SrcReg))
568 BuildMI(MBB, I, DL, get(SP::ORrr), DestReg).addReg(SP::G0)
569 .addReg(SrcReg, getKillRegState(KillSrc));
570 else if (SP::IntPairRegClass.contains(DestReg, SrcReg)) {
571 subRegIdx = DW_SubRegsIdx;
572 numSubRegs = 2;
573 movOpc = SP::ORrr;
574 ExtraG0 = true;
575 } else if (SP::FPRegsRegClass.contains(DestReg, SrcReg))
576 BuildMI(MBB, I, DL, get(SP::FMOVS), DestReg)
577 .addReg(SrcReg, getKillRegState(KillSrc));
578 else if (SP::DFPRegsRegClass.contains(DestReg, SrcReg)) {
579 if (Subtarget.isV9()) {
580 BuildMI(MBB, I, DL, get(SP::FMOVD), DestReg)
581 .addReg(SrcReg, getKillRegState(KillSrc));
582 } else {
583 // Use two FMOVS instructions.
584 subRegIdx = DFP_FP_SubRegsIdx;
585 numSubRegs = 2;
586 movOpc = SP::FMOVS;
587 }
588 } else if (SP::QFPRegsRegClass.contains(DestReg, SrcReg)) {
589 if (Subtarget.isV9()) {
590 if (Subtarget.hasHardQuad()) {
591 BuildMI(MBB, I, DL, get(SP::FMOVQ), DestReg)
592 .addReg(SrcReg, getKillRegState(KillSrc));
593 } else {
594 // Use two FMOVD instructions.
595 subRegIdx = QFP_DFP_SubRegsIdx;
596 numSubRegs = 2;
597 movOpc = SP::FMOVD;
598 }
599 } else {
600 // Use four FMOVS instructions.
601 subRegIdx = QFP_FP_SubRegsIdx;
602 numSubRegs = 4;
603 movOpc = SP::FMOVS;
604 }
605 } else if (SP::ASRRegsRegClass.contains(DestReg) &&
606 SP::IntRegsRegClass.contains(SrcReg)) {
607 BuildMI(MBB, I, DL, get(SP::WRASRrr), DestReg)
608 .addReg(SP::G0)
609 .addReg(SrcReg, getKillRegState(KillSrc));
610 } else if (SP::IntRegsRegClass.contains(DestReg) &&
611 SP::ASRRegsRegClass.contains(SrcReg)) {
612 BuildMI(MBB, I, DL, get(SP::RDASR), DestReg)
613 .addReg(SrcReg, getKillRegState(KillSrc));
614 } else
615 llvm_unreachable("Impossible reg-to-reg copy");
616
617 if (numSubRegs == 0 || subRegIdx == nullptr || movOpc == 0)
618 return;
619
621 MachineInstr *MovMI = nullptr;
622
623 for (unsigned i = 0; i != numSubRegs; ++i) {
624 Register Dst = TRI->getSubReg(DestReg, subRegIdx[i]);
625 Register Src = TRI->getSubReg(SrcReg, subRegIdx[i]);
626 assert(Dst && Src && "Bad sub-register");
627
628 MachineInstrBuilder MIB = BuildMI(MBB, I, DL, get(movOpc), Dst);
629 if (ExtraG0)
630 MIB.addReg(SP::G0);
631 MIB.addReg(Src);
632 MovMI = MIB.getInstr();
633 }
634 // Add implicit super-register defs and kills to the last MovMI.
635 MovMI->addRegisterDefined(DestReg, TRI);
636 if (KillSrc)
637 MovMI->addRegisterKilled(SrcReg, TRI);
638}
639
642 Register SrcReg, bool isKill, int FI,
643 const TargetRegisterClass *RC,
644 Register VReg,
645 MachineInstr::MIFlag Flags) const {
646 DebugLoc DL;
647 if (I != MBB.end()) DL = I->getDebugLoc();
648
649 MachineFunction *MF = MBB.getParent();
650 const MachineFrameInfo &MFI = MF->getFrameInfo();
653 MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
654
655 // On the order of operands here: think "[FrameIdx + 0] = SrcReg".
656 if (RC == &SP::I64RegsRegClass)
657 BuildMI(MBB, I, DL, get(SP::STXri)).addFrameIndex(FI).addImm(0)
658 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
659 else if (RC == &SP::IntRegsRegClass)
660 BuildMI(MBB, I, DL, get(SP::STri)).addFrameIndex(FI).addImm(0)
661 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
662 else if (RC == &SP::IntPairRegClass)
663 BuildMI(MBB, I, DL, get(SP::STDri)).addFrameIndex(FI).addImm(0)
664 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
665 else if (RC == &SP::FPRegsRegClass)
666 BuildMI(MBB, I, DL, get(SP::STFri)).addFrameIndex(FI).addImm(0)
667 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
668 else if (SP::DFPRegsRegClass.hasSubClassEq(RC))
669 BuildMI(MBB, I, DL, get(SP::STDFri)).addFrameIndex(FI).addImm(0)
670 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
671 else if (SP::QFPRegsRegClass.hasSubClassEq(RC))
672 // Use STQFri irrespective of its legality. If STQ is not legal, it will be
673 // lowered into two STDs in eliminateFrameIndex.
674 BuildMI(MBB, I, DL, get(SP::STQFri)).addFrameIndex(FI).addImm(0)
675 .addReg(SrcReg, getKillRegState(isKill)).addMemOperand(MMO);
676 else
677 llvm_unreachable("Can't store this register to stack slot");
678}
679
682 Register DestReg, int FI,
683 const TargetRegisterClass *RC,
684 Register VReg, unsigned SubReg,
685 MachineInstr::MIFlag Flags) const {
686 DebugLoc DL;
687 if (I != MBB.end()) DL = I->getDebugLoc();
688
689 MachineFunction *MF = MBB.getParent();
690 const MachineFrameInfo &MFI = MF->getFrameInfo();
693 MFI.getObjectSize(FI), MFI.getObjectAlign(FI));
694
695 if (RC == &SP::I64RegsRegClass)
696 BuildMI(MBB, I, DL, get(SP::LDXri), DestReg).addFrameIndex(FI).addImm(0)
697 .addMemOperand(MMO);
698 else if (RC == &SP::IntRegsRegClass)
699 BuildMI(MBB, I, DL, get(SP::LDri), DestReg).addFrameIndex(FI).addImm(0)
700 .addMemOperand(MMO);
701 else if (RC == &SP::IntPairRegClass)
702 BuildMI(MBB, I, DL, get(SP::LDDri), DestReg).addFrameIndex(FI).addImm(0)
703 .addMemOperand(MMO);
704 else if (RC == &SP::FPRegsRegClass)
705 BuildMI(MBB, I, DL, get(SP::LDFri), DestReg).addFrameIndex(FI).addImm(0)
706 .addMemOperand(MMO);
707 else if (SP::DFPRegsRegClass.hasSubClassEq(RC))
708 BuildMI(MBB, I, DL, get(SP::LDDFri), DestReg).addFrameIndex(FI).addImm(0)
709 .addMemOperand(MMO);
710 else if (SP::QFPRegsRegClass.hasSubClassEq(RC))
711 // Use LDQFri irrespective of its legality. If LDQ is not legal, it will be
712 // lowered into two LDDs in eliminateFrameIndex.
713 BuildMI(MBB, I, DL, get(SP::LDQFri), DestReg).addFrameIndex(FI).addImm(0)
714 .addMemOperand(MMO);
715 else
716 llvm_unreachable("Can't load this register from stack slot");
717}
718
721 Register GlobalBaseReg = SparcFI->getGlobalBaseReg();
722 if (GlobalBaseReg)
723 return GlobalBaseReg;
724
725 // Insert the set of GlobalBaseReg into the first MBB of the function
726 MachineBasicBlock &FirstMBB = MF->front();
728 MachineRegisterInfo &RegInfo = MF->getRegInfo();
729
730 const TargetRegisterClass *PtrRC =
731 Subtarget.is64Bit() ? &SP::I64RegsRegClass : &SP::IntRegsRegClass;
732 GlobalBaseReg = RegInfo.createVirtualRegister(PtrRC);
733
734 DebugLoc dl;
735
736 BuildMI(FirstMBB, MBBI, dl, get(SP::GETPCX), GlobalBaseReg)
737 .setOperandDead(1); // implicit-def $o7
738 SparcFI->setGlobalBaseReg(GlobalBaseReg);
739 return GlobalBaseReg;
740}
741
743 unsigned &StructSize) const {
744 if (!MI.isCall())
745 return false;
746
747 unsigned StructSizeOpNum = 0;
748 switch (MI.getOpcode()) {
749 default:
750 llvm_unreachable("Unknown call opcode.");
751 case SP::CALL:
752 StructSizeOpNum = 1;
753 break;
754 case SP::CALLrr:
755 case SP::CALLri:
756 StructSizeOpNum = 2;
757 break;
758 case SP::TLS_CALL:
759 return false;
760 case SP::TAIL_CALLri:
761 case SP::TAIL_CALL:
762 return false;
763 }
764
765 const MachineOperand &MO = MI.getOperand(StructSizeOpNum);
766 if (!MO.isImm())
767 return false;
768
769 // A zero-sized return value has nothing for the callee to copy, so GCC emits
770 // no unimp for it and returns to the instruction right after the delay slot.
771 // We replicate this behavior here.
772 StructSize = MO.getImm();
773 return StructSize != 0;
774}
775
777 unsigned Opcode = MI.getOpcode();
778
779 if (MI.isInlineAsm()) {
780 const MachineFunction *MF = MI.getParent()->getParent();
781 const char *AsmStr = MI.getOperand(0).getSymbolName();
782 return getInlineAsmLength(AsmStr, MF->getTarget().getMCAsmInfo());
783 }
784
785 if (Opcode == TargetOpcode::BUNDLE)
786 return getInstBundleSize(MI);
787
788 if (MI.getOpcode() == SP::GETPCX) {
789 const TargetMachine &TM = MI.getParent()->getParent()->getTarget();
790 if (TM.isPositionIndependent())
791 return 16;
792 switch (TM.getCodeModel()) {
793 default:
794 llvm_unreachable("Unsupported absolute code model");
795 case CodeModel::Small:
796 return 8;
798 return 16;
799 case CodeModel::Large:
800 return 24;
801 }
802 }
803
804 // If the instruction has a delay slot, be conservative and also include
805 // it for sizing purposes. This is done so that the BranchRelaxation pass
806 // will not mistakenly mark out-of-range branches as in-range.
807 if (MI.hasDelaySlot()) {
808 unsigned StructSize = 0;
809 return get(Opcode).getSize() * (2 + needsUnimp(MI, StructSize));
810 }
811 return get(Opcode).getSize();
812}
813
815 Register &SrcReg2, int64_t &CmpMask,
816 int64_t &CmpValue) const {
817 Register DstReg;
818 switch (MI.getOpcode()) {
819 default:
820 break;
821 case SP::SUBCCri:
822 DstReg = MI.getOperand(0).getReg();
823 SrcReg = MI.getOperand(1).getReg();
824 SrcReg2 = 0;
825 CmpMask = ~0;
826 CmpValue = MI.getOperand(2).getImm();
827 return DstReg == SP::G0 && CmpValue == 0;
828 case SP::SUBCCrr:
829 DstReg = MI.getOperand(0).getReg();
830 SrcReg = MI.getOperand(1).getReg();
831 SrcReg2 = MI.getOperand(2).getReg();
832 CmpMask = ~0;
833 CmpValue = 0;
834 return DstReg == SP::G0 && SrcReg2 == SP::G0;
835 }
836
837 return false;
838}
839
841 MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2, int64_t CmpMask,
842 int64_t CmpValue, const MachineRegisterInfo *MRI) const {
843
844 // Get the unique definition of SrcReg.
845 MachineInstr *MI = MRI->getUniqueVRegDef(SrcReg);
846 if (!MI)
847 return false;
848
849 // Only optimize if defining and comparing instruction in same block.
850 if (MI->getParent() != CmpInstr.getParent())
851 return false;
852
853 unsigned NewOpcode;
854 switch (MI->getOpcode()) {
855 case SP::ANDNrr:
856 NewOpcode = SP::ANDNCCrr;
857 break;
858 case SP::ANDNri:
859 NewOpcode = SP::ANDNCCri;
860 break;
861 case SP::ANDrr:
862 NewOpcode = SP::ANDCCrr;
863 break;
864 case SP::ANDri:
865 NewOpcode = SP::ANDCCri;
866 break;
867 case SP::ORrr:
868 NewOpcode = SP::ORCCrr;
869 break;
870 case SP::ORri:
871 NewOpcode = SP::ORCCri;
872 break;
873 case SP::ORNCCrr:
874 NewOpcode = SP::ORNCCrr;
875 break;
876 case SP::ORNri:
877 NewOpcode = SP::ORNCCri;
878 break;
879 case SP::XORrr:
880 NewOpcode = SP::XORCCrr;
881 break;
882 case SP::XNORri:
883 NewOpcode = SP::XNORCCri;
884 break;
885 case SP::XNORrr:
886 NewOpcode = SP::XNORCCrr;
887 break;
888 case SP::ADDrr:
889 NewOpcode = SP::ADDCCrr;
890 break;
891 case SP::ADDri:
892 NewOpcode = SP::ADDCCri;
893 break;
894 case SP::SUBrr:
895 NewOpcode = SP::SUBCCrr;
896 break;
897 case SP::SUBri:
898 NewOpcode = SP::SUBCCri;
899 break;
900 default:
901 return false;
902 }
903
904 bool IsICCModified = false;
907 MachineBasicBlock::iterator E = CmpInstr.getParent()->end();
909
910 // If ICC is used or modified between MI and CmpInstr we cannot optimize.
911 while (++I != C) {
912 if (I->modifiesRegister(SP::ICC, TRI) || I->readsRegister(SP::ICC, TRI))
913 return false;
914 }
915
916 while (++I != E) {
917 // Only allow conditionals on equality.
918 if (I->readsRegister(SP::ICC, TRI)) {
919 bool IsICCBranch = I->getOpcode() == SP::BCOND ||
920 I->getOpcode() == SP::BPICC ||
921 I->getOpcode() == SP::BPXCC;
922 bool IsICCMove =
923 I->getOpcode() == SP::MOVICCrr || I->getOpcode() == SP::MOVICCri ||
924 I->getOpcode() == SP::MOVXCCrr || I->getOpcode() == SP::MOVXCCri;
925 bool IsICCConditional = IsICCBranch || IsICCMove;
926 if (!IsICCConditional ||
927 (I->getOperand(IsICCBranch ? 1 : 3).getImm() != SPCC::ICC_E &&
928 I->getOperand(IsICCBranch ? 1 : 3).getImm() != SPCC::ICC_NE))
929 return false;
930 } else if (I->modifiesRegister(SP::ICC, TRI)) {
931 IsICCModified = true;
932 break;
933 }
934 }
935
936 if (!IsICCModified) {
937 MachineBasicBlock *MBB = CmpInstr.getParent();
938 if (any_of(MBB->successors(),
939 [](MachineBasicBlock *Succ) { return Succ->isLiveIn(SP::ICC); }))
940 return false;
941 }
942
943 if (MRI->hasOneNonDBGUse(SrcReg))
944 MI->getOperand(0).setReg(SP::G0);
945
946 MI->setDesc(get(NewOpcode));
947 MI->addRegisterDefined(SP::ICC);
948 CmpInstr.eraseFromParent();
949
950 return true;
951}
952
954 switch (MI.getOpcode()) {
955 case TargetOpcode::LOAD_STACK_GUARD: {
956 assert(Subtarget.getTargetTriple().isOSLinux() &&
957 "Only Linux target is expected to contain LOAD_STACK_GUARD");
958 // offsetof(tcbhead_t, stack_guard) from sysdeps/sparc/nptl/tls.h in glibc.
959 const int64_t Offset = Subtarget.is64Bit() ? 0x28 : 0x14;
960 MI.setDesc(get(Subtarget.is64Bit() ? SP::LDXri : SP::LDri));
961 MachineInstrBuilder(*MI.getParent()->getParent(), MI)
962 .addReg(SP::G7)
963 .addImm(Offset);
964 return true;
965 }
966 case SP::V8BAR: {
967 assert(!Subtarget.isV9() &&
968 "V8BAR should not be emitted on V9 processors!");
969
970 // Emit stbar; ldstub [%sp-1], %g0
971 // The sequence acts as a full barrier on V8 systems.
972 MachineBasicBlock &MBB = *MI.getParent();
973 MachineInstr &InstSTBAR =
974 *BuildMI(MBB, MI, MI.getDebugLoc(), get(SP::STBAR));
975 MachineInstr &InstLDSTUB =
976 *BuildMI(MBB, MI, MI.getDebugLoc(), get(SP::LDSTUBri), SP::G0)
977 .addReg(SP::O6)
978 .addImm(-1);
979 MIBundleBuilder(MBB, InstSTBAR, InstLDSTUB);
980 MBB.erase(MI);
981 return true;
982 }
983 }
984 return false;
985}
static void parseCondBranch(MachineInstr *LastInst, MachineBasicBlock *&Target, SmallVectorImpl< MachineOperand > &Cond)
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock & MBB
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
IRTranslator LLVM IR MI
#define I(x, y, z)
Definition MD5.cpp:57
Register const TargetRegisterInfo * TRI
Promote Memory to Register
Definition Mem2Reg.cpp:110
SmallVector< MachineOperand, 4 > Cond
RISCVCC::CondCode CC
MachineRegisterInfo & MRI
const SmallVectorImpl< MachineOperand > MachineBasicBlock * TBB
This file declares the machine register scavenger class.
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition Value.cpp:479
This file defines the SmallVector class.
static bool isFCondBranchOpcode(int Opc)
static bool isRegCondBranchOpcode(int Opc)
static SPCC::CondCodes GetOppositeBranchCondition(SPCC::CondCodes CC)
static bool isI32CondBranchOpcode(int Opc)
static bool isI64CondBranchOpcode(int Opc)
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:40
A debug info location.
Definition DebugLoc.h:126
MCRegisterClass - Base class of TargetRegisterClass.
Helper class for constructing bundles of MachineInstrs.
MachineInstrBundleIterator< MachineInstr > iterator
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Align getObjectAlign(int ObjectIdx) const
Return the alignment of the specified stack object.
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineBasicBlock & front() const
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LLT MemTy, Align BaseAlignment, const MMOMetadata &Metadata=MMOMetadata(), SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
getMachineMemOperand - Allocate a new MachineMemOperand.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
const MachineInstrBuilder & setOperandDead(unsigned OpIdx) const
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.
const MachineInstrBuilder & add(const MachineOperand &MO) const
const MachineInstrBuilder & addFrameIndex(int Idx) const
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
LLVM_ABI bool addRegisterKilled(Register IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
LLVM_ABI void addRegisterDefined(Register Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
const MachineOperand & getOperand(unsigned i) const
LLVM_ABI MachineInstrBundleIterator< MachineInstr > eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
A description of a memory reference used in the backend.
@ MOLoad
The memory access reads data.
@ MOStore
The memory access writes data.
MachineOperand class - Representation of each machine instruction operand.
int64_t getImm() const
MachineBasicBlock * getMBB() const
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
static MachineOperand CreateImm(int64_t Val)
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Wrapper class representing virtual and physical registers.
Definition Register.h:20
constexpr bool isValid() const
Definition Register.h:112
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool needsUnimp(const MachineInstr &MI, unsigned &StructSize) const
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex, TypeSize &MemBytes) const override
isLoadFromStackSlot - If the specified machine instruction is a direct load from a stack slot,...
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, const DebugLoc &DL, Register DestReg, Register SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
bool isBranchOffsetInRange(unsigned BranchOpc, int64_t Offset) const override
Determine if the branch target is in range.
void storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, Register VReg, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
bool analyzeCompare(const MachineInstr &MI, Register &SrcReg, Register &SrcReg2, int64_t &CmpMask, int64_t &CmpValue) const override
bool optimizeCompareInstr(MachineInstr &CmpInstr, Register SrcReg, Register SrcReg2, int64_t CmpMask, int64_t CmpValue, const MachineRegisterInfo *MRI) const override
void insertIndirectBranch(MachineBasicBlock &MBB, MachineBasicBlock &NewDestBB, MachineBasicBlock &RestoreBB, const DebugLoc &DL, int64_t BrOffset, RegScavenger *RS) const override
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
Register getGlobalBaseReg(MachineFunction *MF) const
bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const override
void loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, Register VReg, unsigned SubReg=0, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
unsigned removeBranch(MachineBasicBlock &MBB, int *BytesRemoved=nullptr) const override
MachineBasicBlock * getBranchDestBlock(const MachineInstr &MI) const override
bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, MachineBasicBlock *&FBB, SmallVectorImpl< MachineOperand > &Cond, bool AllowModify=false) const override
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex, TypeSize &MemBytes) const override
isStoreToStackSlot - If the specified machine instruction is a direct store to a stack slot,...
SparcInstrInfo(const SparcSubtarget &ST)
const SparcRegisterInfo & getRegisterInfo() const
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
const TargetRegisterClass * getInlineAsmMemoryOperandRegClass(InlineAsm::ConstraintCode C) const override
unsigned getInstSizeInBytes(const MachineInstr &MI) const override
GetInstSize - Return the number of bytes of code the specified instruction may be.
unsigned insertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, MachineBasicBlock *FBB, ArrayRef< MachineOperand > Cond, const DebugLoc &DL, int *BytesAdded=nullptr) const override
bool expandPostRAPseudo(MachineInstr &MI) const override
virtual bool isSchedulingBoundary(const MachineInstr &MI, const MachineBasicBlock *MBB, const MachineFunction &MF) const
Test if the given instruction should be considered a scheduling boundary.
Primary interface to the complete machine description for the target machine.
bool isPositionIndependent() const
const MCAsmInfo & getMCAsmInfo() const
Return target specific asm information.
CodeModel::Model getCodeModel() const
Returns the code model.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Target - Wrapper for Target specific information.
static constexpr TypeSize getFixed(ScalarTy ExactSize)
Definition TypeSize.h:352
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ CPCC_03
Definition Sparc.h:117
@ CPCC_013
Definition Sparc.h:121
@ FCC_ULE
Definition Sparc.h:103
@ ICC_POS
Definition Sparc.h:83
@ FCC_UG
Definition Sparc.h:93
@ ICC_N
Definition Sparc.h:72
@ CPCC_123
Definition Sparc.h:115
@ ICC_G
Definition Sparc.h:75
@ REG_LEZ
Definition Sparc.h:126
@ CPCC_23
Definition Sparc.h:111
@ ICC_L
Definition Sparc.h:78
@ REG_BEGIN
Definition Sparc.h:124
@ FCC_NE
Definition Sparc.h:97
@ CPCC_01
Definition Sparc.h:120
@ CPCC_12
Definition Sparc.h:114
@ ICC_CS
Definition Sparc.h:82
@ FCC_LG
Definition Sparc.h:96
@ ICC_VS
Definition Sparc.h:86
@ ICC_LEU
Definition Sparc.h:80
@ CPCC_012
Definition Sparc.h:122
@ ICC_LE
Definition Sparc.h:76
@ FCC_U
Definition Sparc.h:91
@ FCC_A
Definition Sparc.h:89
@ CPCC_023
Definition Sparc.h:119
@ CPCC_13
Definition Sparc.h:113
@ ICC_GE
Definition Sparc.h:77
@ FCC_E
Definition Sparc.h:98
@ CPCC_02
Definition Sparc.h:118
@ FCC_L
Definition Sparc.h:94
@ ICC_GU
Definition Sparc.h:79
@ ICC_NE
Definition Sparc.h:73
@ FCC_UE
Definition Sparc.h:99
@ ICC_E
Definition Sparc.h:74
@ ICC_A
Definition Sparc.h:71
@ FCC_UGE
Definition Sparc.h:101
@ ICC_VC
Definition Sparc.h:85
@ ICC_CC
Definition Sparc.h:81
@ REG_GEZ
Definition Sparc.h:130
@ FCC_G
Definition Sparc.h:92
@ FCC_UL
Definition Sparc.h:95
@ FCC_N
Definition Sparc.h:90
@ ICC_NEG
Definition Sparc.h:84
This is an optimization pass for GlobalISel generic memory operations.
@ Offset
Definition DWP.cpp:577
static bool isCondBranchOpcode(int Opc)
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
@ Kill
The last use of a register.
constexpr RegState getKillRegState(bool B)
static bool isIndirectBranchOpcode(int Opc)
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
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)
Definition Error.cpp:163
RelativeUniformCounterPtr ValuesPtrExpr VTableAddr Count
Definition InstrProf.h:145
static bool isUncondBranchOpcode(int Opc)
constexpr bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
Definition MathExtras.h:249
MCRegisterClass TargetRegisterClass
Definition FastISel.h:58
static LLVM_ABI MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.