diff options
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64-protos.h | 12 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 15 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.md | 11 |
4 files changed, 49 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bdc674d..4949bff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2013-07-15 Marcus Shawcroft <marcus.shawcroft@arm.com> + + * config/aarch64/aarch64-protos.h (aarch64_symbol_type): + Define SYMBOL_TINY_GOT, update comment. + * config/aarch64/aarch64.c + (aarch64_load_symref_appropriately): Handle SYMBOL_TINY_GOT. + (aarch64_expand_mov_immediate): Likewise. + (aarch64_print_operand): Likewise. + (aarch64_classify_symbol): Likewise. + * config/aarch64/aarch64.md (UNSPEC_GOTTINYPIC): Define. + (ldr_got_tiny): Define. + 2013-07-13 Tobias Grosser <tobias@grosser.es> PR tree-optimization/54094 diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h index e749cc1..f19045d 100644 --- a/gcc/config/aarch64/aarch64-protos.h +++ b/gcc/config/aarch64/aarch64-protos.h @@ -75,6 +75,17 @@ enum aarch64_symbol_context ADR x0, foo + SYMBOL_TINY_GOT + + Generate symbol accesses via the GOT using a single PC relative + instruction. To compute the address of symbol foo, we generate: + + ldr t0, :got:foo + + The value of foo can subsequently read using: + + ldrb t0, [t0] + SYMBOL_FORCE_TO_MEM : Global variables are addressed using constant pool. All variable addresses are spilled into constant pools. The constant pools themselves are addressed using PC @@ -89,6 +100,7 @@ enum aarch64_symbol_type SYMBOL_SMALL_GOTTPREL, SYMBOL_SMALL_TPREL, SYMBOL_TINY_ABSOLUTE, + SYMBOL_TINY_GOT, SYMBOL_FORCE_TO_MEM }; diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 025975c..a97f6ae 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -613,6 +613,10 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm, return; } + case SYMBOL_TINY_GOT: + emit_insn (gen_ldr_got_tiny (dest, imm)); + return; + default: gcc_unreachable (); } @@ -890,6 +894,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm) case SYMBOL_SMALL_TLSDESC: case SYMBOL_SMALL_GOTTPREL: case SYMBOL_SMALL_GOT: + case SYMBOL_TINY_GOT: if (offset != const0_rtx) { gcc_assert(can_create_pseudo_p ()); @@ -3646,6 +3651,10 @@ aarch64_print_operand (FILE *f, rtx x, char code) asm_fprintf (asm_out_file, ":tprel:"); break; + case SYMBOL_TINY_GOT: + gcc_unreachable (); + break; + default: break; } @@ -3675,6 +3684,10 @@ aarch64_print_operand (FILE *f, rtx x, char code) asm_fprintf (asm_out_file, ":tprel_lo12_nc:"); break; + case SYMBOL_TINY_GOT: + asm_fprintf (asm_out_file, ":got:"); + break; + default: break; } @@ -5241,7 +5254,7 @@ aarch64_classify_symbol (rtx x, case AARCH64_CMODEL_TINY_PIC: if (!aarch64_symbol_binds_local_p (x)) - return SYMBOL_SMALL_GOT; + return SYMBOL_TINY_GOT; return SYMBOL_TINY_ABSOLUTE; case AARCH64_CMODEL_SMALL_PIC: diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 68336db..229564c 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -80,6 +80,7 @@ UNSPEC_FRINTZ UNSPEC_GOTSMALLPIC UNSPEC_GOTSMALLTLS + UNSPEC_GOTTINYPIC UNSPEC_LD2 UNSPEC_LD3 UNSPEC_LD4 @@ -3751,6 +3752,16 @@ (set_attr "mode" "DI")] ) +(define_insn "ldr_got_tiny" + [(set (match_operand:DI 0 "register_operand" "=r") + (unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")] + UNSPEC_GOTTINYPIC))] + "" + "ldr\\t%0, %L1" + [(set_attr "v8type" "load1") + (set_attr "mode" "DI")] +) + (define_insn "aarch64_load_tp_hard" [(set (match_operand:DI 0 "register_operand" "=r") (unspec:DI [(const_int 0)] UNSPEC_TLS))] |