Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Add -mabi=ilp32e
Browse files Browse the repository at this point in the history
  • Loading branch information
kito-cheng committed Nov 19, 2017
1 parent d2cc398 commit a45f189
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
6 changes: 4 additions & 2 deletions gcc/config.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -4041,6 +4041,7 @@ case "${target}" in
"")
# Infer XLEN, but otherwise assume GC.
case "${with_abi}" in
ilp32e) with_arch="rv32e" ;;
ilp32 | ilp32f | ilp32d) with_arch="rv32gc" ;;
lp64 | lp64f | lp64d) with_arch="rv64gc" ;;
*) with_arch="rv${xlen}gc" ;;
Expand All @@ -4056,11 +4057,12 @@ case "${target}" in
# pick a default based on the ISA, preferring soft-float
# unless the D extension is present.
case "${with_abi}" in
ilp32 | ilp32f | ilp32d | lp64 | lp64f | lp64d)
ilp32 | ilp32f | ilp32d | lp64 | lp64f | lp64d | lp64q)
;;
"")
case "${with_arch}" in
rv32*d* | rv32g*) with_abi=ilp32d ;;
rv32e*) with_abi=ilp32e ;;
rv32*) with_abi=ilp32 ;;
rv64*d* | rv64g*) with_abi=lp64d ;;
rv64*) with_abi=lp64 ;;
Expand All @@ -4074,7 +4076,7 @@ case "${target}" in

# Make sure ABI and ISA are compatible.
case "${with_abi},${with_arch}" in
ilp32,rv32* \
ilp32,rv32* | ilp32e,rv32e* \
| ilp32f,rv32*f* | ilp32f,rv32g* \
| ilp32d,rv32*d* | ilp32d,rv32g* \
| lp64,rv64* \
Expand Down
1 change: 1 addition & 0 deletions gcc/config/riscv/riscv-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ riscv_cpu_cpp_builtins (cpp_reader *pfile)
switch (riscv_abi)
{
case ABI_ILP32:
case ABI_ILP32E:
case ABI_LP64:
builtin_define ("__riscv_float_abi_soft");
break;
Expand Down
1 change: 1 addition & 0 deletions gcc/config/riscv/riscv-opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see

enum riscv_abi_type {
ABI_ILP32,
ABI_ILP32E,
ABI_ILP32F,
ABI_ILP32D,
ABI_LP64,
Expand Down
17 changes: 11 additions & 6 deletions gcc/config/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -3998,6 +3998,9 @@ riscv_option_override (void)
error ("requested ABI requires -march to subsume the %qc extension",
UNITS_PER_FP_ARG > 8 ? 'Q' : (UNITS_PER_FP_ARG > 4 ? 'D' : 'F'));

if (TARGET_RVE && riscv_abi != ABI_ILP32E)
error ("rv32e requires ilp32e ABI");

/* We do not yet support ILP32 on RV64. */
if (BITS_PER_WORD != POINTER_SIZE)
error ("ABI requires -march=rv%d", POINTER_SIZE);
Expand Down Expand Up @@ -4025,12 +4028,14 @@ riscv_conditional_register_usage (void)
/* We have only x0~x15 on RV32E. */
if (TARGET_RVE)
{
int r;
for (r = 16; r <= 31; r++)
{
fixed_regs[r] = 1;
call_used_regs[r] = call_really_used_regs[r] = 1;
}
for (int r = 16; r <= 31; r++)
fixed_regs[r] = 1;
}

if (riscv_abi == ABI_ILP32E)
{
for (int r = 16; r <= 31; r++)
call_used_regs[r] = 1;
}

if (!TARGET_HARD_FLOAT)
Expand Down
8 changes: 5 additions & 3 deletions gcc/config/riscv/riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ along with GCC; see the file COPYING3. If not see
#define UNITS_PER_FP_REG (TARGET_DOUBLE_FLOAT ? 8 : 4)

/* The largest type that can be passed in floating-point registers. */
#define UNITS_PER_FP_ARG \
(riscv_abi == ABI_ILP32 || riscv_abi == ABI_LP64 ? 0 : \
riscv_abi == ABI_ILP32F || riscv_abi == ABI_LP64F ? 4 : 8) \
#define UNITS_PER_FP_ARG \
((riscv_abi == ABI_ILP32 || riscv_abi == ABI_ILP32E \
|| riscv_abi == ABI_LP64) \
? 0 \
: ((riscv_abi == ABI_ILP32F || riscv_abi == ABI_LP64F) ? 4 : 8))

/* Set the sizes of the core types. */
#define SHORT_TYPE_SIZE 16
Expand Down
3 changes: 3 additions & 0 deletions gcc/config/riscv/riscv.opt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ Supported ABIs (for use with the -mabi= option):
EnumValue
Enum(abi_type) String(ilp32) Value(ABI_ILP32)

EnumValue
Enum(abi_type) String(ilp32e) Value(ABI_ILP32E)

EnumValue
Enum(abi_type) String(ilp32f) Value(ABI_ILP32F)

Expand Down

0 comments on commit a45f189

Please sign in to comment.