aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2009-11-20 16:48:28 +0000
committerJulian Brown <jules@gcc.gnu.org>2009-11-20 16:48:28 +0000
commit2ee67fbb886cbfab54a1e5a80e6a807e38a564ce (patch)
tree50ab49593d6bb8385a93a2e4d48ddb13830eb008 /gcc
parent10d3a72a808a1daa4a98a8be95a858a0aa053f3f (diff)
downloadgcc-2ee67fbb886cbfab54a1e5a80e6a807e38a564ce.zip
gcc-2ee67fbb886cbfab54a1e5a80e6a807e38a564ce.tar.gz
gcc-2ee67fbb886cbfab54a1e5a80e6a807e38a564ce.tar.bz2
arm.h (ASM_OUTPUT_REG_PUSH): Handle STATIC_CHAIN_REGNUM specially for Thumb-1.
gcc/ * config/arm/arm.h (ASM_OUTPUT_REG_PUSH): Handle STATIC_CHAIN_REGNUM specially for Thumb-1. (ASM_OUTPUT_REG_POP): Likewise. From-SVN: r154372
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/arm/arm.h22
2 files changed, 27 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6cf53a..4a7f32e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-20 Julian Brown <julian@codesourcery.com>
+
+ * config/arm/arm.h (ASM_OUTPUT_REG_PUSH): Handle STATIC_CHAIN_REGNUM
+ specially for Thumb-1.
+ (ASM_OUTPUT_REG_POP): Likewise.
+
2009-11-19 Jason Merrill <jason@redhat.com>
* dwarf2out.c (get_context_die): Take TYPE_MAIN_VARIANT.
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 663f07e..98abdb1 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -2274,24 +2274,44 @@ extern int making_const_table;
#define ASM_APP_OFF (TARGET_THUMB1 ? "\t.code\t16\n" : \
TARGET_THUMB2 ? "\t.thumb\n" : "")
-/* Output a push or a pop instruction (only used when profiling). */
+/* Output a push or a pop instruction (only used when profiling).
+ We can't push STATIC_CHAIN_REGNUM (r12) directly with Thumb-1. We know
+ that ASM_OUTPUT_REG_PUSH will be matched with ASM_OUTPUT_REG_POP, and
+ that r7 isn't used by the function profiler, so we can use it as a
+ scratch reg. WARNING: This isn't safe in the general case! It may be
+ sensitive to future changes in final.c:profile_function. */
#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
do \
{ \
if (TARGET_ARM) \
asm_fprintf (STREAM,"\tstmfd\t%r!,{%r}\n", \
STACK_POINTER_REGNUM, REGNO); \
+ else if (TARGET_THUMB1 \
+ && (REGNO) == STATIC_CHAIN_REGNUM) \
+ { \
+ asm_fprintf (STREAM, "\tpush\t{r7}\n"); \
+ asm_fprintf (STREAM, "\tmov\tr7, %r\n", REGNO);\
+ asm_fprintf (STREAM, "\tpush\t{r7}\n"); \
+ } \
else \
asm_fprintf (STREAM, "\tpush {%r}\n", REGNO); \
} while (0)
+/* See comment for ASM_OUTPUT_REG_PUSH concerning Thumb-1 issue. */
#define ASM_OUTPUT_REG_POP(STREAM, REGNO) \
do \
{ \
if (TARGET_ARM) \
asm_fprintf (STREAM, "\tldmfd\t%r!,{%r}\n", \
STACK_POINTER_REGNUM, REGNO); \
+ else if (TARGET_THUMB1 \
+ && (REGNO) == STATIC_CHAIN_REGNUM) \
+ { \
+ asm_fprintf (STREAM, "\tpop\t{r7}\n"); \
+ asm_fprintf (STREAM, "\tmov\t%r, r7\n", REGNO);\
+ asm_fprintf (STREAM, "\tpop\t{r7}\n"); \
+ } \
else \
asm_fprintf (STREAM, "\tpop {%r}\n", REGNO); \
} while (0)