Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Mips16InstrInfo.cpp
Go to the documentation of this file.
1//===- Mips16InstrInfo.cpp - Mips16 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 Mips16 implementation of the TargetInstrInfo class.
10//
11//===----------------------------------------------------------------------===//
12
13#include "Mips16InstrInfo.h"
14#include "llvm/ADT/BitVector.h"
15#include "llvm/CodeGen/MachineBasicBlock.h"
16#include "llvm/CodeGen/MachineFrameInfo.h"
17#include "llvm/CodeGen/MachineFunction.h"
18#include "llvm/CodeGen/MachineInstr.h"
19#include "llvm/CodeGen/MachineInstrBuilder.h"
20#include "llvm/CodeGen/MachineMemOperand.h"
21#include "llvm/CodeGen/MachineOperand.h"
22#include "llvm/CodeGen/RegisterScavenging.h"
23#include "llvm/CodeGen/TargetRegisterInfo.h"
24#include "llvm/IR/DebugLoc.h"
25#include "llvm/Support/ErrorHandling.h"
26#include "llvm/Support/MathExtras.h"
27#include <cassert>
28#include <cctype>
29#include <cstdint>
30#include <cstdlib>
31#include <cstring>
32#include <iterator>
33#include <vector>
34
35using namespacellvm;
36
37#define DEBUG_TYPE "mips16-instrinfo"
38
39Mips16InstrInfo::Mips16InstrInfo(constMipsSubtarget &STI)
40 :MipsInstrInfo(STI, Mips::Bimm16) {}
41
42constMipsRegisterInfo &Mips16InstrInfo::getRegisterInfo() const{
43return RI;
44}
45
46/// isLoadFromStackSlot - If the specified machine instruction is a direct
47/// load from a stack slot, return the virtual or physical register number of
48/// the destination along with the FrameIndex of the loaded stack slot. If
49/// not, return 0. This predicate must return 0 if the instruction has
50/// any side effects other than loading from the stack slot.
51RegisterMips16InstrInfo::isLoadFromStackSlot(constMachineInstr &MI,
52int &FrameIndex) const{
53return 0;
54}
55
56/// isStoreToStackSlot - If the specified machine instruction is a direct
57/// store to a stack slot, return the virtual or physical register number of
58/// the source reg along with the FrameIndex of the loaded stack slot. If
59/// not, return 0. This predicate must return 0 if the instruction has
60/// any side effects other than storing to the stack slot.
61RegisterMips16InstrInfo::isStoreToStackSlot(constMachineInstr &MI,
62int &FrameIndex) const{
63return 0;
64}
65
66voidMips16InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
67MachineBasicBlock::iteratorI,
68constDebugLoc &DL,MCRegister DestReg,
69MCRegister SrcReg,bool KillSrc,
70bool RenamableDest,bool RenamableSrc) const{
71unsigned Opc = 0;
72
73if (Mips::CPU16RegsRegClass.contains(DestReg) &&
74 Mips::GPR32RegClass.contains(SrcReg))
75 Opc = Mips::MoveR3216;
76elseif (Mips::GPR32RegClass.contains(DestReg) &&
77 Mips::CPU16RegsRegClass.contains(SrcReg))
78 Opc = Mips::Move32R16;
79elseif ((SrcReg == Mips::HI0) &&
80 (Mips::CPU16RegsRegClass.contains(DestReg)))
81 Opc = Mips::Mfhi16, SrcReg = 0;
82elseif ((SrcReg == Mips::LO0) &&
83 (Mips::CPU16RegsRegClass.contains(DestReg)))
84 Opc = Mips::Mflo16, SrcReg = 0;
85
86assert(Opc &&"Cannot copy registers");
87
88MachineInstrBuilder MIB =BuildMI(MBB,I,DL,get(Opc));
89
90if (DestReg)
91 MIB.addReg(DestReg,RegState::Define);
92
93if (SrcReg)
94 MIB.addReg(SrcReg,getKillRegState(KillSrc));
95}
96
97std::optional<DestSourcePair>
98Mips16InstrInfo::isCopyInstrImpl(constMachineInstr &MI) const{
99if (MI.isMoveReg())
100returnDestSourcePair{MI.getOperand(0),MI.getOperand(1)};
101return std::nullopt;
102}
103
104voidMips16InstrInfo::storeRegToStack(MachineBasicBlock &MBB,
105MachineBasicBlock::iteratorI,
106Register SrcReg,bool isKill,int FI,
107constTargetRegisterClass *RC,
108constTargetRegisterInfo *TRI,
109 int64_tOffset,
110MachineInstr::MIFlag Flags) const{
111DebugLocDL;
112if (I !=MBB.end())DL =I->getDebugLoc();
113MachineMemOperand *MMO =GetMemOperand(MBB, FI,MachineMemOperand::MOStore);
114unsigned Opc = 0;
115if (Mips::CPU16RegsRegClass.hasSubClassEq(RC))
116 Opc = Mips::SwRxSpImmX16;
117assert(Opc &&"Register class not handled!");
118BuildMI(MBB,I,DL,get(Opc)).addReg(SrcReg,getKillRegState(isKill)).
119 addFrameIndex(FI).addImm(Offset)
120 .addMemOperand(MMO);
121}
122
123voidMips16InstrInfo::loadRegFromStack(
124MachineBasicBlock &MBB,MachineBasicBlock::iteratorI,Register DestReg,
125int FI,constTargetRegisterClass *RC,constTargetRegisterInfo *TRI,
126 int64_tOffset,MachineInstr::MIFlag Flags) const{
127DebugLocDL;
128if (I !=MBB.end())DL =I->getDebugLoc();
129MachineMemOperand *MMO =GetMemOperand(MBB, FI,MachineMemOperand::MOLoad);
130unsigned Opc = 0;
131
132if (Mips::CPU16RegsRegClass.hasSubClassEq(RC))
133 Opc = Mips::LwRxSpImmX16;
134assert(Opc &&"Register class not handled!");
135BuildMI(MBB,I,DL,get(Opc), DestReg).addFrameIndex(FI).addImm(Offset)
136 .addMemOperand(MMO);
137}
138
139boolMips16InstrInfo::expandPostRAPseudo(MachineInstr &MI) const{
140MachineBasicBlock &MBB = *MI.getParent();
141switch (MI.getDesc().getOpcode()) {
142default:
143returnfalse;
144case Mips::RetRA16:
145 ExpandRetRA16(MBB,MI, Mips::JrcRa16);
146break;
147 }
148
149MBB.erase(MI.getIterator());
150returntrue;
151}
152
153/// GetOppositeBranchOpc - Return the inverse of the specified
154/// opcode, e.g. turning BEQ to BNE.
155unsignedMips16InstrInfo::getOppositeBranchOpc(unsigned Opc) const{
156switch (Opc) {
157case Mips::BeqzRxImmX16:return Mips::BnezRxImmX16;
158case Mips::BnezRxImmX16:return Mips::BeqzRxImmX16;
159case Mips::BeqzRxImm16:return Mips::BnezRxImm16;
160case Mips::BnezRxImm16:return Mips::BeqzRxImm16;
161case Mips::BteqzT8CmpX16:return Mips::BtnezT8CmpX16;
162case Mips::BteqzT8SltX16:return Mips::BtnezT8SltX16;
163case Mips::BteqzT8SltiX16:return Mips::BtnezT8SltiX16;
164case Mips::Btnez16:return Mips::Bteqz16;
165case Mips::BtnezX16:return Mips::BteqzX16;
166case Mips::BtnezT8CmpiX16:return Mips::BteqzT8CmpiX16;
167case Mips::BtnezT8SltuX16:return Mips::BteqzT8SltuX16;
168case Mips::BtnezT8SltiuX16:return Mips::BteqzT8SltiuX16;
169case Mips::Bteqz16:return Mips::Btnez16;
170case Mips::BteqzX16:return Mips::BtnezX16;
171case Mips::BteqzT8CmpiX16:return Mips::BtnezT8CmpiX16;
172case Mips::BteqzT8SltuX16:return Mips::BtnezT8SltuX16;
173case Mips::BteqzT8SltiuX16:return Mips::BtnezT8SltiuX16;
174case Mips::BtnezT8CmpX16:return Mips::BteqzT8CmpX16;
175case Mips::BtnezT8SltX16:return Mips::BteqzT8SltX16;
176case Mips::BtnezT8SltiX16:return Mips::BteqzT8SltiX16;
177 }
178llvm_unreachable("Illegal opcode!");
179}
180
181staticvoidaddSaveRestoreRegs(MachineInstrBuilder &MIB,
182ArrayRef<CalleeSavedInfo> CSI,
183unsigned Flags = 0) {
184for (unsigned i = 0, e = CSI.size(); i != e; ++i) {
185// Add the callee-saved register as live-in. Do not add if the register is
186// RA and return address is taken, because it has already been added in
187// method MipsTargetLowering::lowerRETURNADDR.
188// It's killed at the spill, unless the register is RA and return address
189// is taken.
190Register Reg = CSI[e-i-1].getReg();
191switch (Reg) {
192case Mips::RA:
193case Mips::S0:
194case Mips::S1:
195 MIB.addReg(Reg, Flags);
196break;
197case Mips::S2:
198break;
199default:
200llvm_unreachable("unexpected mips16 callee saved register");
201
202 }
203 }
204}
205
206// Adjust SP by FrameSize bytes. Save RA, S0, S1
207voidMips16InstrInfo::makeFrame(unsigned SP, int64_t FrameSize,
208MachineBasicBlock &MBB,
209MachineBasicBlock::iteratorI) const{
210DebugLocDL;
211MachineFunction &MF = *MBB.getParent();
212MachineFrameInfo &MFI = MF.getFrameInfo();
213constBitVectorReserved = RI.getReservedRegs(MF);
214bool SaveS2 =Reserved[Mips::S2];
215MachineInstrBuilder MIB;
216unsigned Opc = ((FrameSize <= 128) && !SaveS2)? Mips::Save16:Mips::SaveX16;
217 MIB =BuildMI(MBB,I,DL,get(Opc));
218const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo();
219addSaveRestoreRegs(MIB, CSI);
220if (SaveS2)
221 MIB.addReg(Mips::S2);
222if (isUInt<11>(FrameSize))
223 MIB.addImm(FrameSize);
224else {
225intBase = 2040;// should create template function like isUInt that
226// returns largest possible n bit unsigned integer
227 int64_t Remainder = FrameSize -Base;
228 MIB.addImm(Base);
229if (isInt<16>(-Remainder))
230BuildAddiuSpImm(MBB,I, -Remainder);
231else
232 adjustStackPtrBig(SP, -Remainder,MBB,I, Mips::V0, Mips::V1);
233 }
234}
235
236// Adjust SP by FrameSize bytes. Restore RA, S0, S1
237voidMips16InstrInfo::restoreFrame(unsigned SP, int64_t FrameSize,
238MachineBasicBlock &MBB,
239MachineBasicBlock::iteratorI) const{
240DebugLocDL =I !=MBB.end() ?I->getDebugLoc() :DebugLoc();
241MachineFunction *MF =MBB.getParent();
242MachineFrameInfo &MFI = MF->getFrameInfo();
243constBitVectorReserved = RI.getReservedRegs(*MF);
244bool SaveS2 =Reserved[Mips::S2];
245MachineInstrBuilder MIB;
246unsigned Opc = ((FrameSize <= 128) && !SaveS2)?
247 Mips::Restore16:Mips::RestoreX16;
248
249if (!isUInt<11>(FrameSize)) {
250unsignedBase = 2040;
251 int64_t Remainder = FrameSize -Base;
252 FrameSize =Base;// should create template function like isUInt that
253// returns largest possible n bit unsigned integer
254
255if (isInt<16>(Remainder))
256BuildAddiuSpImm(MBB,I, Remainder);
257else
258 adjustStackPtrBig(SP, Remainder,MBB,I, Mips::A0, Mips::A1);
259 }
260 MIB =BuildMI(MBB,I,DL,get(Opc));
261const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo();
262addSaveRestoreRegs(MIB, CSI,RegState::Define);
263if (SaveS2)
264 MIB.addReg(Mips::S2,RegState::Define);
265 MIB.addImm(FrameSize);
266}
267
268// Adjust SP by Amount bytes where bytes can be up to 32bit number.
269// This can only be called at times that we know that there is at least one free
270// register.
271// This is clearly safe at prologue and epilogue.
272void Mips16InstrInfo::adjustStackPtrBig(unsigned SP, int64_t Amount,
273MachineBasicBlock &MBB,
274MachineBasicBlock::iteratorI,
275unsigned Reg1,unsigned Reg2) const{
276DebugLocDL;
277//
278// li reg1, constant
279// move reg2, sp
280// add reg1, reg1, reg2
281// move sp, reg1
282//
283//
284MachineInstrBuilder MIB1 =BuildMI(MBB,I,DL,get(Mips::LwConstant32), Reg1);
285 MIB1.addImm(Amount).addImm(-1);
286MachineInstrBuilder MIB2 =BuildMI(MBB,I,DL,get(Mips::MoveR3216), Reg2);
287 MIB2.addReg(Mips::SP,RegState::Kill);
288MachineInstrBuilder MIB3 =BuildMI(MBB,I,DL,get(Mips::AdduRxRyRz16), Reg1);
289 MIB3.addReg(Reg1);
290 MIB3.addReg(Reg2,RegState::Kill);
291MachineInstrBuilder MIB4 =BuildMI(MBB,I,DL,get(Mips::Move32R16),
292 Mips::SP);
293 MIB4.addReg(Reg1,RegState::Kill);
294}
295
296void Mips16InstrInfo::adjustStackPtrBigUnrestricted(
297unsigned SP, int64_t Amount,MachineBasicBlock &MBB,
298MachineBasicBlock::iteratorI) const{
299llvm_unreachable("adjust stack pointer amount exceeded");
300}
301
302/// Adjust SP by Amount bytes.
303voidMips16InstrInfo::adjustStackPtr(unsigned SP, int64_t Amount,
304MachineBasicBlock &MBB,
305MachineBasicBlock::iteratorI) const{
306if (Amount == 0)
307return;
308
309if (isInt<16>(Amount))// need to change to addiu sp, ....and isInt<16>
310BuildAddiuSpImm(MBB,I, Amount);
311else
312 adjustStackPtrBigUnrestricted(SP, Amount,MBB,I);
313}
314
315/// This function generates the sequence of instructions needed to get the
316/// result of adding register REG and immediate IMM.
317unsignedMips16InstrInfo::loadImmediate(unsigned FrameReg, int64_t Imm,
318MachineBasicBlock &MBB,
319MachineBasicBlock::iteratorII,
320constDebugLoc &DL,
321unsigned &NewImm) const{
322//
323// given original instruction is:
324// Instr rx, T[offset] where offset is too big.
325//
326// lo = offset & 0xFFFF
327// hi = ((offset >> 16) + (lo >> 15)) & 0xFFFF;
328//
329// let T = temporary register
330// li T, hi
331// shl T, 16
332// add T, Rx, T
333//
334RegScavenger rs;
335 int32_t lo = Imm & 0xFFFF;
336 NewImm = lo;
337int Reg =0;
338int SpReg = 0;
339
340 rs.enterBasicBlockEnd(MBB);
341 rs.backward(std::next(II));
342//
343// We need to know which registers can be used, in the case where there
344// are not enough free registers. We exclude all registers that
345// are used in the instruction that we are helping.
346// // Consider all allocatable registers in the register class initially
347BitVector Candidates =
348 RI.getAllocatableSet
349 (*II->getParent()->getParent(), &Mips::CPU16RegsRegClass);
350// Exclude all the registers being used by the instruction.
351for (MachineOperand &MO :II->operands()) {
352if (MO.isReg() && MO.getReg() != 0 && !MO.isDef() &&
353 !MO.getReg().isVirtual())
354 Candidates.reset(MO.getReg());
355 }
356
357// If the same register was used and defined in an instruction, then
358// it will not be in the list of candidates.
359//
360// we need to analyze the instruction that we are helping.
361// we need to know if it defines register x but register x is not
362// present as an operand of the instruction. this tells
363// whether the register is live before the instruction. if it's not
364// then we don't need to save it in case there are no free registers.
365int DefReg = 0;
366for (MachineOperand &MO :II->operands()) {
367if (MO.isReg() && MO.isDef()) {
368 DefReg = MO.getReg();
369break;
370 }
371 }
372
373BitVectorAvailable = rs.getRegsAvailable(&Mips::CPU16RegsRegClass);
374Available &= Candidates;
375//
376// we use T0 for the first register, if we need to save something away.
377// we use T1 for the second register, if we need to save something away.
378//
379unsigned FirstRegSaved =0, SecondRegSaved=0;
380unsigned FirstRegSavedTo = 0, SecondRegSavedTo = 0;
381
382 Reg =Available.find_first();
383
384if (Reg == -1) {
385 Reg = Candidates.find_first();
386 Candidates.reset(Reg);
387if (DefReg != Reg) {
388 FirstRegSaved = Reg;
389 FirstRegSavedTo = Mips::T0;
390copyPhysReg(MBB,II,DL, FirstRegSavedTo, FirstRegSaved,true);
391 }
392 }
393else
394Available.reset(Reg);
395BuildMI(MBB,II,DL,get(Mips::LwConstant32), Reg).addImm(Imm).addImm(-1);
396 NewImm = 0;
397if (FrameReg == Mips::SP) {
398 SpReg =Available.find_first();
399if (SpReg == -1) {
400 SpReg = Candidates.find_first();
401// Candidates.reset(SpReg); // not really needed
402if (DefReg!= SpReg) {
403 SecondRegSaved = SpReg;
404 SecondRegSavedTo = Mips::T1;
405 }
406if (SecondRegSaved)
407copyPhysReg(MBB,II,DL, SecondRegSavedTo, SecondRegSaved,true);
408 }
409else
410Available.reset(SpReg);
411copyPhysReg(MBB,II,DL, SpReg, Mips::SP,false);
412BuildMI(MBB,II,DL,get(Mips::AdduRxRyRz16), Reg)
413 .addReg(SpReg,RegState::Kill)
414 .addReg(Reg);
415 }
416else
417BuildMI(MBB,II,DL,get(Mips:: AdduRxRyRz16), Reg).addReg(FrameReg)
418 .addReg(Reg,RegState::Kill);
419if (FirstRegSaved || SecondRegSaved) {
420II = std::next(II);
421if (FirstRegSaved)
422copyPhysReg(MBB,II,DL, FirstRegSaved, FirstRegSavedTo,true);
423if (SecondRegSaved)
424copyPhysReg(MBB,II,DL, SecondRegSaved, SecondRegSavedTo,true);
425 }
426return Reg;
427}
428
429unsigned Mips16InstrInfo::getAnalyzableBrOpc(unsigned Opc) const{
430return (Opc == Mips::BeqzRxImmX16 || Opc == Mips::BimmX16 ||
431 Opc == Mips::Bimm16 ||
432 Opc == Mips::Bteqz16 || Opc == Mips::Btnez16 ||
433 Opc == Mips::BeqzRxImm16 || Opc == Mips::BnezRxImm16 ||
434 Opc == Mips::BnezRxImmX16 || Opc == Mips::BteqzX16 ||
435 Opc == Mips::BteqzT8CmpX16 || Opc == Mips::BteqzT8CmpiX16 ||
436 Opc == Mips::BteqzT8SltX16 || Opc == Mips::BteqzT8SltuX16 ||
437 Opc == Mips::BteqzT8SltiX16 || Opc == Mips::BteqzT8SltiuX16 ||
438 Opc == Mips::BtnezX16 || Opc == Mips::BtnezT8CmpX16 ||
439 Opc == Mips::BtnezT8CmpiX16 || Opc == Mips::BtnezT8SltX16 ||
440 Opc == Mips::BtnezT8SltuX16 || Opc == Mips::BtnezT8SltiX16 ||
441 Opc == Mips::BtnezT8SltiuX16 ) ? Opc : 0;
442}
443
444void Mips16InstrInfo::ExpandRetRA16(MachineBasicBlock &MBB,
445MachineBasicBlock::iteratorI,
446unsigned Opc) const{
447BuildMI(MBB,I,I->getDebugLoc(),get(Opc));
448}
449
450constMCInstrDesc &Mips16InstrInfo::AddiuSpImm(int64_t Imm) const{
451if (validSpImm8(Imm))
452returnget(Mips::AddiuSpImm16);
453else
454returnget(Mips::AddiuSpImmX16);
455}
456
457voidMips16InstrInfo::BuildAddiuSpImm
458 (MachineBasicBlock &MBB,MachineBasicBlock::iteratorI, int64_t Imm) const{
459DebugLocDL;
460BuildMI(MBB,I,DL,AddiuSpImm(Imm)).addImm(Imm);
461}
462
463constMipsInstrInfo *llvm::createMips16InstrInfo(constMipsSubtarget &STI) {
464returnnewMips16InstrInfo(STI);
465}
466
467boolMips16InstrInfo::validImmediate(unsigned Opcode,unsigned Reg,
468 int64_t Amount) {
469switch (Opcode) {
470case Mips::LbRxRyOffMemX16:
471case Mips::LbuRxRyOffMemX16:
472case Mips::LhRxRyOffMemX16:
473case Mips::LhuRxRyOffMemX16:
474case Mips::SbRxRyOffMemX16:
475case Mips::ShRxRyOffMemX16:
476case Mips::LwRxRyOffMemX16:
477case Mips::SwRxRyOffMemX16:
478case Mips::SwRxSpImmX16:
479case Mips::LwRxSpImmX16:
480return isInt<16>(Amount);
481case Mips::AddiuRxRyOffMemX16:
482if ((Reg == Mips::PC) || (Reg == Mips::SP))
483return isInt<16>(Amount);
484return isInt<15>(Amount);
485 }
486llvm_unreachable("unexpected Opcode in validImmediate");
487}
MBB
MachineBasicBlock & MBB
Definition:ARMSLSHardening.cpp:71
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
BitVector.h
This file implements the BitVector class.
DebugLoc.h
AvailabilityState::Available
@ Available
We know the block is fully available. This is a fixpoint.
MI
IRTranslator LLVM IR MI
Definition:IRTranslator.cpp:112
I
#define I(x, y, z)
Definition:MD5.cpp:58
MachineBasicBlock.h
MachineFrameInfo.h
MachineFunction.h
MachineInstrBuilder.h
MachineInstr.h
MachineMemOperand.h
MachineOperand.h
TRI
unsigned const TargetRegisterInfo * TRI
Definition:MachineSink.cpp:2029
MathExtras.h
addSaveRestoreRegs
static void addSaveRestoreRegs(MachineInstrBuilder &MIB, ArrayRef< CalleeSavedInfo > CSI, unsigned Flags=0)
Definition:Mips16InstrInfo.cpp:181
Mips16InstrInfo.h
II
uint64_t IntrinsicInst * II
Definition:NVVMIntrRange.cpp:51
RegisterScavenging.h
This file declares the machine register scavenger class.
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
contains
static bool contains(SmallPtrSetImpl< ConstantExpr * > &Cache, ConstantExpr *Expr, Constant *C)
Definition:Value.cpp:469
TargetRegisterInfo.h
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition:ArrayRef.h:168
llvm::BitVector
Definition:BitVector.h:82
llvm::BitVector::reset
BitVector & reset()
Definition:BitVector.h:392
llvm::BitVector::find_first
int find_first() const
find_first - Returns the index of the first set bit, -1 if none of the bits are set.
Definition:BitVector.h:300
llvm::DebugLoc
A debug info location.
Definition:DebugLoc.h:33
llvm::MCInstrDesc
Describe properties that are true of each instruction in the target description file.
Definition:MCInstrDesc.h:198
llvm::MCRegister
Wrapper class representing physical registers. Should be passed by value.
Definition:MCRegister.h:33
llvm::MachineBasicBlock
Definition:MachineBasicBlock.h:125
llvm::MachineBasicBlock::end
iterator end()
Definition:MachineBasicBlock.h:357
llvm::MachineBasicBlock::getParent
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
Definition:MachineBasicBlock.h:311
llvm::MachineBasicBlock::erase
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
Definition:MachineBasicBlock.cpp:1443
llvm::MachineFrameInfo
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Definition:MachineFrameInfo.h:106
llvm::MachineFrameInfo::getCalleeSavedInfo
const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const
Returns a reference to call saved info vector for the current function.
Definition:MachineFrameInfo.h:806
llvm::MachineFunction
Definition:MachineFunction.h:267
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition:MachineFunction.h:749
llvm::MachineInstrBuilder
Definition:MachineInstrBuilder.h:71
llvm::MachineInstrBuilder::addImm
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Definition:MachineInstrBuilder.h:133
llvm::MachineInstrBuilder::addFrameIndex
const MachineInstrBuilder & addFrameIndex(int Idx) const
Definition:MachineInstrBuilder.h:154
llvm::MachineInstrBuilder::addReg
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
Definition:MachineInstrBuilder.h:99
llvm::MachineInstrBuilder::addMemOperand
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
Definition:MachineInstrBuilder.h:204
llvm::MachineInstrBundleIterator< MachineInstr >
llvm::MachineInstr
Representation of each machine instruction.
Definition:MachineInstr.h:71
llvm::MachineInstr::MIFlag
MIFlag
Definition:MachineInstr.h:85
llvm::MachineMemOperand
A description of a memory reference used in the backend.
Definition:MachineMemOperand.h:129
llvm::MachineMemOperand::MOLoad
@ MOLoad
The memory access reads data.
Definition:MachineMemOperand.h:136
llvm::MachineMemOperand::MOStore
@ MOStore
The memory access writes data.
Definition:MachineMemOperand.h:138
llvm::MachineOperand
MachineOperand class - Representation of each machine instruction operand.
Definition:MachineOperand.h:48
llvm::Mips16InstrInfo
Definition:Mips16InstrInfo.h:27
llvm::Mips16InstrInfo::isLoadFromStackSlot
Register isLoadFromStackSlot(const MachineInstr &MI, int &FrameIndex) const override
isLoadFromStackSlot - If the specified machine instruction is a direct load from a stack slot,...
Definition:Mips16InstrInfo.cpp:51
llvm::Mips16InstrInfo::expandPostRAPseudo
bool expandPostRAPseudo(MachineInstr &MI) const override
Definition:Mips16InstrInfo.cpp:139
llvm::Mips16InstrInfo::validImmediate
static bool validImmediate(unsigned Opcode, unsigned Reg, int64_t Amount)
Definition:Mips16InstrInfo.cpp:467
llvm::Mips16InstrInfo::AddiuSpImm
const MCInstrDesc & AddiuSpImm(int64_t Imm) const
Definition:Mips16InstrInfo.cpp:450
llvm::Mips16InstrInfo::makeFrame
void makeFrame(unsigned SP, int64_t FrameSize, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
Definition:Mips16InstrInfo.cpp:207
llvm::Mips16InstrInfo::BuildAddiuSpImm
void BuildAddiuSpImm(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, int64_t Imm) const
Definition:Mips16InstrInfo.cpp:458
llvm::Mips16InstrInfo::getOppositeBranchOpc
unsigned getOppositeBranchOpc(unsigned Opc) const override
GetOppositeBranchOpc - Return the inverse of the specified opcode, e.g.
Definition:Mips16InstrInfo.cpp:155
llvm::Mips16InstrInfo::storeRegToStack
void storeRegToStack(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register SrcReg, bool isKill, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, int64_t Offset, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Definition:Mips16InstrInfo.cpp:104
llvm::Mips16InstrInfo::isCopyInstrImpl
std::optional< DestSourcePair > isCopyInstrImpl(const MachineInstr &MI) const override
If the specific machine instruction is a instruction that moves/copies value from one register to ano...
Definition:Mips16InstrInfo.cpp:98
llvm::Mips16InstrInfo::isStoreToStackSlot
Register isStoreToStackSlot(const MachineInstr &MI, int &FrameIndex) const override
isStoreToStackSlot - If the specified machine instruction is a direct store to a stack slot,...
Definition:Mips16InstrInfo.cpp:61
llvm::Mips16InstrInfo::validSpImm8
static bool validSpImm8(int offset)
Definition:Mips16InstrInfo.h:93
llvm::Mips16InstrInfo::copyPhysReg
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg, bool KillSrc, bool RenamableDest=false, bool RenamableSrc=false) const override
Definition:Mips16InstrInfo.cpp:66
llvm::Mips16InstrInfo::loadRegFromStack
void loadRegFromStack(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, Register DestReg, int FrameIndex, const TargetRegisterClass *RC, const TargetRegisterInfo *TRI, int64_t Offset, MachineInstr::MIFlag Flags=MachineInstr::NoFlags) const override
Definition:Mips16InstrInfo.cpp:123
llvm::Mips16InstrInfo::restoreFrame
void restoreFrame(unsigned SP, int64_t FrameSize, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const
Definition:Mips16InstrInfo.cpp:237
llvm::Mips16InstrInfo::Mips16InstrInfo
Mips16InstrInfo(const MipsSubtarget &STI)
Definition:Mips16InstrInfo.cpp:39
llvm::Mips16InstrInfo::loadImmediate
unsigned loadImmediate(unsigned FrameReg, int64_t Imm, MachineBasicBlock &MBB, MachineBasicBlock::iterator II, const DebugLoc &DL, unsigned &NewImm) const
Emit a series of instructions to load an immediate.
Definition:Mips16InstrInfo.cpp:317
llvm::Mips16InstrInfo::adjustStackPtr
void adjustStackPtr(unsigned SP, int64_t Amount, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override
Adjust SP by Amount bytes.
Definition:Mips16InstrInfo.cpp:303
llvm::Mips16InstrInfo::getRegisterInfo
const MipsRegisterInfo & getRegisterInfo() const override
getRegisterInfo - TargetInstrInfo is a superset of MRegister info.
Definition:Mips16InstrInfo.cpp:42
llvm::MipsInstrInfo
Definition:MipsInstrInfo.h:41
llvm::MipsInstrInfo::GetMemOperand
MachineMemOperand * GetMemOperand(MachineBasicBlock &MBB, int FI, MachineMemOperand::Flags Flags) const
Definition:MipsInstrInfo.cpp:80
llvm::MipsRegisterInfo
Definition:MipsRegisterInfo.h:27
llvm::MipsRegisterInfo::getReservedRegs
BitVector getReservedRegs(const MachineFunction &MF) const override
Definition:MipsRegisterInfo.cpp:150
llvm::MipsSubtarget
Definition:MipsSubtarget.h:37
llvm::RegScavenger
Definition:RegisterScavenging.h:34
llvm::RegScavenger::enterBasicBlockEnd
void enterBasicBlockEnd(MachineBasicBlock &MBB)
Start tracking liveness from the end of basic block MBB.
Definition:RegisterScavenging.cpp:75
llvm::RegScavenger::backward
void backward()
Update internal register state and move MBB iterator backwards.
Definition:RegisterScavenging.cpp:81
llvm::RegScavenger::getRegsAvailable
BitVector getRegsAvailable(const TargetRegisterClass *RC)
Return all available registers in the register class in Mask.
Definition:RegisterScavenging.cpp:111
llvm::Register
Wrapper class representing virtual and physical registers.
Definition:Register.h:19
llvm::TargetRegisterClass
Definition:TargetRegisterInfo.h:44
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition:TargetRegisterInfo.h:235
ErrorHandling.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::RegState::Define
@ Define
Register definition.
Definition:MachineInstrBuilder.h:46
llvm::RegState::Kill
@ Kill
The last use of a register.
Definition:MachineInstrBuilder.h:50
llvm::sampleprof::Base
@ Base
Definition:Discriminator.h:58
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Offset
@ Offset
Definition:DWP.cpp:480
llvm::BuildMI
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Definition:MachineInstrBuilder.h:373
llvm::get
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
Definition:PointerIntPair.h:270
llvm::VariableID::Reserved
@ Reserved
llvm::getKillRegState
unsigned getKillRegState(bool B)
Definition:MachineInstrBuilder.h:555
llvm::createMips16InstrInfo
const MipsInstrInfo * createMips16InstrInfo(const MipsSubtarget &STI)
Create MipsInstrInfo objects.
Definition:Mips16InstrInfo.cpp:463
llvm::DestSourcePair
Definition:TargetInstrInfo.h:73

Generated on Sun Jul 20 2025 12:09:52 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp