This is an archive of the discontinued LLVM Phabricator instance.

[RISC-V] Add -msave-restore and -mno-save-restore to clang driver
ClosedPublic

Authored by lenary on Jun 18 2019, 9:44 AM.

Details

Summary

The GCC RISC-V toolchain accepts -msave-restore and -mno-save-restore
to control whether libcalls are used for saving and restoring the stack within
prologues and epilogues.

Clang currently errors if someone passes -msave-restore or -mno-save-restore.
This means that people need to change build configurations to use clang. This
patch adds these flags, so that clang invocations can now match gcc.

As the RISC-V backend does not currently have a save-restore target feature,
we emit a warning if someone requests -msave-restore. LLVM does not error if
we pass the (unimplemented) target features +save-restore or -save-restore.

Diff Detail

Repository
rL LLVM

Event Timeline

lenary created this revision.Jun 18 2019, 9:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2019, 9:44 AM
asb added a comment.Jun 18 2019, 8:50 PM

Can you add a CHECK line that shows the expected warning is emitted?

lenary updated this revision to Diff 205846.Jun 20 2019, 9:48 AM
  • Add CHECK lines for warnings Hopefully these will work regardless of race conditions in the merging of stdout and stderr.
asb accepted this revision.Jun 20 2019, 9:47 PM

LGTM, thanks! There was some discussion about the potential stdout+stderr merging issues http://lists.llvm.org/pipermail/llvm-dev/2017-February/110469.html but I don't think it resulted in any new recommended best practice.

This revision is now accepted and ready to land.Jun 20 2019, 9:47 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2019, 3:00 AM