Skip to content

Commit 7af69aa

Browse files
committed
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 <[email protected]>
1 parent b0a7e8e commit 7af69aa

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
@@ -3370,7 +3370,7 @@ arc_save_callee_enter (uint64_t gmask,
33703370
reg = gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM);
33713371
mem = gen_frame_mem (Pmode, plus_constant (Pmode,
33723372
stack_pointer_rtx,
3373-
off));
3373+
-off));
33743374
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, reg);
33753375
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx++)) = 1;
33763376
off -= UNITS_PER_WORD;
@@ -3384,7 +3384,7 @@ arc_save_callee_enter (uint64_t gmask,
33843384
reg = gen_rtx_REG (SImode, regno);
33853385
mem = gen_frame_mem (SImode, plus_constant (Pmode,
33863386
stack_pointer_rtx,
3387-
off));
3387+
-off));
33883388
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, reg);
33893389
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx)) = 1;
33903390
gmask = gmask & ~(1ULL << regno);
@@ -3394,7 +3394,7 @@ arc_save_callee_enter (uint64_t gmask,
33943394
{
33953395
mem = gen_frame_mem (Pmode, plus_constant (Pmode,
33963396
stack_pointer_rtx,
3397-
off));
3397+
-off));
33983398
XVECEXP (insn, 0, indx) = gen_rtx_SET (mem, hard_frame_pointer_rtx);
33993399
RTX_FRAME_RELATED_P (XVECEXP (insn, 0, indx++)) = 1;
34003400
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)