This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][MC] Add minimal support for Ztso extension
ClosedPublic

Authored by reames on Sep 2 2022, 3:29 PM.

Details

Summary

This is a minimalist implementation which simply adds the extension (in the experimental namespace since its not ratified), and wires up the setting of the required ELF header flag. Future changes will include codegen changes to exploit the stronger memory model.

This is intended to implement v0.1 of the proposed specification which can be found in Chapter 25 of https://github.com/riscv/riscv-isa-manual/releases/download/draft-20220723-10eea63/riscv-spec.pdf.

Diff Detail

Event Timeline

reames created this revision.Sep 2 2022, 3:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2022, 3:29 PM
reames requested review of this revision.Sep 2 2022, 3:29 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2022, 3:29 PM
reames planned changes to this revision.Sep 2 2022, 3:35 PM

I screwed up the patch somehow, fixing...

reames updated this revision to Diff 457724.Sep 2 2022, 3:43 PM

Corrected diff

asb added a comment.Sep 5 2022, 3:14 AM

There are a few other places we typically add some test coverage for a new extension (which might be overkill - something to reconsider in the future perhaps)

  • clang/test/Preprocessor/riscv-target-features.c
  • llvm/test/CodeGen/RISCV/attributes.ll
  • llvm/test/MC/attribute-arch.s

Otherwise, changes look good to me.

kito-cheng added inline comments.Sep 5 2022, 3:19 AM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
182

Extra blank line here

llvm/lib/Target/RISCV/RISCV.td
464

nit: maybe just one blank line is enough?

reames updated this revision to Diff 458190.Sep 6 2022, 9:27 AM

Address review comments

reames added a comment.Sep 6 2022, 9:28 AM

There are a few other places we typically add some test coverage for a new extension (which might be overkill - something to reconsider in the future perhaps)

  • clang/test/Preprocessor/riscv-target-features.c
  • llvm/test/CodeGen/RISCV/attributes.ll
  • llvm/test/MC/attribute-arch.s

Otherwise, changes look good to me.

I could not find llvm/test/MC/attribute-arch.s. Did you have a different file in mind? Added the other ones you mentioned.

There are a few other places we typically add some test coverage for a new extension (which might be overkill - something to reconsider in the future perhaps)

  • clang/test/Preprocessor/riscv-target-features.c
  • llvm/test/CodeGen/RISCV/attributes.ll
  • llvm/test/MC/attribute-arch.s

Otherwise, changes look good to me.

I could not find llvm/test/MC/attribute-arch.s. Did you have a different file in mind? Added the other ones you mentioned.

llvm/test/MC/RISCV/attribute-arch.s

reames updated this revision to Diff 458194.Sep 6 2022, 9:37 AM

Add last requested test coverage

asb accepted this revision.Sep 7 2022, 8:40 AM

LGTM.

This revision is now accepted and ready to land.Sep 7 2022, 8:40 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 7 2022, 9:32 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript