This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Only emit .option when extension is supported
ClosedPublic

Authored by BeMg on Sep 2 2023, 4:00 AM.

Details

Summary

It maybe emit the .option directive without any follow up. Only emit the .option push/pop when there are supported extension difference between function and module.

Diff Detail

Event Timeline

BeMg created this revision.Sep 2 2023, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2023, 4:00 AM
BeMg requested review of this revision.Sep 2 2023, 4:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2023, 4:00 AM
BeMg updated this revision to Diff 555581.Sep 2 2023, 4:06 AM

Update

BeMg edited the summary of this revision. (Show Details)Sep 2 2023, 4:11 AM
craig.topper added inline comments.Sep 2 2023, 9:02 PM
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
282–283

Can we call RTS.emitDirectiveOptionPush(); from emitDirectiveOptionArch() and have it return a bool to indicate that RTS.emitDirectiveOptionPop() needs to be called at the end of the function?

BeMg updated this revision to Diff 555653.Sep 3 2023, 10:32 PM

Refactor the emitDirectiveOptionPush, emitDirectiveOptionArch and emitDirectiveOptionPop in RISCVAsmPrinter::runOnMachineFunction

craig.topper added inline comments.Sep 3 2023, 10:44 PM
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
257

Don't we only need this when we call emitDirectiveOptionArch later? Can we use the same if?

BeMg updated this revision to Diff 555658.Sep 3 2023, 11:44 PM

Merge isSameSupportedAttribute into emitDirectiveOptionArch

craig.topper added inline comments.Sep 3 2023, 11:49 PM
llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
284

NeedEmitOptionArch -> EmittedOptionArch

since we already emitted it in the function.

BeMg updated this revision to Diff 555668.Sep 4 2023, 12:45 AM

Rename NeedEmitOptionArch with EmittedOptionArch

This revision is now accepted and ready to land.Sep 17 2023, 7:59 PM
This revision was automatically updated to reflect the committed changes.