Skip to content

[RISCV] Remove StackAlign attribute enum. NFC #79946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions llvm/include/llvm/Support/RISCVAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ enum AttrType : unsigned {
PRIV_SPEC_REVISION = 12,
};

enum StackAlign { ALIGN_4 = 4, ALIGN_8 = 8, ALIGN_16 = 16 };

enum { NOT_ALLOWED = 0, ALLOWED = 1 };

} // namespace RISCVAttrs
Expand Down
8 changes: 5 additions & 3 deletions llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ void RISCVTargetStreamer::setTargetABI(RISCVABI::ABI ABI) {
void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI,
bool EmitStackAlign) {
if (EmitStackAlign) {
unsigned StackAlign;
if (TargetABI == RISCVABI::ABI_ILP32E)
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_4);
StackAlign = 4;
else if (TargetABI == RISCVABI::ABI_LP64E)
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_8);
StackAlign = 8;
else
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_16);
StackAlign = 16;
emitAttribute(RISCVAttrs::STACK_ALIGN, StackAlign);
}

auto ParseResult = RISCVFeatures::parseFeatureBits(
Expand Down
6 changes: 2 additions & 4 deletions llvm/unittests/Support/RISCVAttributeParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ static bool testTagString(unsigned Tag, const char *name) {

TEST(StackAlign, testAttribute) {
EXPECT_TRUE(testTagString(4, "Tag_stack_align"));
EXPECT_TRUE(
testAttribute(4, 4, RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_4));
EXPECT_TRUE(
testAttribute(4, 16, RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_16));
EXPECT_TRUE(testAttribute(4, 4, RISCVAttrs::STACK_ALIGN, 4));
EXPECT_TRUE(testAttribute(4, 16, RISCVAttrs::STACK_ALIGN, 16));
}

TEST(UnalignedAccess, testAttribute) {
Expand Down