mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 06:10:48 +00:00
[Alignment][NFC] Use Align for TargetCallingConv::OrigAlign
This patch replaces D69249. 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 Differential Revision: https://reviews.llvm.org/D82307
This commit is contained in:
parent
d5068f51ec
commit
71e4df2c3b
@ -144,13 +144,17 @@ namespace ISD {
|
||||
assert(getNonZeroByValAlign() == A && "bitfield overflow");
|
||||
}
|
||||
|
||||
unsigned getOrigAlign() const {
|
||||
LLVM_ATTRIBUTE_DEPRECATED(unsigned getOrigAlign() const,
|
||||
"Use getNonZeroOrigAlign() instead") {
|
||||
MaybeAlign A = decodeMaybeAlign(OrigAlign);
|
||||
return A ? A->value() : 0;
|
||||
}
|
||||
Align getNonZeroOrigAlign() const {
|
||||
return decodeMaybeAlign(OrigAlign).valueOrOne();
|
||||
}
|
||||
void setOrigAlign(Align A) {
|
||||
OrigAlign = encode(A);
|
||||
assert(getOrigAlign() == A.value() && "bitfield overflow");
|
||||
assert(getNonZeroOrigAlign() == A && "bitfield overflow");
|
||||
}
|
||||
|
||||
unsigned getByValSize() const { return ByValSize; }
|
||||
|
@ -42,7 +42,7 @@ static bool finishStackBlock(SmallVectorImpl<CCValAssign> &PendingMembers,
|
||||
unsigned Size = LocVT.getSizeInBits() / 8;
|
||||
const Align StackAlign =
|
||||
State.getMachineFunction().getDataLayout().getStackAlignment();
|
||||
const Align OrigAlign(ArgFlags.getOrigAlign());
|
||||
const Align OrigAlign = ArgFlags.getNonZeroOrigAlign();
|
||||
const Align Alignment = std::min(OrigAlign, StackAlign);
|
||||
|
||||
for (auto &It : PendingMembers) {
|
||||
|
@ -10,9 +10,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// CCIfAlign - Match of the original alignment of the arg
|
||||
class CCIfAlign<string Align, CCAction A> :
|
||||
CCIf<!strconcat("ArgFlags.getOrigAlign() == ", Align), A>;
|
||||
/// CCIfBigEndian - Match only if we're in big endian mode.
|
||||
class CCIfBigEndian<CCAction A> :
|
||||
CCIf<"State.getMachineFunction().getDataLayout().isBigEndian()", A>;
|
||||
|
@ -181,8 +181,8 @@ static bool CC_ARM_AAPCS_Custom_Aggregate(unsigned ValNo, MVT ValVT,
|
||||
// aggregate. Store the type's required alignment as extra info for later: in
|
||||
// the [N x i64] case all trace has been removed by the time we actually get
|
||||
// to do allocation.
|
||||
PendingMembers.push_back(CCValAssign::getPending(ValNo, ValVT, LocVT, LocInfo,
|
||||
ArgFlags.getOrigAlign()));
|
||||
PendingMembers.push_back(CCValAssign::getPending(
|
||||
ValNo, ValVT, LocVT, LocInfo, ArgFlags.getNonZeroOrigAlign().value()));
|
||||
|
||||
if (!ArgFlags.isInConsecutiveRegsLast())
|
||||
return true;
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
/// CCIfAlign - Match of the original alignment of the arg
|
||||
class CCIfAlign<string Align, CCAction A>:
|
||||
CCIf<!strconcat("ArgFlags.getOrigAlign() == ", Align), A>;
|
||||
CCIf<!strconcat("ArgFlags.getNonZeroOrigAlign() == ", Align), A>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ARM APCS Calling Convention
|
||||
@ -134,7 +134,7 @@ def CC_ARM_AAPCS_Common : CallingConv<[
|
||||
// i64 is 8-aligned i32 here, so we may need to eat R1 as a pad register
|
||||
// (and the same is true for f64 if VFP is not enabled)
|
||||
CCIfType<[i32], CCIfAlign<"8", CCAssignToRegWithShadow<[R0, R2], [R0, R1]>>>,
|
||||
CCIfType<[i32], CCIf<"ArgFlags.getOrigAlign() != 8",
|
||||
CCIfType<[i32], CCIf<"ArgFlags.getNonZeroOrigAlign() != Align(8)",
|
||||
CCAssignToReg<[R0, R1, R2, R3]>>>,
|
||||
|
||||
CCIfType<[i32], CCIfAlign<"8", CCAssignToStackWithShadow<4, 8, [R0, R1, R2, R3]>>>,
|
||||
|
@ -2908,8 +2908,8 @@ static bool CC_MipsO32(unsigned ValNo, MVT ValVT, MVT LocVT,
|
||||
// argument which is not f32 or f64.
|
||||
bool AllocateFloatsInIntReg = State.isVarArg() || ValNo > 1 ||
|
||||
State.getFirstUnallocated(F32Regs) != ValNo;
|
||||
unsigned OrigAlign = ArgFlags.getOrigAlign();
|
||||
bool isI64 = (ValVT == MVT::i32 && OrigAlign == 8);
|
||||
Align OrigAlign = ArgFlags.getNonZeroOrigAlign();
|
||||
bool isI64 = (ValVT == MVT::i32 && OrigAlign == Align(8));
|
||||
bool isVectorFloat = MipsState->WasOriginalArgVectorFloat(ValNo);
|
||||
|
||||
// The MIPS vector ABI for floats passes them in a pair of registers
|
||||
@ -2963,8 +2963,7 @@ static bool CC_MipsO32(unsigned ValNo, MVT ValVT, MVT LocVT,
|
||||
llvm_unreachable("Cannot handle this ValVT.");
|
||||
|
||||
if (!Reg) {
|
||||
unsigned Offset =
|
||||
State.AllocateStack(ValVT.getStoreSize(), Align(OrigAlign));
|
||||
unsigned Offset = State.AllocateStack(ValVT.getStoreSize(), OrigAlign);
|
||||
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset, LocVT, LocInfo));
|
||||
} else
|
||||
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
|
||||
|
@ -1492,10 +1492,11 @@ static bool CC_RISCVAssign2XLen(unsigned XLen, CCState &State, CCValAssign VA1,
|
||||
VA1.getLocVT(), CCValAssign::Full));
|
||||
} else {
|
||||
// Both halves must be passed on the stack, with proper alignment.
|
||||
unsigned StackAlign = std::max(XLenInBytes, ArgFlags1.getOrigAlign());
|
||||
Align StackAlign =
|
||||
std::max(Align(XLenInBytes), ArgFlags1.getNonZeroOrigAlign());
|
||||
State.addLoc(
|
||||
CCValAssign::getMem(VA1.getValNo(), VA1.getValVT(),
|
||||
State.AllocateStack(XLenInBytes, Align(StackAlign)),
|
||||
State.AllocateStack(XLenInBytes, StackAlign),
|
||||
VA1.getLocVT(), CCValAssign::Full));
|
||||
State.addLoc(CCValAssign::getMem(
|
||||
ValNo2, ValVT2, State.AllocateStack(XLenInBytes, Align(XLenInBytes)),
|
||||
@ -1579,7 +1580,7 @@ static bool CC_RISCV(const DataLayout &DL, RISCVABI::ABI ABI, unsigned ValNo,
|
||||
// original type is larger than 2*XLEN, so the register alignment rule does
|
||||
// not apply.
|
||||
unsigned TwoXLenInBytes = (2 * XLen) / 8;
|
||||
if (!IsFixed && ArgFlags.getOrigAlign() == TwoXLenInBytes &&
|
||||
if (!IsFixed && ArgFlags.getNonZeroOrigAlign() == TwoXLenInBytes &&
|
||||
DL.getTypeAllocSize(OrigTy) == TwoXLenInBytes) {
|
||||
unsigned RegIdx = State.getFirstUnallocated(ArgGPRs);
|
||||
// Skip 'odd' register if necessary.
|
||||
|
@ -841,7 +841,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||
assert(VT != MVT::iPTR && "Legalized args should be concrete");
|
||||
Type *Ty = VT.getTypeForEVT(*DAG.getContext());
|
||||
Align Alignment =
|
||||
std::max(Align(Out.Flags.getOrigAlign()), Layout.getABITypeAlign(Ty));
|
||||
std::max(Out.Flags.getNonZeroOrigAlign(), Layout.getABITypeAlign(Ty));
|
||||
unsigned Offset =
|
||||
CCInfo.AllocateStack(Layout.getTypeAllocSize(Ty), Alignment);
|
||||
CCInfo.addLoc(CCValAssign::getMem(ArgLocs.size(), VT.getSimpleVT(),
|
||||
@ -915,7 +915,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI,
|
||||
if (In.Flags.isInConsecutiveRegsLast())
|
||||
fail(DL, DAG,
|
||||
"WebAssembly hasn't implemented cons regs last return values");
|
||||
// Ignore In.getOrigAlign() because all our arguments are passed in
|
||||
// Ignore In.getNonZeroOrigAlign() because all our arguments are passed in
|
||||
// registers.
|
||||
InTys.push_back(In.VT);
|
||||
}
|
||||
@ -1002,7 +1002,7 @@ SDValue WebAssemblyTargetLowering::LowerFormalArguments(
|
||||
fail(DL, DAG, "WebAssembly hasn't implemented cons regs arguments");
|
||||
if (In.Flags.isInConsecutiveRegsLast())
|
||||
fail(DL, DAG, "WebAssembly hasn't implemented cons regs last arguments");
|
||||
// Ignore In.getOrigAlign() because all our arguments are passed in
|
||||
// Ignore In.getNonZeroOrigAlign() because all our arguments are passed in
|
||||
// registers.
|
||||
InVals.push_back(In.Used ? DAG.getNode(WebAssemblyISD::ARGUMENT, DL, In.VT,
|
||||
DAG.getTargetConstant(InVals.size(),
|
||||
|
Loading…
Reference in New Issue
Block a user