This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add instruction definition for dret
ClosedPublic

Authored by pzheng on Apr 21 2020, 1:12 PM.

Details

Summary

The instruction dret is used to return from debug mode and is defined in the
RISC-V debug mode spec.

https://github.com/riscv/riscv-opcodes/blob/master/opcodes-system

Diff Detail

Event Timeline

pzheng created this revision.Apr 21 2020, 1:12 PM
asb added a comment.Apr 23 2020, 7:35 AM

Thanks for the patch, as we discussed last week I think supporting dret with the same ease as the privileged instructions is the right path. Given dret is defined in the debug spec rather than the privileged spec, could you please:

  • Move the test to a new test file debug-valid.s
  • Move the DRET instruction definition to a new section of RISCVInstrInfo.td with an internal header like
//===----------------------------------------------------------------------===//
// Debug instructions
//===----------------------------------------------------------------------===//
pzheng updated this revision to Diff 259641.Apr 23 2020, 11:23 AM

Addressing comments

pzheng updated this revision to Diff 259645.Apr 23 2020, 11:26 AM

Reverted changes in priv-valid.s

LGTM thanks for addressing Alex's comments.

apazos accepted this revision.Apr 24 2020, 12:38 PM
This revision is now accepted and ready to land.Apr 24 2020, 12:38 PM
This revision was automatically updated to reflect the committed changes.