Skip to content

Commit 76db38d

Browse files
committed
Make the RTL frontend set REG_NREGS correctly
While working on a new testcase that uses the RTL frontend, I hit a bug where a (reg ...) that spans multiple hard registers had REG_NREGS set to 1. This caused various things to misbehave. For example, if the (reg ...) in question was used as crtl->return_rtx, only the first register in the group would be marked as live on exit. gcc/ * read-rtl-function.cc (function_reader::read_rtx_operand_r): Use hard_regno_nregs to work out REG_NREGS for hard registers.
1 parent 0fd98b6 commit 76db38d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

gcc/read-rtl-function.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,10 @@ function_reader::read_rtx_operand_r (rtx x)
10651065
if (regno == -1)
10661066
fatal_at (loc, "unrecognized register: '%s'", name.string);
10671067

1068-
set_regno_raw (x, regno, 1);
1068+
int nregs = 1;
1069+
if (HARD_REGISTER_NUM_P (regno))
1070+
nregs = hard_regno_nregs (regno, GET_MODE (x));
1071+
set_regno_raw (x, regno, nregs);
10691072

10701073
/* Consolidate singletons. */
10711074
x = consolidate_singletons (x);

0 commit comments

Comments
 (0)