Skip to content

Commit 59ff1d1

Browse files
author
git apple-llvm automerger
committed
Merge commit '80ee6083ae93' from llvm.org/main into next
2 parents 21aed4e + 80ee608 commit 59ff1d1

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

llvm/include/llvm/Support/RISCVAttributes.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ enum AttrType : unsigned {
3434
PRIV_SPEC_REVISION = 12,
3535
};
3636

37-
enum StackAlign { ALIGN_4 = 4, ALIGN_8 = 8, ALIGN_16 = 16 };
38-
3937
enum { NOT_ALLOWED = 0, ALLOWED = 1 };
4038

4139
} // namespace RISCVAttrs

llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ void RISCVTargetStreamer::setTargetABI(RISCVABI::ABI ABI) {
5151
void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI,
5252
bool EmitStackAlign) {
5353
if (EmitStackAlign) {
54+
unsigned StackAlign;
5455
if (TargetABI == RISCVABI::ABI_ILP32E)
55-
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_4);
56+
StackAlign = 4;
5657
else if (TargetABI == RISCVABI::ABI_LP64E)
57-
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_8);
58+
StackAlign = 8;
5859
else
59-
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_16);
60+
StackAlign = 16;
61+
emitAttribute(RISCVAttrs::STACK_ALIGN, StackAlign);
6062
}
6163

6264
auto ParseResult = RISCVFeatures::parseFeatureBits(

llvm/unittests/Support/RISCVAttributeParserTest.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ static bool testTagString(unsigned Tag, const char *name) {
5555

5656
TEST(StackAlign, testAttribute) {
5757
EXPECT_TRUE(testTagString(4, "Tag_stack_align"));
58-
EXPECT_TRUE(
59-
testAttribute(4, 4, RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_4));
60-
EXPECT_TRUE(
61-
testAttribute(4, 16, RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_16));
58+
EXPECT_TRUE(testAttribute(4, 4, RISCVAttrs::STACK_ALIGN, 4));
59+
EXPECT_TRUE(testAttribute(4, 16, RISCVAttrs::STACK_ALIGN, 16));
6260
}
6361

6462
TEST(UnalignedAccess, testAttribute) {

0 commit comments

Comments
 (0)