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