mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[CodeGen][NFC] Simplify checks for stack protector index checking
Use `hasStackProtectorIndex()` instead of `getStackProtectorIndex() >= 0`. llvm-svn: 366369
This commit is contained in:
parent
0c0bddc3d0
commit
336985e46d
@ -199,19 +199,19 @@ void LocalStackSlotPass::calculateFrameObjectOffsets(MachineFunction &Fn) {
|
|||||||
// Make sure that the stack protector comes before the local variables on the
|
// Make sure that the stack protector comes before the local variables on the
|
||||||
// stack.
|
// stack.
|
||||||
SmallSet<int, 16> ProtectedObjs;
|
SmallSet<int, 16> ProtectedObjs;
|
||||||
if (MFI.getStackProtectorIndex() >= 0) {
|
if (MFI.hasStackProtectorIndex()) {
|
||||||
|
int StackProtectorFI = MFI.getStackProtectorIndex();
|
||||||
StackObjSet LargeArrayObjs;
|
StackObjSet LargeArrayObjs;
|
||||||
StackObjSet SmallArrayObjs;
|
StackObjSet SmallArrayObjs;
|
||||||
StackObjSet AddrOfObjs;
|
StackObjSet AddrOfObjs;
|
||||||
|
|
||||||
AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), Offset,
|
AdjustStackOffset(MFI, StackProtectorFI, Offset, StackGrowsDown, MaxAlign);
|
||||||
StackGrowsDown, MaxAlign);
|
|
||||||
|
|
||||||
// Assign large stack objects first.
|
// Assign large stack objects first.
|
||||||
for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
|
for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
|
||||||
if (MFI.isDeadObjectIndex(i))
|
if (MFI.isDeadObjectIndex(i))
|
||||||
continue;
|
continue;
|
||||||
if (MFI.getStackProtectorIndex() == (int)i)
|
if (StackProtectorFI == (int)i)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (MFI.getObjectSSPLayout(i)) {
|
switch (MFI.getObjectSSPLayout(i)) {
|
||||||
|
@ -927,18 +927,18 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) {
|
|||||||
// Make sure that the stack protector comes before the local variables on the
|
// Make sure that the stack protector comes before the local variables on the
|
||||||
// stack.
|
// stack.
|
||||||
SmallSet<int, 16> ProtectedObjs;
|
SmallSet<int, 16> ProtectedObjs;
|
||||||
if (MFI.getStackProtectorIndex() >= 0) {
|
if (MFI.hasStackProtectorIndex()) {
|
||||||
|
int StackProtectorFI = MFI.getStackProtectorIndex();
|
||||||
StackObjSet LargeArrayObjs;
|
StackObjSet LargeArrayObjs;
|
||||||
StackObjSet SmallArrayObjs;
|
StackObjSet SmallArrayObjs;
|
||||||
StackObjSet AddrOfObjs;
|
StackObjSet AddrOfObjs;
|
||||||
|
|
||||||
AdjustStackOffset(MFI, MFI.getStackProtectorIndex(), StackGrowsDown,
|
AdjustStackOffset(MFI, StackProtectorFI, StackGrowsDown, Offset, MaxAlign,
|
||||||
Offset, MaxAlign, Skew);
|
Skew);
|
||||||
|
|
||||||
// Assign large stack objects first.
|
// Assign large stack objects first.
|
||||||
for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
|
for (unsigned i = 0, e = MFI.getObjectIndexEnd(); i != e; ++i) {
|
||||||
if (MFI.isObjectPreAllocated(i) &&
|
if (MFI.isObjectPreAllocated(i) && MFI.getUseLocalStackAllocationBlock())
|
||||||
MFI.getUseLocalStackAllocationBlock())
|
|
||||||
continue;
|
continue;
|
||||||
if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
|
if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex)
|
||||||
continue;
|
continue;
|
||||||
@ -946,8 +946,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) {
|
|||||||
continue;
|
continue;
|
||||||
if (MFI.isDeadObjectIndex(i))
|
if (MFI.isDeadObjectIndex(i))
|
||||||
continue;
|
continue;
|
||||||
if (MFI.getStackProtectorIndex() == (int)i ||
|
if (StackProtectorFI == (int)i || EHRegNodeFrameIndex == (int)i)
|
||||||
EHRegNodeFrameIndex == (int)i)
|
|
||||||
continue;
|
continue;
|
||||||
if (MFI.getStackID(i) !=
|
if (MFI.getStackID(i) !=
|
||||||
TargetStackID::Default) // Only allocate objects on the default stack.
|
TargetStackID::Default) // Only allocate objects on the default stack.
|
||||||
@ -990,8 +989,7 @@ void PEI::calculateFrameObjectOffsets(MachineFunction &MF) {
|
|||||||
continue;
|
continue;
|
||||||
if (MFI.isDeadObjectIndex(i))
|
if (MFI.isDeadObjectIndex(i))
|
||||||
continue;
|
continue;
|
||||||
if (MFI.getStackProtectorIndex() == (int)i ||
|
if (MFI.getStackProtectorIndex() == (int)i || EHRegNodeFrameIndex == (int)i)
|
||||||
EHRegNodeFrameIndex == (int)i)
|
|
||||||
continue;
|
continue;
|
||||||
if (ProtectedObjs.count(i))
|
if (ProtectedObjs.count(i))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user