forked from OSchip/llvm-project
[Alignment][NFC] Use Align for TargetFrameLowering/Subtarget
Summary: This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68993 llvm-svn: 375084
This commit is contained in:
parent
943afb57aa
commit
882c43d703
|
@ -54,15 +54,15 @@ public:
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
StackDirection StackDir;
|
StackDirection StackDir;
|
||||||
unsigned StackAlignment;
|
Align StackAlignment;
|
||||||
unsigned TransientStackAlignment;
|
unsigned TransientStackAlignment;
|
||||||
int LocalAreaOffset;
|
int LocalAreaOffset;
|
||||||
bool StackRealignable;
|
bool StackRealignable;
|
||||||
public:
|
public:
|
||||||
TargetFrameLowering(StackDirection D, unsigned StackAl, int LAO,
|
TargetFrameLowering(StackDirection D, Align StackAl, int LAO,
|
||||||
unsigned TransAl = 1, bool StackReal = true)
|
unsigned TransAl = 1, bool StackReal = true)
|
||||||
: StackDir(D), StackAlignment(StackAl), TransientStackAlignment(TransAl),
|
: StackDir(D), StackAlignment(StackAl), TransientStackAlignment(TransAl),
|
||||||
LocalAreaOffset(LAO), StackRealignable(StackReal) {}
|
LocalAreaOffset(LAO), StackRealignable(StackReal) {}
|
||||||
|
|
||||||
virtual ~TargetFrameLowering();
|
virtual ~TargetFrameLowering();
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
/// stack pointer must be aligned on entry to a function. Typically, this
|
/// stack pointer must be aligned on entry to a function. Typically, this
|
||||||
/// is the largest alignment for any data object in the target.
|
/// is the largest alignment for any data object in the target.
|
||||||
///
|
///
|
||||||
unsigned getStackAlignment() const { return StackAlignment; }
|
unsigned getStackAlignment() const { return StackAlignment.value(); }
|
||||||
|
|
||||||
/// alignSPAdjust - This method aligns the stack adjustment to the correct
|
/// alignSPAdjust - This method aligns the stack adjustment to the correct
|
||||||
/// alignment.
|
/// alignment.
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace llvm {
|
||||||
class AArch64FrameLowering : public TargetFrameLowering {
|
class AArch64FrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
explicit AArch64FrameLowering()
|
explicit AArch64FrameLowering()
|
||||||
: TargetFrameLowering(StackGrowsDown, 16, 0, 16,
|
: TargetFrameLowering(StackGrowsDown, Align(16), 0, 16,
|
||||||
true /*StackRealignable*/) {}
|
true /*StackRealignable*/) {}
|
||||||
|
|
||||||
void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
|
void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include "AMDGPUFrameLowering.h"
|
#include "AMDGPUFrameLowering.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, unsigned StackAl,
|
AMDGPUFrameLowering::AMDGPUFrameLowering(StackDirection D, Align StackAl,
|
||||||
int LAO, unsigned TransAl)
|
int LAO, unsigned TransAl)
|
||||||
: TargetFrameLowering(D, StackAl, LAO, TransAl) { }
|
: TargetFrameLowering(D, StackAl, LAO, TransAl) {}
|
||||||
|
|
||||||
AMDGPUFrameLowering::~AMDGPUFrameLowering() = default;
|
AMDGPUFrameLowering::~AMDGPUFrameLowering() = default;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace llvm {
|
||||||
/// See TargetFrameInfo for more comments.
|
/// See TargetFrameInfo for more comments.
|
||||||
class AMDGPUFrameLowering : public TargetFrameLowering {
|
class AMDGPUFrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
AMDGPUFrameLowering(StackDirection D, unsigned StackAl, int LAO,
|
AMDGPUFrameLowering(StackDirection D, Align StackAl, int LAO,
|
||||||
unsigned TransAl = 1);
|
unsigned TransAl = 1);
|
||||||
~AMDGPUFrameLowering() override;
|
~AMDGPUFrameLowering() override;
|
||||||
|
|
||||||
|
|
|
@ -866,9 +866,7 @@ public:
|
||||||
// on the pointer value itself may rely on the alignment / known low bits of
|
// on the pointer value itself may rely on the alignment / known low bits of
|
||||||
// the pointer. Set this to something above the minimum to avoid needing
|
// the pointer. Set this to something above the minimum to avoid needing
|
||||||
// dynamic realignment in common cases.
|
// dynamic realignment in common cases.
|
||||||
unsigned getStackAlignment() const {
|
Align getStackAlignment() const { return Align(16); }
|
||||||
return 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool enableMachineScheduler() const override {
|
bool enableMachineScheduler() const override {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1257,9 +1255,7 @@ public:
|
||||||
return Gen;
|
return Gen;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getStackAlignment() const {
|
Align getStackAlignment() const { return Align(4); }
|
||||||
return 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
R600Subtarget &initializeSubtargetDependencies(const Triple &TT,
|
R600Subtarget &initializeSubtargetDependencies(const Triple &TT,
|
||||||
StringRef GPU, StringRef FS);
|
StringRef GPU, StringRef FS);
|
||||||
|
|
|
@ -15,9 +15,9 @@ namespace llvm {
|
||||||
|
|
||||||
class R600FrameLowering : public AMDGPUFrameLowering {
|
class R600FrameLowering : public AMDGPUFrameLowering {
|
||||||
public:
|
public:
|
||||||
R600FrameLowering(StackDirection D, unsigned StackAl, int LAO,
|
R600FrameLowering(StackDirection D, Align StackAl, int LAO,
|
||||||
unsigned TransAl = 1) :
|
unsigned TransAl = 1)
|
||||||
AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
|
: AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
|
||||||
~R600FrameLowering() override;
|
~R600FrameLowering() override;
|
||||||
|
|
||||||
void emitPrologue(MachineFunction &MF,
|
void emitPrologue(MachineFunction &MF,
|
||||||
|
|
|
@ -20,9 +20,9 @@ class GCNSubtarget;
|
||||||
|
|
||||||
class SIFrameLowering final : public AMDGPUFrameLowering {
|
class SIFrameLowering final : public AMDGPUFrameLowering {
|
||||||
public:
|
public:
|
||||||
SIFrameLowering(StackDirection D, unsigned StackAl, int LAO,
|
SIFrameLowering(StackDirection D, Align StackAl, int LAO,
|
||||||
unsigned TransAl = 1) :
|
unsigned TransAl = 1)
|
||||||
AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
|
: AMDGPUFrameLowering(D, StackAl, LAO, TransAl) {}
|
||||||
~SIFrameLowering() override = default;
|
~SIFrameLowering() override = default;
|
||||||
|
|
||||||
void emitEntryFunctionPrologue(MachineFunction &MF,
|
void emitEntryFunctionPrologue(MachineFunction &MF,
|
||||||
|
|
|
@ -2816,7 +2816,7 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||||
int32_t Offset = LocMemOffset;
|
int32_t Offset = LocMemOffset;
|
||||||
|
|
||||||
SDValue PtrOff = DAG.getConstant(Offset, DL, PtrVT);
|
SDValue PtrOff = DAG.getConstant(Offset, DL, PtrVT);
|
||||||
unsigned Align = 0;
|
MaybeAlign Alignment;
|
||||||
|
|
||||||
if (IsTailCall) {
|
if (IsTailCall) {
|
||||||
ISD::ArgFlagsTy Flags = Outs[realArgIdx].Flags;
|
ISD::ArgFlagsTy Flags = Outs[realArgIdx].Flags;
|
||||||
|
@ -2824,8 +2824,10 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||||
Flags.getByValSize() : VA.getValVT().getStoreSize();
|
Flags.getByValSize() : VA.getValVT().getStoreSize();
|
||||||
|
|
||||||
// FIXME: We can have better than the minimum byval required alignment.
|
// FIXME: We can have better than the minimum byval required alignment.
|
||||||
Align = Flags.isByVal() ? Flags.getByValAlign() :
|
Alignment =
|
||||||
MinAlign(Subtarget->getStackAlignment(), Offset);
|
Flags.isByVal()
|
||||||
|
? MaybeAlign(Flags.getByValAlign())
|
||||||
|
: commonAlignment(Subtarget->getStackAlignment(), Offset);
|
||||||
|
|
||||||
Offset = Offset + FPDiff;
|
Offset = Offset + FPDiff;
|
||||||
int FI = MFI.CreateFixedObject(OpSize, Offset, true);
|
int FI = MFI.CreateFixedObject(OpSize, Offset, true);
|
||||||
|
@ -2844,7 +2846,8 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||||
} else {
|
} else {
|
||||||
DstAddr = PtrOff;
|
DstAddr = PtrOff;
|
||||||
DstInfo = MachinePointerInfo::getStack(MF, LocMemOffset);
|
DstInfo = MachinePointerInfo::getStack(MF, LocMemOffset);
|
||||||
Align = MinAlign(Subtarget->getStackAlignment(), LocMemOffset);
|
Alignment =
|
||||||
|
commonAlignment(Subtarget->getStackAlignment(), LocMemOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Outs[i].Flags.isByVal()) {
|
if (Outs[i].Flags.isByVal()) {
|
||||||
|
@ -2859,7 +2862,8 @@ SDValue SITargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||||
|
|
||||||
MemOpChains.push_back(Cpy);
|
MemOpChains.push_back(Cpy);
|
||||||
} else {
|
} else {
|
||||||
SDValue Store = DAG.getStore(Chain, DL, Arg, DstAddr, DstInfo, Align);
|
SDValue Store = DAG.getStore(Chain, DL, Arg, DstAddr, DstInfo,
|
||||||
|
Alignment ? Alignment->value() : 0);
|
||||||
MemOpChains.push_back(Store);
|
MemOpChains.push_back(Store);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ class ARCInstrInfo;
|
||||||
class ARCFrameLowering : public TargetFrameLowering {
|
class ARCFrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
ARCFrameLowering(const ARCSubtarget &st)
|
ARCFrameLowering(const ARCSubtarget &st)
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 4, 0), ST(st) {
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(4), 0),
|
||||||
}
|
ST(st) {}
|
||||||
|
|
||||||
/// Insert Prologue into the function.
|
/// Insert Prologue into the function.
|
||||||
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
||||||
|
|
|
@ -205,9 +205,9 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
||||||
NoARM = true;
|
NoARM = true;
|
||||||
|
|
||||||
if (isAAPCS_ABI())
|
if (isAAPCS_ABI())
|
||||||
stackAlignment = 8;
|
stackAlignment = Align(8);
|
||||||
if (isTargetNaCl() || isAAPCS16_ABI())
|
if (isTargetNaCl() || isAAPCS16_ABI())
|
||||||
stackAlignment = 16;
|
stackAlignment = Align(16);
|
||||||
|
|
||||||
// FIXME: Completely disable sibcall for Thumb1 since ThumbRegisterInfo::
|
// FIXME: Completely disable sibcall for Thumb1 since ThumbRegisterInfo::
|
||||||
// emitEpilogue is not ready for them. Thumb tail calls also use t2B, as
|
// emitEpilogue is not ready for them. Thumb tail calls also use t2B, as
|
||||||
|
|
|
@ -449,7 +449,7 @@ protected:
|
||||||
|
|
||||||
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
||||||
/// entry to the function and which must be maintained by every function.
|
/// entry to the function and which must be maintained by every function.
|
||||||
unsigned stackAlignment = 4;
|
Align stackAlignment = Align(4);
|
||||||
|
|
||||||
/// CPUString - String name of used CPU.
|
/// CPUString - String name of used CPU.
|
||||||
std::string CPUString;
|
std::string CPUString;
|
||||||
|
@ -816,7 +816,7 @@ public:
|
||||||
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
||||||
/// stack frame on entry to the function and which must be maintained by every
|
/// stack frame on entry to the function and which must be maintained by every
|
||||||
/// function for this subtarget.
|
/// function for this subtarget.
|
||||||
unsigned getStackAlignment() const { return stackAlignment; }
|
Align getStackAlignment() const { return stackAlignment; }
|
||||||
|
|
||||||
unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
|
unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
AVRFrameLowering::AVRFrameLowering()
|
AVRFrameLowering::AVRFrameLowering()
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 1, -2) {}
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align::None(),
|
||||||
|
-2) {}
|
||||||
|
|
||||||
bool AVRFrameLowering::canSimplifyCallFramePseudos(
|
bool AVRFrameLowering::canSimplifyCallFramePseudos(
|
||||||
const MachineFunction &MF) const {
|
const MachineFunction &MF) const {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class BPFSubtarget;
|
||||||
class BPFFrameLowering : public TargetFrameLowering {
|
class BPFFrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
explicit BPFFrameLowering(const BPFSubtarget &sti)
|
explicit BPFFrameLowering(const BPFSubtarget &sti)
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8, 0) {}
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(8), 0) {}
|
||||||
|
|
||||||
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
||||||
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
|
||||||
|
|
|
@ -30,7 +30,7 @@ class TargetRegisterClass;
|
||||||
class HexagonFrameLowering : public TargetFrameLowering {
|
class HexagonFrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
explicit HexagonFrameLowering()
|
explicit HexagonFrameLowering()
|
||||||
: TargetFrameLowering(StackGrowsDown, 8, 0, 1, true) {}
|
: TargetFrameLowering(StackGrowsDown, Align(8), 0, 1, true) {}
|
||||||
|
|
||||||
// All of the prolog/epilog functionality, including saving and restoring
|
// All of the prolog/epilog functionality, including saving and restoring
|
||||||
// callee-saved registers is handled in emitPrologue. This is to have the
|
// callee-saved registers is handled in emitPrologue. This is to have the
|
||||||
|
|
|
@ -31,7 +31,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
explicit LanaiFrameLowering(const LanaiSubtarget &Subtarget)
|
explicit LanaiFrameLowering(const LanaiSubtarget &Subtarget)
|
||||||
: TargetFrameLowering(StackGrowsDown,
|
: TargetFrameLowering(StackGrowsDown,
|
||||||
/*StackAlignment=*/8,
|
/*StackAlignment=*/Align(8),
|
||||||
/*LocalAreaOffset=*/0),
|
/*LocalAreaOffset=*/0),
|
||||||
STI(Subtarget) {}
|
STI(Subtarget) {}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MSP430FrameLowering()
|
explicit MSP430FrameLowering()
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 2, -2, 2) {}
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(2), -2,
|
||||||
|
2) {}
|
||||||
|
|
||||||
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
|
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
|
||||||
/// the function.
|
/// the function.
|
||||||
|
|
|
@ -781,7 +781,7 @@ void MipsAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
||||||
StringRef CPU = MIPS_MC::selectMipsCPU(TT, TM.getTargetCPU());
|
StringRef CPU = MIPS_MC::selectMipsCPU(TT, TM.getTargetCPU());
|
||||||
StringRef FS = TM.getTargetFeatureString();
|
StringRef FS = TM.getTargetFeatureString();
|
||||||
const MipsTargetMachine &MTM = static_cast<const MipsTargetMachine &>(TM);
|
const MipsTargetMachine &MTM = static_cast<const MipsTargetMachine &>(TM);
|
||||||
const MipsSubtarget STI(TT, CPU, FS, MTM.isLittleEndian(), MTM, 0);
|
const MipsSubtarget STI(TT, CPU, FS, MTM.isLittleEndian(), MTM, None);
|
||||||
|
|
||||||
bool IsABICalls = STI.isABICalls();
|
bool IsABICalls = STI.isABICalls();
|
||||||
const MipsABIInfo &ABI = MTM.getABI();
|
const MipsABIInfo &ABI = MTM.getABI();
|
||||||
|
|
|
@ -24,8 +24,9 @@ protected:
|
||||||
const MipsSubtarget &STI;
|
const MipsSubtarget &STI;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MipsFrameLowering(const MipsSubtarget &sti, unsigned Alignment)
|
explicit MipsFrameLowering(const MipsSubtarget &sti, Align Alignment)
|
||||||
: TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {}
|
: TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment.value()),
|
||||||
|
STI(sti) {}
|
||||||
|
|
||||||
static const MipsFrameLowering *create(const MipsSubtarget &ST);
|
static const MipsFrameLowering *create(const MipsSubtarget &ST);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ void MipsSubtarget::anchor() {}
|
||||||
|
|
||||||
MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
bool little, const MipsTargetMachine &TM,
|
bool little, const MipsTargetMachine &TM,
|
||||||
unsigned StackAlignOverride)
|
MaybeAlign StackAlignOverride)
|
||||||
: MipsGenSubtargetInfo(TT, CPU, FS), MipsArchVersion(MipsDefault),
|
: MipsGenSubtargetInfo(TT, CPU, FS), MipsArchVersion(MipsDefault),
|
||||||
IsLittle(little), IsSoftFloat(false), IsSingleFloat(false), IsFPXX(false),
|
IsLittle(little), IsSoftFloat(false), IsSingleFloat(false), IsFPXX(false),
|
||||||
NoABICalls(false), Abs2008(false), IsFP64bit(false), UseOddSPReg(true),
|
NoABICalls(false), Abs2008(false), IsFP64bit(false), UseOddSPReg(true),
|
||||||
|
@ -81,10 +81,9 @@ MipsSubtarget::MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
Os16(Mips_Os16), HasMSA(false), UseTCCInDIV(false), HasSym32(false),
|
Os16(Mips_Os16), HasMSA(false), UseTCCInDIV(false), HasSym32(false),
|
||||||
HasEVA(false), DisableMadd4(false), HasMT(false), HasCRC(false),
|
HasEVA(false), DisableMadd4(false), HasMT(false), HasCRC(false),
|
||||||
HasVirt(false), HasGINV(false), UseIndirectJumpsHazard(false),
|
HasVirt(false), HasGINV(false), UseIndirectJumpsHazard(false),
|
||||||
StackAlignOverride(StackAlignOverride),
|
StackAlignOverride(StackAlignOverride), TM(TM), TargetTriple(TT),
|
||||||
TM(TM), TargetTriple(TT), TSInfo(),
|
TSInfo(), InstrInfo(MipsInstrInfo::create(
|
||||||
InstrInfo(
|
initializeSubtargetDependencies(CPU, FS, TM))),
|
||||||
MipsInstrInfo::create(initializeSubtargetDependencies(CPU, FS, TM))),
|
|
||||||
FrameLowering(MipsFrameLowering::create(*this)),
|
FrameLowering(MipsFrameLowering::create(*this)),
|
||||||
TLInfo(MipsTargetLowering::create(TM, *this)) {
|
TLInfo(MipsTargetLowering::create(TM, *this)) {
|
||||||
|
|
||||||
|
@ -248,12 +247,12 @@ MipsSubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS,
|
||||||
InMips16HardFloat = true;
|
InMips16HardFloat = true;
|
||||||
|
|
||||||
if (StackAlignOverride)
|
if (StackAlignOverride)
|
||||||
stackAlignment = StackAlignOverride;
|
stackAlignment = *StackAlignOverride;
|
||||||
else if (isABI_N32() || isABI_N64())
|
else if (isABI_N32() || isABI_N64())
|
||||||
stackAlignment = 16;
|
stackAlignment = Align(16);
|
||||||
else {
|
else {
|
||||||
assert(isABI_O32() && "Unknown ABI for stack alignment!");
|
assert(isABI_O32() && "Unknown ABI for stack alignment!");
|
||||||
stackAlignment = 8;
|
stackAlignment = Align(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
@ -194,10 +194,10 @@ class MipsSubtarget : public MipsGenSubtargetInfo {
|
||||||
|
|
||||||
/// The minimum alignment known to hold of the stack frame on
|
/// The minimum alignment known to hold of the stack frame on
|
||||||
/// entry to the function and which must be maintained by every function.
|
/// entry to the function and which must be maintained by every function.
|
||||||
unsigned stackAlignment;
|
Align stackAlignment;
|
||||||
|
|
||||||
/// The overridden stack alignment.
|
/// The overridden stack alignment.
|
||||||
unsigned StackAlignOverride;
|
MaybeAlign StackAlignOverride;
|
||||||
|
|
||||||
InstrItineraryData InstrItins;
|
InstrItineraryData InstrItins;
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ public:
|
||||||
/// This constructor initializes the data members to match that
|
/// This constructor initializes the data members to match that
|
||||||
/// of the specified triple.
|
/// of the specified triple.
|
||||||
MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, bool little,
|
MipsSubtarget(const Triple &TT, StringRef CPU, StringRef FS, bool little,
|
||||||
const MipsTargetMachine &TM, unsigned StackAlignOverride);
|
const MipsTargetMachine &TM, MaybeAlign StackAlignOverride);
|
||||||
|
|
||||||
/// ParseSubtargetFeatures - Parses features string setting specified
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
||||||
/// subtarget options. Definition of function is auto generated by tblgen.
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
||||||
|
@ -349,7 +349,7 @@ public:
|
||||||
// really use them if in addition we are in mips16 mode
|
// really use them if in addition we are in mips16 mode
|
||||||
static bool useConstantIslands();
|
static bool useConstantIslands();
|
||||||
|
|
||||||
unsigned getStackAlignment() const { return stackAlignment; }
|
Align getStackAlignment() const { return stackAlignment; }
|
||||||
|
|
||||||
// Grab relocation model
|
// Grab relocation model
|
||||||
Reloc::Model getRelocationModel() const;
|
Reloc::Model getRelocationModel() const;
|
||||||
|
|
|
@ -119,12 +119,15 @@ MipsTargetMachine::MipsTargetMachine(const Target &T, const Triple &TT,
|
||||||
getEffectiveCodeModel(CM, CodeModel::Small), OL),
|
getEffectiveCodeModel(CM, CodeModel::Small), OL),
|
||||||
isLittle(isLittle), TLOF(std::make_unique<MipsTargetObjectFile>()),
|
isLittle(isLittle), TLOF(std::make_unique<MipsTargetObjectFile>()),
|
||||||
ABI(MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions)),
|
ABI(MipsABIInfo::computeTargetABI(TT, CPU, Options.MCOptions)),
|
||||||
Subtarget(nullptr), DefaultSubtarget(TT, CPU, FS, isLittle, *this,
|
Subtarget(nullptr),
|
||||||
Options.StackAlignmentOverride),
|
DefaultSubtarget(TT, CPU, FS, isLittle, *this,
|
||||||
|
MaybeAlign(Options.StackAlignmentOverride)),
|
||||||
NoMips16Subtarget(TT, CPU, FS.empty() ? "-mips16" : FS.str() + ",-mips16",
|
NoMips16Subtarget(TT, CPU, FS.empty() ? "-mips16" : FS.str() + ",-mips16",
|
||||||
isLittle, *this, Options.StackAlignmentOverride),
|
isLittle, *this,
|
||||||
|
MaybeAlign(Options.StackAlignmentOverride)),
|
||||||
Mips16Subtarget(TT, CPU, FS.empty() ? "+mips16" : FS.str() + ",+mips16",
|
Mips16Subtarget(TT, CPU, FS.empty() ? "+mips16" : FS.str() + ",+mips16",
|
||||||
isLittle, *this, Options.StackAlignmentOverride) {
|
isLittle, *this,
|
||||||
|
MaybeAlign(Options.StackAlignmentOverride)) {
|
||||||
Subtarget = &DefaultSubtarget;
|
Subtarget = &DefaultSubtarget;
|
||||||
initAsmInfo();
|
initAsmInfo();
|
||||||
}
|
}
|
||||||
|
@ -196,8 +199,9 @@ MipsTargetMachine::getSubtargetImpl(const Function &F) const {
|
||||||
// creation will depend on the TM and the code generation flags on the
|
// creation will depend on the TM and the code generation flags on the
|
||||||
// function that reside in TargetOptions.
|
// function that reside in TargetOptions.
|
||||||
resetTargetOptions(F);
|
resetTargetOptions(F);
|
||||||
I = std::make_unique<MipsSubtarget>(TargetTriple, CPU, FS, isLittle, *this,
|
I = std::make_unique<MipsSubtarget>(
|
||||||
Options.StackAlignmentOverride);
|
TargetTriple, CPU, FS, isLittle, *this,
|
||||||
|
MaybeAlign(Options.StackAlignmentOverride));
|
||||||
}
|
}
|
||||||
return I.get();
|
return I.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
NVPTXFrameLowering::NVPTXFrameLowering()
|
NVPTXFrameLowering::NVPTXFrameLowering()
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsUp, 8, 0) {}
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsUp, Align(8), 0) {}
|
||||||
|
|
||||||
bool NVPTXFrameLowering::hasFP(const MachineFunction &MF) const { return true; }
|
bool NVPTXFrameLowering::hasFP(const MachineFunction &MF) const { return true; }
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ PPCSubtarget::PPCSubtarget(const Triple &TT, const std::string &CPU,
|
||||||
InstrInfo(*this), TLInfo(TM, *this) {}
|
InstrInfo(*this), TLInfo(TM, *this) {}
|
||||||
|
|
||||||
void PPCSubtarget::initializeEnvironment() {
|
void PPCSubtarget::initializeEnvironment() {
|
||||||
StackAlignment = 16;
|
StackAlignment = Align(16);
|
||||||
DarwinDirective = PPC::DIR_NONE;
|
DarwinDirective = PPC::DIR_NONE;
|
||||||
HasMFOCRF = false;
|
HasMFOCRF = false;
|
||||||
Has64BitSupport = false;
|
Has64BitSupport = false;
|
||||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
||||||
|
|
||||||
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
||||||
/// entry to the function and which must be maintained by every function.
|
/// entry to the function and which must be maintained by every function.
|
||||||
unsigned StackAlignment;
|
Align StackAlignment;
|
||||||
|
|
||||||
/// Selected instruction itineraries (one entry per itinerary class.)
|
/// Selected instruction itineraries (one entry per itinerary class.)
|
||||||
InstrItineraryData InstrItins;
|
InstrItineraryData InstrItins;
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
||||||
/// stack frame on entry to the function and which must be maintained by every
|
/// stack frame on entry to the function and which must be maintained by every
|
||||||
/// function for this subtarget.
|
/// function for this subtarget.
|
||||||
unsigned getStackAlignment() const { return StackAlignment; }
|
Align getStackAlignment() const { return StackAlignment; }
|
||||||
|
|
||||||
/// getDarwinDirective - Returns the -m directive specified for the cpu.
|
/// getDarwinDirective - Returns the -m directive specified for the cpu.
|
||||||
///
|
///
|
||||||
|
@ -281,11 +281,11 @@ public:
|
||||||
bool hasDirectMove() const { return HasDirectMove; }
|
bool hasDirectMove() const { return HasDirectMove; }
|
||||||
|
|
||||||
bool isQPXStackUnaligned() const { return IsQPXStackUnaligned; }
|
bool isQPXStackUnaligned() const { return IsQPXStackUnaligned; }
|
||||||
unsigned getPlatformStackAlignment() const {
|
Align getPlatformStackAlignment() const {
|
||||||
if ((hasQPX() || isBGQ()) && !isQPXStackUnaligned())
|
if ((hasQPX() || isBGQ()) && !isQPXStackUnaligned())
|
||||||
return 32;
|
return Align(32);
|
||||||
|
|
||||||
return 16;
|
return Align(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DarwinABI has a 224-byte red zone. PPC32 SVR4ABI(Non-DarwinABI) has no
|
// DarwinABI has a 224-byte red zone. PPC32 SVR4ABI(Non-DarwinABI) has no
|
||||||
|
|
|
@ -22,7 +22,7 @@ class RISCVFrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
explicit RISCVFrameLowering(const RISCVSubtarget &STI)
|
explicit RISCVFrameLowering(const RISCVSubtarget &STI)
|
||||||
: TargetFrameLowering(StackGrowsDown,
|
: TargetFrameLowering(StackGrowsDown,
|
||||||
/*StackAlignment=*/16,
|
/*StackAlignment=*/Align(16),
|
||||||
/*LocalAreaOffset=*/0),
|
/*LocalAreaOffset=*/0),
|
||||||
STI(STI) {}
|
STI(STI) {}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ DisableLeafProc("disable-sparc-leaf-proc",
|
||||||
|
|
||||||
SparcFrameLowering::SparcFrameLowering(const SparcSubtarget &ST)
|
SparcFrameLowering::SparcFrameLowering(const SparcSubtarget &ST)
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown,
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown,
|
||||||
ST.is64Bit() ? 16 : 8, 0, ST.is64Bit() ? 16 : 8) {}
|
ST.is64Bit() ? Align(16) : Align(8), 0,
|
||||||
|
ST.is64Bit() ? 16 : 8) {}
|
||||||
|
|
||||||
void SparcFrameLowering::emitSPAdjustment(MachineFunction &MF,
|
void SparcFrameLowering::emitSPAdjustment(MachineFunction &MF,
|
||||||
MachineBasicBlock &MBB,
|
MachineBasicBlock &MBB,
|
||||||
|
|
|
@ -46,7 +46,7 @@ static const TargetFrameLowering::SpillSlot SpillOffsetTable[] = {
|
||||||
} // end anonymous namespace
|
} // end anonymous namespace
|
||||||
|
|
||||||
SystemZFrameLowering::SystemZFrameLowering()
|
SystemZFrameLowering::SystemZFrameLowering()
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8,
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(8),
|
||||||
-SystemZMC::CallFrameSize, 8,
|
-SystemZMC::CallFrameSize, 8,
|
||||||
false /* StackRealignable */) {
|
false /* StackRealignable */) {
|
||||||
// Create a mapping from register number to save slot offset.
|
// Create a mapping from register number to save slot offset.
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
static const size_t RedZoneSize = 128;
|
static const size_t RedZoneSize = 128;
|
||||||
|
|
||||||
WebAssemblyFrameLowering()
|
WebAssemblyFrameLowering()
|
||||||
: TargetFrameLowering(StackGrowsDown, /*StackAlignment=*/16,
|
: TargetFrameLowering(StackGrowsDown, /*StackAlignment=*/Align(16),
|
||||||
/*LocalAreaOffset=*/0,
|
/*LocalAreaOffset=*/0,
|
||||||
/*TransientStackAlignment=*/16,
|
/*TransientStackAlignment=*/16,
|
||||||
/*StackRealignable=*/true) {}
|
/*StackRealignable=*/true) {}
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
X86FrameLowering::X86FrameLowering(const X86Subtarget &STI,
|
X86FrameLowering::X86FrameLowering(const X86Subtarget &STI,
|
||||||
unsigned StackAlignOverride)
|
MaybeAlign StackAlignOverride)
|
||||||
: TargetFrameLowering(StackGrowsDown, StackAlignOverride,
|
: TargetFrameLowering(StackGrowsDown, StackAlignOverride.valueOrOne(),
|
||||||
STI.is64Bit() ? -8 : -4),
|
STI.is64Bit() ? -8 : -4),
|
||||||
STI(STI), TII(*STI.getInstrInfo()), TRI(STI.getRegisterInfo()) {
|
STI(STI), TII(*STI.getInstrInfo()), TRI(STI.getRegisterInfo()) {
|
||||||
// Cache a bunch of frame-related predicates for this subtarget.
|
// Cache a bunch of frame-related predicates for this subtarget.
|
||||||
|
|
|
@ -25,7 +25,7 @@ class X86RegisterInfo;
|
||||||
|
|
||||||
class X86FrameLowering : public TargetFrameLowering {
|
class X86FrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
X86FrameLowering(const X86Subtarget &STI, unsigned StackAlignOverride);
|
X86FrameLowering(const X86Subtarget &STI, MaybeAlign StackAlignOverride);
|
||||||
|
|
||||||
// Cached subtarget predicates.
|
// Cached subtarget predicates.
|
||||||
|
|
||||||
|
|
|
@ -288,10 +288,10 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
|
||||||
// Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD and Solaris (both
|
// Stack alignment is 16 bytes on Darwin, Linux, kFreeBSD and Solaris (both
|
||||||
// 32 and 64 bit) and for all 64-bit targets.
|
// 32 and 64 bit) and for all 64-bit targets.
|
||||||
if (StackAlignOverride)
|
if (StackAlignOverride)
|
||||||
stackAlignment = StackAlignOverride;
|
stackAlignment = *StackAlignOverride;
|
||||||
else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() ||
|
else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() ||
|
||||||
isTargetKFreeBSD() || In64BitMode)
|
isTargetKFreeBSD() || In64BitMode)
|
||||||
stackAlignment = 16;
|
stackAlignment = Align(16);
|
||||||
|
|
||||||
// Some CPUs have more overhead for gather. The specified overhead is relative
|
// Some CPUs have more overhead for gather. The specified overhead is relative
|
||||||
// to the Load operation. "2" is the number provided by Intel architects. This
|
// to the Load operation. "2" is the number provided by Intel architects. This
|
||||||
|
@ -321,12 +321,11 @@ X86Subtarget &X86Subtarget::initializeSubtargetDependencies(StringRef CPU,
|
||||||
|
|
||||||
X86Subtarget::X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
X86Subtarget::X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
const X86TargetMachine &TM,
|
const X86TargetMachine &TM,
|
||||||
unsigned StackAlignOverride,
|
MaybeAlign StackAlignOverride,
|
||||||
unsigned PreferVectorWidthOverride,
|
unsigned PreferVectorWidthOverride,
|
||||||
unsigned RequiredVectorWidth)
|
unsigned RequiredVectorWidth)
|
||||||
: X86GenSubtargetInfo(TT, CPU, FS),
|
: X86GenSubtargetInfo(TT, CPU, FS), PICStyle(PICStyles::None), TM(TM),
|
||||||
PICStyle(PICStyles::None), TM(TM), TargetTriple(TT),
|
TargetTriple(TT), StackAlignOverride(StackAlignOverride),
|
||||||
StackAlignOverride(StackAlignOverride),
|
|
||||||
PreferVectorWidthOverride(PreferVectorWidthOverride),
|
PreferVectorWidthOverride(PreferVectorWidthOverride),
|
||||||
RequiredVectorWidth(RequiredVectorWidth),
|
RequiredVectorWidth(RequiredVectorWidth),
|
||||||
In64BitMode(TargetTriple.getArch() == Triple::x86_64),
|
In64BitMode(TargetTriple.getArch() == Triple::x86_64),
|
||||||
|
|
|
@ -432,7 +432,7 @@ protected:
|
||||||
|
|
||||||
/// The minimum alignment known to hold of the stack frame on
|
/// The minimum alignment known to hold of the stack frame on
|
||||||
/// entry to the function and which must be maintained by every function.
|
/// entry to the function and which must be maintained by every function.
|
||||||
unsigned stackAlignment = 4;
|
Align stackAlignment = Align(4);
|
||||||
|
|
||||||
/// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
|
/// Max. memset / memcpy size that is turned into rep/movs, rep/stos ops.
|
||||||
///
|
///
|
||||||
|
@ -459,7 +459,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Override the stack alignment.
|
/// Override the stack alignment.
|
||||||
unsigned StackAlignOverride;
|
MaybeAlign StackAlignOverride;
|
||||||
|
|
||||||
/// Preferred vector width from function attribute.
|
/// Preferred vector width from function attribute.
|
||||||
unsigned PreferVectorWidthOverride;
|
unsigned PreferVectorWidthOverride;
|
||||||
|
@ -496,7 +496,7 @@ public:
|
||||||
/// of the specified triple.
|
/// of the specified triple.
|
||||||
///
|
///
|
||||||
X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
X86Subtarget(const Triple &TT, StringRef CPU, StringRef FS,
|
||||||
const X86TargetMachine &TM, unsigned StackAlignOverride,
|
const X86TargetMachine &TM, MaybeAlign StackAlignOverride,
|
||||||
unsigned PreferVectorWidthOverride,
|
unsigned PreferVectorWidthOverride,
|
||||||
unsigned RequiredVectorWidth);
|
unsigned RequiredVectorWidth);
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ public:
|
||||||
/// Returns the minimum alignment known to hold of the
|
/// Returns the minimum alignment known to hold of the
|
||||||
/// stack frame on entry to the function and which must be maintained by every
|
/// stack frame on entry to the function and which must be maintained by every
|
||||||
/// function for this subtarget.
|
/// function for this subtarget.
|
||||||
unsigned getStackAlignment() const { return stackAlignment; }
|
Align getStackAlignment() const { return stackAlignment; }
|
||||||
|
|
||||||
/// Returns the maximum memset / memcpy size
|
/// Returns the maximum memset / memcpy size
|
||||||
/// that still makes it profitable to inline the call.
|
/// that still makes it profitable to inline the call.
|
||||||
|
|
|
@ -307,10 +307,10 @@ X86TargetMachine::getSubtargetImpl(const Function &F) const {
|
||||||
// creation will depend on the TM and the code generation flags on the
|
// creation will depend on the TM and the code generation flags on the
|
||||||
// function that reside in TargetOptions.
|
// function that reside in TargetOptions.
|
||||||
resetTargetOptions(F);
|
resetTargetOptions(F);
|
||||||
I = std::make_unique<X86Subtarget>(TargetTriple, CPU, FS, *this,
|
I = std::make_unique<X86Subtarget>(
|
||||||
Options.StackAlignmentOverride,
|
TargetTriple, CPU, FS, *this,
|
||||||
PreferVectorWidthOverride,
|
MaybeAlign(Options.StackAlignmentOverride), PreferVectorWidthOverride,
|
||||||
RequiredVectorWidth);
|
RequiredVectorWidth);
|
||||||
}
|
}
|
||||||
return I.get();
|
return I.get();
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ static void RestoreSpillList(MachineBasicBlock &MBB,
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
XCoreFrameLowering::XCoreFrameLowering(const XCoreSubtarget &sti)
|
XCoreFrameLowering::XCoreFrameLowering(const XCoreSubtarget &sti)
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 4, 0) {
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(4), 0) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
class BogusFrameLowering : public TargetFrameLowering {
|
class BogusFrameLowering : public TargetFrameLowering {
|
||||||
public:
|
public:
|
||||||
BogusFrameLowering()
|
BogusFrameLowering()
|
||||||
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 4, 4) {}
|
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, Align(4), 4) {}
|
||||||
|
|
||||||
void emitPrologue(MachineFunction &MF,
|
void emitPrologue(MachineFunction &MF,
|
||||||
MachineBasicBlock &MBB) const override {}
|
MachineBasicBlock &MBB) const override {}
|
||||||
|
|
Loading…
Reference in New Issue