Skip to content
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

Add RISC-V Profiles format #36

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
37 changes: 37 additions & 0 deletions src/toolchain-conventions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,43 @@ As of November 2021 the additional tail-call entry points are only
implemented in compiler-rt, and calls will only be generated by LLVM
when the option `-mllvm -save-restore-tailcall` is specified.

== Profile-based format

Profiles names will be a valid list of released profiles, it should be recognized and used
in the `-march=` option. The benefit of using the `-march` option is easy for toolchain
parsing the profiles string and expanding it into normal extensions combinations.

Profiles format has the following BNF form `"-march="<profile-name>"_"[option-ext]*`.

`profile-family-name ::= "i" | "m" | "a" | "b"`

`profile-ratified-year-version ::= "20" | "22" | "23"`

`privilege-mode ::= "u" | "s" | "m"`

`isa-xlen ::= "64" | "32"`

`profile-name ::= "rv"<profile-family-name><profile-ratified-year-version><privilege-mode><isa-xlen>`

`option-ext ::= 'a legal RISC-V extension name'`

According to the specification, profiles must adhere to the defined naming format
for proper usage.(See [3.4 form spec doc](https://github.com/riscv/riscv-profiles)).
The toolchain will check whether an input profile name is correct at first, then
do the parse work.

To distinguish between ordinary extension input and input with profiles,
profiles are assumed to be entered *at the beginning of the -march option*, and
then input other extensions.

Examples:

`-march=rvi20u64 -mabi=lp64` equals `-march=rv64i -mabi=lp64`

`-march=rvi20u64_zbkb_zkne -mabi=lp64` equals `-march=rv64i_zbkb_zkne -mabi=lp64`

`-march=rva22u64` equals `-march=rv64gcb_zic64b_zicbom_zicbop_zicboz_ziccamoa_ziccif_zicclsm_ziccrse_zicntr_zihpm_za64rs_zfhmin_zkt`

== Conventions for vendor extensions

Support for custom instruction set extensions are an important part of RISC-V,
Expand Down