Skip to content

Commit 023b5c1

Browse files
Yusra Syedaredstar
authored andcommitted
[SystemZ][NFC] Renaming of ELF specific variables.
Rename ELF specific variables, making it easier to add the XPLink variables in future patches. Reviewed By: abhina.sreeskantharajan, Kai Differential Revision: https://reviews.llvm.org/D98199
1 parent 429c6ec commit 023b5c1

File tree

8 files changed

+42
-42
lines changed

8 files changed

+42
-42
lines changed

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static MCAsmInfo *createSystemZMCAsmInfo(const MCRegisterInfo &MRI,
152152
MCAsmInfo *MAI = new SystemZMCAsmInfo(TT);
153153
MCCFIInstruction Inst = MCCFIInstruction::cfiDefCfa(
154154
nullptr, MRI.getDwarfRegNum(SystemZ::R15D, true),
155-
SystemZMC::CFAOffsetFromInitialSP);
155+
SystemZMC::ELFCFAOffsetFromInitialSP);
156156
MAI->addInitialFrameState(Inst);
157157
return MAI;
158158
}

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class raw_ostream;
3232
namespace SystemZMC {
3333
// How many bytes are in the ABI-defined, caller-allocated part of
3434
// a stack frame.
35-
const int64_t CallFrameSize = 160;
35+
const int64_t ELFCallFrameSize = 160;
3636

3737
// The offset of the DWARF CFA from the incoming stack pointer.
38-
const int64_t CFAOffsetFromInitialSP = CallFrameSize;
38+
const int64_t ELFCFAOffsetFromInitialSP = ELFCallFrameSize;
3939

4040
// Maps of asm register numbers to LLVM register numbers, with 0 indicating
4141
// an invalid register. In principle we could use 32-bit and 64-bit register

llvm/lib/Target/SystemZ/SystemZCallingConv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
using namespace llvm;
1313

14-
const MCPhysReg SystemZ::ArgGPRs[SystemZ::NumArgGPRs] = {
14+
const MCPhysReg SystemZ::ELFArgGPRs[SystemZ::ELFNumArgGPRs] = {
1515
SystemZ::R2D, SystemZ::R3D, SystemZ::R4D, SystemZ::R5D, SystemZ::R6D
1616
};
1717

18-
const MCPhysReg SystemZ::ArgFPRs[SystemZ::NumArgFPRs] = {
18+
const MCPhysReg SystemZ::ELFArgFPRs[SystemZ::ELFNumArgFPRs] = {
1919
SystemZ::F0D, SystemZ::F2D, SystemZ::F4D, SystemZ::F6D
2020
};

llvm/lib/Target/SystemZ/SystemZCallingConv.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
namespace llvm {
1717
namespace SystemZ {
18-
const unsigned NumArgGPRs = 5;
19-
extern const MCPhysReg ArgGPRs[NumArgGPRs];
18+
const unsigned ELFNumArgGPRs = 5;
19+
extern const MCPhysReg ELFArgGPRs[ELFNumArgGPRs];
2020

21-
const unsigned NumArgFPRs = 4;
22-
extern const MCPhysReg ArgFPRs[NumArgFPRs];
21+
const unsigned ELFNumArgFPRs = 4;
22+
extern const MCPhysReg ELFArgFPRs[ELFNumArgFPRs];
2323
} // end namespace SystemZ
2424

2525
class SystemZCCState : public CCState {
@@ -107,7 +107,7 @@ inline bool CC_SystemZ_I128Indirect(unsigned &ValNo, MVT &ValVT,
107107
// OK, we've collected all parts in the pending list. Allocate
108108
// the location (register or stack slot) for the indirect pointer.
109109
// (This duplicates the usual i64 calling convention rules.)
110-
unsigned Reg = State.AllocateReg(SystemZ::ArgGPRs);
110+
unsigned Reg = State.AllocateReg(SystemZ::ELFArgGPRs);
111111
unsigned Offset = Reg ? 0 : State.AllocateStack(8, Align(8));
112112

113113
// Use that same location for all the pending parts.

llvm/lib/Target/SystemZ/SystemZFrameLowering.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using namespace llvm;
2323

2424
namespace {
2525
// The ABI-defined register save slots, relative to the CFA (i.e.
26-
// incoming stack pointer + SystemZMC::CallFrameSize).
26+
// incoming stack pointer + SystemZMC::ELFCallFrameSize).
2727
static const TargetFrameLowering::SpillSlot SpillOffsetTable[] = {
2828
{ SystemZ::R2D, 0x10 },
2929
{ SystemZ::R3D, 0x18 },
@@ -75,7 +75,7 @@ assignCalleeSavedSpillSlots(MachineFunction &MF,
7575

7676
unsigned LowGPR = 0;
7777
unsigned HighGPR = SystemZ::R15D;
78-
int StartSPOffset = SystemZMC::CallFrameSize;
78+
int StartSPOffset = SystemZMC::ELFCallFrameSize;
7979
for (auto &CS : CSI) {
8080
unsigned Reg = CS.getReg();
8181
int Offset = getRegSpillOffset(MF, Reg);
@@ -84,7 +84,7 @@ assignCalleeSavedSpillSlots(MachineFunction &MF,
8484
LowGPR = Reg;
8585
StartSPOffset = Offset;
8686
}
87-
Offset -= SystemZMC::CallFrameSize;
87+
Offset -= SystemZMC::ELFCallFrameSize;
8888
int FrameIdx = MFFrame.CreateFixedSpillStackObject(8, Offset);
8989
CS.setFrameIdx(FrameIdx);
9090
} else
@@ -99,8 +99,8 @@ assignCalleeSavedSpillSlots(MachineFunction &MF,
9999
// already be included, but we also need to handle the call-clobbered
100100
// argument registers.
101101
unsigned FirstGPR = ZFI->getVarArgsFirstGPR();
102-
if (FirstGPR < SystemZ::NumArgGPRs) {
103-
unsigned Reg = SystemZ::ArgGPRs[FirstGPR];
102+
if (FirstGPR < SystemZ::ELFNumArgGPRs) {
103+
unsigned Reg = SystemZ::ELFArgGPRs[FirstGPR];
104104
int Offset = getRegSpillOffset(MF, Reg);
105105
if (StartSPOffset > Offset) {
106106
LowGPR = Reg; StartSPOffset = Offset;
@@ -110,7 +110,7 @@ assignCalleeSavedSpillSlots(MachineFunction &MF,
110110
ZFI->setSpillGPRRegs(LowGPR, HighGPR, StartSPOffset);
111111

112112
// Create fixed stack objects for the remaining registers.
113-
int CurrOffset = -SystemZMC::CallFrameSize;
113+
int CurrOffset = -SystemZMC::ELFCallFrameSize;
114114
if (usePackedStack(MF))
115115
CurrOffset += StartSPOffset;
116116

@@ -146,8 +146,8 @@ void SystemZFrameLowering::determineCalleeSaves(MachineFunction &MF,
146146
// Record these pending uses, which typically include the call-saved
147147
// argument register R6D.
148148
if (IsVarArg)
149-
for (unsigned I = MFI->getVarArgsFirstGPR(); I < SystemZ::NumArgGPRs; ++I)
150-
SavedRegs.set(SystemZ::ArgGPRs[I]);
149+
for (unsigned I = MFI->getVarArgsFirstGPR(); I < SystemZ::ELFNumArgGPRs; ++I)
150+
SavedRegs.set(SystemZ::ELFArgGPRs[I]);
151151

152152
// If there are any landing pads, entering them will modify r6/r7.
153153
if (!MF.getLandingPads().empty()) {
@@ -234,8 +234,8 @@ bool SystemZFrameLowering::spillCalleeSavedRegisters(
234234

235235
// ...likewise GPR varargs.
236236
if (IsVarArg)
237-
for (unsigned I = ZFI->getVarArgsFirstGPR(); I < SystemZ::NumArgGPRs; ++I)
238-
addSavedGPR(MBB, MIB, SystemZ::ArgGPRs[I], true);
237+
for (unsigned I = ZFI->getVarArgsFirstGPR(); I < SystemZ::ELFNumArgGPRs; ++I)
238+
addSavedGPR(MBB, MIB, SystemZ::ELFArgGPRs[I], true);
239239
}
240240

241241
// Save FPRs/VRs in the normal TargetInstrInfo way.
@@ -326,7 +326,7 @@ processFunctionBeforeFrameFinalized(MachineFunction &MF,
326326

327327
// Get the size of our stack frame to be allocated ...
328328
uint64_t StackSize = (MFFrame.estimateStackSize(MF) +
329-
SystemZMC::CallFrameSize);
329+
SystemZMC::ELFCallFrameSize);
330330
// ... and the maximum offset we may need to reach into the
331331
// caller's frame to access the save area or stack arguments.
332332
int64_t MaxArgOffset = 0;
@@ -437,7 +437,7 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
437437
report_fatal_error(
438438
"In GHC calling convention a frame pointer is not supported");
439439
}
440-
MFFrame.setStackSize(MFFrame.getStackSize() + SystemZMC::CallFrameSize);
440+
MFFrame.setStackSize(MFFrame.getStackSize() + SystemZMC::ELFCallFrameSize);
441441
return;
442442
}
443443

@@ -446,7 +446,7 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
446446
DebugLoc DL;
447447

448448
// The current offset of the stack pointer from the CFA.
449-
int64_t SPOffsetFromCFA = -SystemZMC::CFAOffsetFromInitialSP;
449+
int64_t SPOffsetFromCFA = -SystemZMC::ELFCFAOffsetFromInitialSP;
450450

451451
if (ZFI->getSpillGPRRegs().LowGPR) {
452452
// Skip over the GPR saves.
@@ -480,10 +480,10 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
480480
break;
481481
}
482482
if (HasStackObject || MFFrame.hasCalls())
483-
StackSize += SystemZMC::CallFrameSize;
483+
StackSize += SystemZMC::ELFCallFrameSize;
484484
// Don't allocate the incoming reg save area.
485-
StackSize = StackSize > SystemZMC::CallFrameSize
486-
? StackSize - SystemZMC::CallFrameSize
485+
StackSize = StackSize > SystemZMC::ELFCallFrameSize
486+
? StackSize - SystemZMC::ELFCallFrameSize
487487
: 0;
488488
MFFrame.setStackSize(StackSize);
489489

@@ -638,7 +638,7 @@ void SystemZFrameLowering::inlineStackProbe(MachineFunction &MF,
638638
const unsigned ProbeSize = TLI.getStackProbeSize(MF);
639639
uint64_t NumFullBlocks = StackSize / ProbeSize;
640640
uint64_t Residual = StackSize % ProbeSize;
641-
int64_t SPOffsetFromCFA = -SystemZMC::CFAOffsetFromInitialSP;
641+
int64_t SPOffsetFromCFA = -SystemZMC::ELFCFAOffsetFromInitialSP;
642642
MachineBasicBlock *MBB = &PrologMBB;
643643
MachineBasicBlock::iterator MBBI = StackAllocMI;
644644
const DebugLoc DL = StackAllocMI->getDebugLoc();
@@ -682,7 +682,7 @@ void SystemZFrameLowering::inlineStackProbe(MachineFunction &MF,
682682
.addReg(SystemZ::R15D);
683683
buildDefCFAReg(*MBB, MBBI, DL, SystemZ::R0D, ZII);
684684
emitIncrement(*MBB, MBBI, DL, SystemZ::R0D, -int64_t(LoopAlloc), ZII);
685-
buildCFAOffs(*MBB, MBBI, DL, -int64_t(SystemZMC::CallFrameSize + LoopAlloc),
685+
buildCFAOffs(*MBB, MBBI, DL, -int64_t(SystemZMC::ELFCallFrameSize + LoopAlloc),
686686
ZII);
687687

688688
DoneMBB = SystemZ::splitBlockBefore(MBBI, MBB);
@@ -737,11 +737,11 @@ SystemZFrameLowering::hasReservedCallFrame(const MachineFunction &MF) const {
737737
StackOffset
738738
SystemZFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI,
739739
Register &FrameReg) const {
740-
// Our incoming SP is actually SystemZMC::CallFrameSize below the CFA, so
740+
// Our incoming SP is actually SystemZMC::ELFCallFrameSize below the CFA, so
741741
// add that difference here.
742742
StackOffset Offset =
743743
TargetFrameLowering::getFrameIndexReference(MF, FI, FrameReg);
744-
return Offset + StackOffset::getFixed(SystemZMC::CallFrameSize);
744+
return Offset + StackOffset::getFixed(SystemZMC::ELFCallFrameSize);
745745
}
746746

747747
MachineBasicBlock::iterator SystemZFrameLowering::
@@ -784,7 +784,7 @@ getOrCreateFramePointerSaveIndex(MachineFunction &MF) const {
784784
int FI = ZFI->getFramePointerSaveIndex();
785785
if (!FI) {
786786
MachineFrameInfo &MFFrame = MF.getFrameInfo();
787-
int Offset = getBackchainOffset(MF) - SystemZMC::CallFrameSize;
787+
int Offset = getBackchainOffset(MF) - SystemZMC::ELFCallFrameSize;
788788
FI = MFFrame.CreateFixedObject(8, Offset, false);
789789
ZFI->setFramePointerSaveIndex(FI);
790790
}

llvm/lib/Target/SystemZ/SystemZFrameLowering.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class SystemZFrameLowering : public TargetFrameLowering {
6868
// Return the offset of the backchain.
6969
unsigned getBackchainOffset(MachineFunction &MF) const {
7070
// The back chain is stored topmost with packed-stack.
71-
return usePackedStack(MF) ? SystemZMC::CallFrameSize - 8 : 0;
71+
return usePackedStack(MF) ? SystemZMC::ELFCallFrameSize - 8 : 0;
7272
}
7373
};
7474
} // end namespace llvm

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,20 +1482,20 @@ SDValue SystemZTargetLowering::LowerFormalArguments(
14821482
// ...and a similar frame index for the caller-allocated save area
14831483
// that will be used to store the incoming registers.
14841484
int64_t RegSaveOffset =
1485-
-SystemZMC::CallFrameSize + TFL->getRegSpillOffset(MF, SystemZ::R2D) - 16;
1485+
-SystemZMC::ELFCallFrameSize + TFL->getRegSpillOffset(MF, SystemZ::R2D) - 16;
14861486
unsigned RegSaveIndex = MFI.CreateFixedObject(1, RegSaveOffset, true);
14871487
FuncInfo->setRegSaveFrameIndex(RegSaveIndex);
14881488

14891489
// Store the FPR varargs in the reserved frame slots. (We store the
14901490
// GPRs as part of the prologue.)
1491-
if (NumFixedFPRs < SystemZ::NumArgFPRs && !useSoftFloat()) {
1492-
SDValue MemOps[SystemZ::NumArgFPRs];
1493-
for (unsigned I = NumFixedFPRs; I < SystemZ::NumArgFPRs; ++I) {
1494-
unsigned Offset = TFL->getRegSpillOffset(MF, SystemZ::ArgFPRs[I]);
1491+
if (NumFixedFPRs < SystemZ::ELFNumArgFPRs && !useSoftFloat()) {
1492+
SDValue MemOps[SystemZ::ELFNumArgFPRs];
1493+
for (unsigned I = NumFixedFPRs; I < SystemZ::ELFNumArgFPRs; ++I) {
1494+
unsigned Offset = TFL->getRegSpillOffset(MF, SystemZ::ELFArgFPRs[I]);
14951495
int FI =
1496-
MFI.CreateFixedObject(8, -SystemZMC::CallFrameSize + Offset, true);
1496+
MFI.CreateFixedObject(8, -SystemZMC::ELFCallFrameSize + Offset, true);
14971497
SDValue FIN = DAG.getFrameIndex(FI, getPointerTy(DAG.getDataLayout()));
1498-
unsigned VReg = MF.addLiveIn(SystemZ::ArgFPRs[I],
1498+
unsigned VReg = MF.addLiveIn(SystemZ::ELFArgFPRs[I],
14991499
&SystemZ::FP64BitRegClass);
15001500
SDValue ArgValue = DAG.getCopyFromReg(Chain, DL, VReg, MVT::f64);
15011501
MemOps[I] = DAG.getStore(ArgValue.getValue(1), DL, ArgValue, FIN,
@@ -1504,7 +1504,7 @@ SDValue SystemZTargetLowering::LowerFormalArguments(
15041504
// Join the stores, which are independent of one another.
15051505
Chain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other,
15061506
makeArrayRef(&MemOps[NumFixedFPRs],
1507-
SystemZ::NumArgFPRs-NumFixedFPRs));
1507+
SystemZ::ELFNumArgFPRs-NumFixedFPRs));
15081508
}
15091509
}
15101510

@@ -1628,7 +1628,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
16281628
// floats are passed as right-justified 8-byte values.
16291629
if (!StackPtr.getNode())
16301630
StackPtr = DAG.getCopyFromReg(Chain, DL, SystemZ::R15D, PtrVT);
1631-
unsigned Offset = SystemZMC::CallFrameSize + VA.getLocMemOffset();
1631+
unsigned Offset = SystemZMC::ELFCallFrameSize + VA.getLocMemOffset();
16321632
if (VA.getLocVT() == MVT::i32 || VA.getLocVT() == MVT::f32)
16331633
Offset += 4;
16341634
SDValue Address = DAG.getNode(ISD::ADD, DL, PtrVT, StackPtr,

llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void SystemZInstrInfo::splitAdjDynAlloc(MachineBasicBlock::iterator MI) const {
120120
MachineOperand &OffsetMO = MI->getOperand(2);
121121

122122
uint64_t Offset = (MFFrame.getMaxCallFrameSize() +
123-
SystemZMC::CallFrameSize +
123+
SystemZMC::ELFCallFrameSize +
124124
OffsetMO.getImm());
125125
unsigned NewOpcode = getOpcodeForOffset(SystemZ::LA, Offset);
126126
assert(NewOpcode && "No support for huge argument lists yet");

0 commit comments

Comments
 (0)