Skip to content

Commit 612b038

Browse files
committed
[AArch64] NFC: Add generic StackOffset to describe scalable offsets.
To support spilling/filling of scalable vectors we need a more generic representation of a stack offset than simply 'int'. For this we introduce the StackOffset struct, which comprises multiple offsets sized by their respective MVTs. Byte-offsets will thus be a simple tuple such as { offset, MVT::i8 }. Adding two byte-offsets will result in a byte offset { offsetA + offsetB, MVT::i8 }. When two offsets have different types, we can canonicalise them to use the same MVT, as long as their runtime sizes are guaranteed to have the same size-ratio as they would have at compile-time. When we have both scalable- and fixed-size objects on the stack, we can create an offset that is: ({ offset_fixed, MVT::i8 } + { offset_scalable, MVT::nxv1i8 }) The struct also contains a getForFrameOffset() method that is specific to AArch64 and decomposes the frame-offset to be used directly in instructions that operate on the stack or index into the stack. Note: This patch adds StackOffset as an AArch64-only concept, but we would like to make this a generic concept/struct that is supported by all interfaces that take or return stack offsets (currently as 'int'). Since that would be a bigger change that is currently pending on D32530 landing, we thought it makes sense to first show/prove the concept in the AArch64 target before proposing to roll this out further. Reviewers: thegameg, rovka, t.p.northover, efriedma, greened Reviewed By: rovka, greened Differential Revision: https://reviews.llvm.org/D61435 llvm-svn: 368024
1 parent 2fbf58c commit 612b038

File tree

9 files changed

+260
-74
lines changed

9 files changed

+260
-74
lines changed

llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,11 +659,12 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock &MBB,
659659
// instruction sequence.
660660
int BaseOffset = -AFI->getTaggedBasePointerOffset();
661661
unsigned FrameReg;
662-
int FrameRegOffset = TFI->resolveFrameOffsetReference(
663-
MF, BaseOffset, false /*isFixed*/, FrameReg, /*PreferFP=*/false,
662+
StackOffset FrameRegOffset = TFI->resolveFrameOffsetReference(
663+
MF, BaseOffset, false /*isFixed*/, FrameReg,
664+
/*PreferFP=*/false,
664665
/*ForSimm=*/true);
665666
Register SrcReg = FrameReg;
666-
if (FrameRegOffset != 0) {
667+
if (FrameRegOffset) {
667668
// Use output register as temporary.
668669
SrcReg = MI.getOperand(0).getReg();
669670
emitFrameOffset(MBB, &MI, MI.getDebugLoc(), SrcReg, FrameReg,

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 48 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
#include "AArch64InstrInfo.h"
9595
#include "AArch64MachineFunctionInfo.h"
9696
#include "AArch64RegisterInfo.h"
97+
#include "AArch64StackOffset.h"
9798
#include "AArch64Subtarget.h"
9899
#include "AArch64TargetMachine.h"
99100
#include "MCTargetDesc/AArch64AddressingModes.h"
@@ -173,7 +174,7 @@ static unsigned estimateRSStackSizeLimit(MachineFunction &MF) {
173174
if (!MO.isFI())
174175
continue;
175176

176-
int Offset = 0;
177+
StackOffset Offset;
177178
if (isAArch64FrameOffsetLegal(MI, Offset, nullptr, nullptr, nullptr) ==
178179
AArch64FrameOffsetCannotUpdate)
179180
return 0;
@@ -273,14 +274,15 @@ MachineBasicBlock::iterator AArch64FrameLowering::eliminateCallFramePseudoInstr(
273274
// Most call frames will be allocated at the start of a function so
274275
// this is OK, but it is a limitation that needs dealing with.
275276
assert(Amount > -0xffffff && Amount < 0xffffff && "call frame too large");
276-
emitFrameOffset(MBB, I, DL, AArch64::SP, AArch64::SP, Amount, TII);
277+
emitFrameOffset(MBB, I, DL, AArch64::SP, AArch64::SP, {Amount, MVT::i8},
278+
TII);
277279
}
278280
} else if (CalleePopAmount != 0) {
279281
// If the calling convention demands that the callee pops arguments from the
280282
// stack, we want to add it back if we have a reserved call frame.
281283
assert(CalleePopAmount < 0xffffff && "call frame too large");
282-
emitFrameOffset(MBB, I, DL, AArch64::SP, AArch64::SP, -CalleePopAmount,
283-
TII);
284+
emitFrameOffset(MBB, I, DL, AArch64::SP, AArch64::SP,
285+
{-(int64_t)CalleePopAmount, MVT::i8}, TII);
284286
}
285287
return MBB.erase(I);
286288
}
@@ -866,8 +868,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
866868
AFI->setHasRedZone(true);
867869
++NumRedZoneFunctions;
868870
} else {
869-
emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP, -NumBytes, TII,
870-
MachineInstr::FrameSetup, false, NeedsWinCFI, &HasWinCFI);
871+
emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP,
872+
{-NumBytes, MVT::i8}, TII, MachineInstr::FrameSetup,
873+
false, NeedsWinCFI, &HasWinCFI);
871874
if (!NeedsWinCFI) {
872875
// Label used to tie together the PROLOG_LABEL and the MachineMoves.
873876
MCSymbol *FrameLabel = MMI.getContext().createTempSymbol();
@@ -901,8 +904,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
901904
AFI->setLocalStackSize(NumBytes - PrologueSaveSize);
902905
bool CombineSPBump = shouldCombineCSRLocalStackBump(MF, NumBytes);
903906
if (CombineSPBump) {
904-
emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP, -NumBytes, TII,
905-
MachineInstr::FrameSetup, false, NeedsWinCFI, &HasWinCFI);
907+
emitFrameOffset(MBB, MBBI, DL, AArch64::SP, AArch64::SP,
908+
{-NumBytes, MVT::i8}, TII, MachineInstr::FrameSetup, false,
909+
NeedsWinCFI, &HasWinCFI);
906910
NumBytes = 0;
907911
} else if (PrologueSaveSize != 0) {
908912
MBBI = convertCalleeSaveRestoreToSPPrePostIncDec(
@@ -958,8 +962,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
958962
// mov fp,sp when FPOffset is zero.
959963
// Note: All stores of callee-saved registers are marked as "FrameSetup".
960964
// This code marks the instruction(s) that set the FP also.
961-
emitFrameOffset(MBB, MBBI, DL, AArch64::FP, AArch64::SP, FPOffset, TII,
962-
MachineInstr::FrameSetup, false, NeedsWinCFI, &HasWinCFI);
965+
emitFrameOffset(MBB, MBBI, DL, AArch64::FP, AArch64::SP,
966+
{FPOffset, MVT::i8}, TII, MachineInstr::FrameSetup, false,
967+
NeedsWinCFI, &HasWinCFI);
963968
}
964969

965970
if (windowsRequiresStackProbe(MF, NumBytes)) {
@@ -1071,8 +1076,9 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
10711076
// FIXME: in the case of dynamic re-alignment, NumBytes doesn't have
10721077
// the correct value here, as NumBytes also includes padding bytes,
10731078
// which shouldn't be counted here.
1074-
emitFrameOffset(MBB, MBBI, DL, scratchSPReg, AArch64::SP, -NumBytes, TII,
1075-
MachineInstr::FrameSetup, false, NeedsWinCFI, &HasWinCFI);
1079+
emitFrameOffset(MBB, MBBI, DL, scratchSPReg, AArch64::SP,
1080+
{-NumBytes, MVT::i8}, TII, MachineInstr::FrameSetup,
1081+
false, NeedsWinCFI, &HasWinCFI);
10761082

10771083
if (NeedsRealignment) {
10781084
const unsigned Alignment = MFI.getMaxAlignment();
@@ -1404,8 +1410,8 @@ void AArch64FrameLowering::emitEpilogue(MachineFunction &MF,
14041410
// If there is a single SP update, insert it before the ret and we're done.
14051411
if (CombineSPBump) {
14061412
emitFrameOffset(MBB, MBB.getFirstTerminator(), DL, AArch64::SP, AArch64::SP,
1407-
NumBytes + AfterCSRPopSize, TII, MachineInstr::FrameDestroy,
1408-
false, NeedsWinCFI, &HasWinCFI);
1413+
{NumBytes + (int64_t)AfterCSRPopSize, MVT::i8}, TII,
1414+
MachineInstr::FrameDestroy, false, NeedsWinCFI, &HasWinCFI);
14091415
if (NeedsWinCFI && HasWinCFI)
14101416
BuildMI(MBB, MBB.getFirstTerminator(), DL,
14111417
TII->get(AArch64::SEH_EpilogEnd))
@@ -1437,8 +1443,8 @@ void AArch64FrameLowering::emitEpilogue(MachineFunction &MF,
14371443
adaptForLdStOpt(MBB, MBB.getFirstTerminator(), LastPopI);
14381444

14391445
emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::SP,
1440-
StackRestoreBytes, TII, MachineInstr::FrameDestroy, false,
1441-
NeedsWinCFI, &HasWinCFI);
1446+
{StackRestoreBytes, MVT::i8}, TII,
1447+
MachineInstr::FrameDestroy, false, NeedsWinCFI, &HasWinCFI);
14421448
if (Done) {
14431449
if (NeedsWinCFI) {
14441450
HasWinCFI = true;
@@ -1458,11 +1464,12 @@ void AArch64FrameLowering::emitEpilogue(MachineFunction &MF,
14581464
// be able to save any instructions.
14591465
if (!IsFunclet && (MFI.hasVarSizedObjects() || AFI->isStackRealigned()))
14601466
emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::FP,
1461-
-AFI->getCalleeSavedStackSize() + 16, TII,
1462-
MachineInstr::FrameDestroy, false, NeedsWinCFI);
1467+
{-(int64_t)AFI->getCalleeSavedStackSize() + 16, MVT::i8},
1468+
TII, MachineInstr::FrameDestroy, false, NeedsWinCFI);
14631469
else if (NumBytes)
1464-
emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::SP, NumBytes, TII,
1465-
MachineInstr::FrameDestroy, false, NeedsWinCFI);
1470+
emitFrameOffset(MBB, LastPopI, DL, AArch64::SP, AArch64::SP,
1471+
{NumBytes, MVT::i8}, TII, MachineInstr::FrameDestroy, false,
1472+
NeedsWinCFI);
14661473

14671474
// This must be placed after the callee-save restore code because that code
14681475
// assumes the SP is at the same location as it was after the callee-save save
@@ -1483,8 +1490,8 @@ void AArch64FrameLowering::emitEpilogue(MachineFunction &MF,
14831490
adaptForLdStOpt(MBB, FirstSPPopI, LastPopI);
14841491

14851492
emitFrameOffset(MBB, FirstSPPopI, DL, AArch64::SP, AArch64::SP,
1486-
AfterCSRPopSize, TII, MachineInstr::FrameDestroy, false,
1487-
NeedsWinCFI, &HasWinCFI);
1493+
{(int64_t)AfterCSRPopSize, MVT::i8}, TII,
1494+
MachineInstr::FrameDestroy, false, NeedsWinCFI, &HasWinCFI);
14881495
}
14891496
if (NeedsWinCFI && HasWinCFI)
14901497
BuildMI(MBB, MBB.getFirstTerminator(), DL, TII->get(AArch64::SEH_EpilogEnd))
@@ -1501,29 +1508,30 @@ int AArch64FrameLowering::getFrameIndexReference(const MachineFunction &MF,
15011508
int FI,
15021509
unsigned &FrameReg) const {
15031510
return resolveFrameIndexReference(
1504-
MF, FI, FrameReg,
1505-
/*PreferFP=*/
1506-
MF.getFunction().hasFnAttribute(Attribute::SanitizeHWAddress),
1507-
/*ForSimm=*/false);
1511+
MF, FI, FrameReg,
1512+
/*PreferFP=*/
1513+
MF.getFunction().hasFnAttribute(Attribute::SanitizeHWAddress),
1514+
/*ForSimm=*/false)
1515+
.getBytes();
15081516
}
15091517

15101518
int AArch64FrameLowering::getNonLocalFrameIndexReference(
15111519
const MachineFunction &MF, int FI) const {
15121520
return getSEHFrameIndexOffset(MF, FI);
15131521
}
15141522

1515-
static int getFPOffset(const MachineFunction &MF, int ObjectOffset) {
1523+
static StackOffset getFPOffset(const MachineFunction &MF, int ObjectOffset) {
15161524
const auto *AFI = MF.getInfo<AArch64FunctionInfo>();
15171525
const auto &Subtarget = MF.getSubtarget<AArch64Subtarget>();
15181526
bool IsWin64 =
15191527
Subtarget.isCallingConvWin64(MF.getFunction().getCallingConv());
15201528
unsigned FixedObject = IsWin64 ? alignTo(AFI->getVarArgsGPRSize(), 16) : 0;
1521-
return ObjectOffset + FixedObject + 16;
1529+
return {ObjectOffset + FixedObject + 16, MVT::i8};
15221530
}
15231531

1524-
static int getStackOffset(const MachineFunction &MF, int ObjectOffset) {
1532+
static StackOffset getStackOffset(const MachineFunction &MF, int ObjectOffset) {
15251533
const auto &MFI = MF.getFrameInfo();
1526-
return ObjectOffset + MFI.getStackSize();
1534+
return {ObjectOffset + (int)MFI.getStackSize(), MVT::i8};
15271535
}
15281536

15291537
int AArch64FrameLowering::getSEHFrameIndexOffset(const MachineFunction &MF,
@@ -1532,22 +1540,21 @@ int AArch64FrameLowering::getSEHFrameIndexOffset(const MachineFunction &MF,
15321540
MF.getSubtarget().getRegisterInfo());
15331541
int ObjectOffset = MF.getFrameInfo().getObjectOffset(FI);
15341542
return RegInfo->getLocalAddressRegister(MF) == AArch64::FP
1535-
? getFPOffset(MF, ObjectOffset)
1536-
: getStackOffset(MF, ObjectOffset);
1543+
? getFPOffset(MF, ObjectOffset).getBytes()
1544+
: getStackOffset(MF, ObjectOffset).getBytes();
15371545
}
15381546

1539-
int AArch64FrameLowering::resolveFrameIndexReference(const MachineFunction &MF,
1540-
int FI, unsigned &FrameReg,
1541-
bool PreferFP,
1542-
bool ForSimm) const {
1547+
StackOffset AArch64FrameLowering::resolveFrameIndexReference(
1548+
const MachineFunction &MF, int FI, unsigned &FrameReg, bool PreferFP,
1549+
bool ForSimm) const {
15431550
const auto &MFI = MF.getFrameInfo();
15441551
int ObjectOffset = MFI.getObjectOffset(FI);
15451552
bool isFixed = MFI.isFixedObjectIndex(FI);
15461553
return resolveFrameOffsetReference(MF, ObjectOffset, isFixed, FrameReg,
15471554
PreferFP, ForSimm);
15481555
}
15491556

1550-
int AArch64FrameLowering::resolveFrameOffsetReference(
1557+
StackOffset AArch64FrameLowering::resolveFrameOffsetReference(
15511558
const MachineFunction &MF, int ObjectOffset, bool isFixed,
15521559
unsigned &FrameReg, bool PreferFP, bool ForSimm) const {
15531560
const auto &MFI = MF.getFrameInfo();
@@ -1556,8 +1563,8 @@ int AArch64FrameLowering::resolveFrameOffsetReference(
15561563
const auto *AFI = MF.getInfo<AArch64FunctionInfo>();
15571564
const auto &Subtarget = MF.getSubtarget<AArch64Subtarget>();
15581565

1559-
int FPOffset = getFPOffset(MF, ObjectOffset);
1560-
int Offset = getStackOffset(MF, ObjectOffset);
1566+
int FPOffset = getFPOffset(MF, ObjectOffset).getBytes();
1567+
int Offset = getStackOffset(MF, ObjectOffset).getBytes();
15611568
bool isCSR =
15621569
!isFixed && ObjectOffset >= -((int)AFI->getCalleeSavedStackSize());
15631570

@@ -1627,7 +1634,7 @@ int AArch64FrameLowering::resolveFrameOffsetReference(
16271634

16281635
if (UseFP) {
16291636
FrameReg = RegInfo->getFrameRegister(MF);
1630-
return FPOffset;
1637+
return StackOffset(FPOffset, MVT::i8);
16311638
}
16321639

16331640
// Use the base pointer if we have one.
@@ -1644,7 +1651,7 @@ int AArch64FrameLowering::resolveFrameOffsetReference(
16441651
Offset -= AFI->getLocalStackSize();
16451652
}
16461653

1647-
return Offset;
1654+
return StackOffset(Offset, MVT::i8);
16481655
}
16491656

16501657
static unsigned getPrologueDeath(MachineFunction &MF, unsigned Reg) {

llvm/lib/Target/AArch64/AArch64FrameLowering.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
1414
#define LLVM_LIB_TARGET_AARCH64_AARCH64FRAMELOWERING_H
1515

16+
#include "AArch64StackOffset.h"
1617
#include "llvm/CodeGen/TargetFrameLowering.h"
1718

1819
namespace llvm {
@@ -39,12 +40,13 @@ class AArch64FrameLowering : public TargetFrameLowering {
3940

4041
int getFrameIndexReference(const MachineFunction &MF, int FI,
4142
unsigned &FrameReg) const override;
42-
int resolveFrameIndexReference(const MachineFunction &MF, int FI,
43-
unsigned &FrameReg, bool PreferFP,
44-
bool ForSimm) const;
45-
int resolveFrameOffsetReference(const MachineFunction &MF, int ObjectOffset,
46-
bool isFixed, unsigned &FrameReg,
47-
bool PreferFP, bool ForSimm) const;
43+
StackOffset resolveFrameIndexReference(const MachineFunction &MF, int FI,
44+
unsigned &FrameReg, bool PreferFP,
45+
bool ForSimm) const;
46+
StackOffset resolveFrameOffsetReference(const MachineFunction &MF,
47+
int ObjectOffset, bool isFixed,
48+
unsigned &FrameReg, bool PreferFP,
49+
bool ForSimm) const;
4850
bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
4951
MachineBasicBlock::iterator MI,
5052
const std::vector<CalleeSavedInfo> &CSI,

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,10 +2974,12 @@ void AArch64InstrInfo::loadRegFromStackSlot(
29742974

29752975
void llvm::emitFrameOffset(MachineBasicBlock &MBB,
29762976
MachineBasicBlock::iterator MBBI, const DebugLoc &DL,
2977-
unsigned DestReg, unsigned SrcReg, int Offset,
2978-
const TargetInstrInfo *TII,
2977+
unsigned DestReg, unsigned SrcReg,
2978+
StackOffset SOffset, const TargetInstrInfo *TII,
29792979
MachineInstr::MIFlag Flag, bool SetNZCV,
29802980
bool NeedsWinCFI, bool *HasWinCFI) {
2981+
int64_t Offset;
2982+
SOffset.getForFrameOffset(Offset);
29812983
if (DestReg == SrcReg && Offset == 0)
29822984
return;
29832985

@@ -3239,7 +3241,8 @@ MachineInstr *AArch64InstrInfo::foldMemoryOperandImpl(
32393241
return nullptr;
32403242
}
32413243

3242-
int llvm::isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
3244+
int llvm::isAArch64FrameOffsetLegal(const MachineInstr &MI,
3245+
StackOffset &SOffset,
32433246
bool *OutUseUnscaledOp,
32443247
unsigned *OutUnscaledOp,
32453248
int *EmittableOffset) {
@@ -3283,7 +3286,7 @@ int llvm::isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
32833286
// Construct the complete offset.
32843287
const MachineOperand &ImmOpnd =
32853288
MI.getOperand(AArch64InstrInfo::getLoadStoreImmIdx(MI.getOpcode()));
3286-
Offset += ImmOpnd.getImm() * Scale;
3289+
int Offset = SOffset.getBytes() + ImmOpnd.getImm() * Scale;
32873290

32883291
// If the offset doesn't match the scale, we rewrite the instruction to
32893292
// use the unscaled instruction instead. Likewise, if we have a negative
@@ -3315,23 +3318,24 @@ int llvm::isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
33153318
if (OutUnscaledOp && UnscaledOp)
33163319
*OutUnscaledOp = *UnscaledOp;
33173320

3321+
SOffset = StackOffset(Offset, MVT::i8);
33183322
return AArch64FrameOffsetCanUpdate |
33193323
(Offset == 0 ? AArch64FrameOffsetIsLegal : 0);
33203324
}
33213325

33223326
bool llvm::rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
3323-
unsigned FrameReg, int &Offset,
3327+
unsigned FrameReg, StackOffset &Offset,
33243328
const AArch64InstrInfo *TII) {
33253329
unsigned Opcode = MI.getOpcode();
33263330
unsigned ImmIdx = FrameRegIdx + 1;
33273331

33283332
if (Opcode == AArch64::ADDSXri || Opcode == AArch64::ADDXri) {
3329-
Offset += MI.getOperand(ImmIdx).getImm();
3333+
Offset += StackOffset(MI.getOperand(ImmIdx).getImm(), MVT::i8);
33303334
emitFrameOffset(*MI.getParent(), MI, MI.getDebugLoc(),
33313335
MI.getOperand(0).getReg(), FrameReg, Offset, TII,
33323336
MachineInstr::NoFlags, (Opcode == AArch64::ADDSXri));
33333337
MI.eraseFromParent();
3334-
Offset = 0;
3338+
Offset = StackOffset();
33353339
return true;
33363340
}
33373341

@@ -3348,7 +3352,7 @@ bool llvm::rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
33483352
MI.setDesc(TII->get(UnscaledOp));
33493353

33503354
MI.getOperand(ImmIdx).ChangeToImmediate(NewOffset);
3351-
return Offset == 0;
3355+
return !Offset;
33523356
}
33533357

33543358
return false;

llvm/lib/Target/AArch64/AArch64InstrInfo.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "AArch64.h"
1717
#include "AArch64RegisterInfo.h"
18+
#include "AArch64StackOffset.h"
1819
#include "llvm/ADT/Optional.h"
1920
#include "llvm/CodeGen/MachineCombinerPattern.h"
2021
#include "llvm/CodeGen/TargetInstrInfo.h"
@@ -299,7 +300,7 @@ class AArch64InstrInfo final : public AArch64GenInstrInfo {
299300
/// if necessary, to be replaced by the scavenger at the end of PEI.
300301
void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
301302
const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
302-
int Offset, const TargetInstrInfo *TII,
303+
StackOffset Offset, const TargetInstrInfo *TII,
303304
MachineInstr::MIFlag = MachineInstr::NoFlags,
304305
bool SetNZCV = false, bool NeedsWinCFI = false,
305306
bool *HasWinCFI = nullptr);
@@ -308,7 +309,7 @@ void emitFrameOffset(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
308309
/// FP. Return false if the offset could not be handled directly in MI, and
309310
/// return the left-over portion by reference.
310311
bool rewriteAArch64FrameIndex(MachineInstr &MI, unsigned FrameRegIdx,
311-
unsigned FrameReg, int &Offset,
312+
unsigned FrameReg, StackOffset &Offset,
312313
const AArch64InstrInfo *TII);
313314

314315
/// Use to report the frame offset status in isAArch64FrameOffsetLegal.
@@ -332,7 +333,7 @@ enum AArch64FrameOffsetStatus {
332333
/// If set, @p EmittableOffset contains the amount that can be set in @p MI
333334
/// (possibly with @p OutUnscaledOp if OutUseUnscaledOp is true) and that
334335
/// is a legal offset.
335-
int isAArch64FrameOffsetLegal(const MachineInstr &MI, int &Offset,
336+
int isAArch64FrameOffsetLegal(const MachineInstr &MI, StackOffset &Offset,
336337
bool *OutUseUnscaledOp = nullptr,
337338
unsigned *OutUnscaledOp = nullptr,
338339
int *EmittableOffset = nullptr);

0 commit comments

Comments
 (0)