Skip to content

Commit fce1dce

Browse files
clazissstephanosio
authored andcommitted
arc: Fix enter pattern instruction's offsets
The enter pattern instruction contains the necessary information for the dwarf machinery to generate the appropriate dwarf code. This patch is fixing the register offsets related to CFA, and adds a test. gcc/ * config/arc/arc.cc (arc_save_callee_enter): Use negative offsets. gcc/testsuite * gcc.target/arc/enter-dw2-1.c: New file. Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
1 parent bd72e25 commit fce1dce

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

gcc/config/arc/arc.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,7 +3350,7 @@ arc_save_callee_enter (uint64_t gmask,
33503350
reg = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
33513351
mem = gen_frame_mem (Pmode, plus_constant (Pmode,
33523352
stack_pointer_rtx,
3353-
off));
3353+
-off));
33543354
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, reg);
33553355
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx++)) = 1;
33563356
off -= UNITS_PER_WORD;
@@ -3364,7 +3364,7 @@ arc_save_callee_enter (uint64_t gmask,
33643364
reg = gen_rtx_REG (SImode, regno);
33653365
mem = gen_frame_mem (SImode, plus_constant (Pmode,
33663366
stack_pointer_rtx,
3367-
off));
3367+
-off));
33683368
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, reg);
33693369
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx)) = 1;
33703370
gmask = gmask & ~(1ULL << regno);
@@ -3374,7 +3374,7 @@ arc_save_callee_enter (uint64_t gmask,
33743374
{
33753375
mem = gen_frame_mem (Pmode, plus_constant (Pmode,
33763376
stack_pointer_rtx,
3377-
off));
3377+
-off));
33783378
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, hard_frame_pointer_rtx);
33793379
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx++)) = 1;
33803380
off -= UNITS_PER_WORD;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* Verify that we generate appropriate CFI offsets in the case of enter
2+
instruction. */
3+
/* { dg-skip-if "Not having enter_s insn." { arc700 || arc6xx } } */
4+
/* { dg-do compile } */
5+
/* { dg-options "-g -Os" } */
6+
7+
extern void bar (void);
8+
9+
void foo (void)
10+
{
11+
asm volatile (";my clobber list"
12+
: : : "r13", "r14", "r15", "r16", "r17", "r18", "r19");
13+
bar ();
14+
asm volatile (";my clobber list"
15+
: : : "r13", "r14", "r15", "r16", "r17", "r18", "r19");
16+
}
17+
18+
19+
/* { dg-final { scan-assembler-times "enter_s" 1 } } */
20+
/* { dg-final { scan-assembler-times "\.cfi_def_cfa_offset 32" 1 } } */
21+
/* { dg-final { scan-assembler-times "\.cfi_offset 31, -32" 1 } } */
22+
/* { dg-final { scan-assembler-times "\.cfi_offset 13, -28" 1 } } */
23+
/* { dg-final { scan-assembler-times "\.cfi_offset 14, -24" 1 } } */
24+
/* { dg-final { scan-assembler-times "\.cfi_offset 15, -20" 1 } } */
25+
/* { dg-final { scan-assembler-times "\.cfi_offset 16, -16" 1 } } */
26+
/* { dg-final { scan-assembler-times "\.cfi_offset 17, -12" 1 } } */
27+
/* { dg-final { scan-assembler-times "\.cfi_offset 18, -8" 1 } } */
28+
/* { dg-final { scan-assembler-times "\.cfi_offset 19, -4" 1 } } */

0 commit comments

Comments
 (0)