summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-16 16:39:17 +0000
committerdanglin <danglin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-16 16:39:17 +0000
commitb9a4afbc81b5e340f9502b70f1fedd62a5ff23c1 (patch)
tree6f816052e93899bbc6923ad3a3b779c19cd59442
parent67c4265a32f69b6f7cc341840511ec0da3421b5c (diff)
downloadppe42-gcc-b9a4afbc81b5e340f9502b70f1fedd62a5ff23c1.tar.gz
ppe42-gcc-b9a4afbc81b5e340f9502b70f1fedd62a5ff23c1.zip
PR target/61641
* config/pa/pa-protos.h (pa_output_addr_vec, pa_output_addr_diff_vec): Declare. * config/pa/pa.c (pa_reorg): Remove code to insert brtab marker insns. (pa_output_addr_vec, pa_output_addr_diff_vec): New. * config/pa/pa.h (ASM_OUTPUT_ADDR_VEC, ASM_OUTPUT_ADDR_DIFF_VEC): Define. * config/pa/pa.md (begin_brtab): Delete insn. (end_brtab): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@214065 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog12
-rw-r--r--gcc/config/pa/pa-protos.h2
-rw-r--r--gcc/config/pa/pa.c69
-rw-r--r--gcc/config/pa/pa.h10
-rw-r--r--gcc/config/pa/pa.md30
5 files changed, 67 insertions, 56 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bbc4adeb940..8d0657da055 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2014-08-16 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/61641
+ * config/pa/pa-protos.h (pa_output_addr_vec, pa_output_addr_diff_vec):
+ Declare.
+ * config/pa/pa.c (pa_reorg): Remove code to insert brtab marker insns.
+ (pa_output_addr_vec, pa_output_addr_diff_vec): New.
+ * config/pa/pa.h (ASM_OUTPUT_ADDR_VEC, ASM_OUTPUT_ADDR_DIFF_VEC):
+ Define.
+ * config/pa/pa.md (begin_brtab): Delete insn.
+ (end_brtab): Likewise.
+
2014-08-15 Oleg Endo <olegendo@gcc.gnu.org>
Backport from mainline:
diff --git a/gcc/config/pa/pa-protos.h b/gcc/config/pa/pa-protos.h
index 2659dcdf06a..1e48da51258 100644
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@ -49,6 +49,8 @@ extern const char *pa_output_mul_insn (int, rtx);
extern const char *pa_output_div_insn (rtx *, int, rtx);
extern const char *pa_output_mod_insn (int, rtx);
extern const char *pa_singlemove_string (rtx *);
+extern void pa_output_addr_vec (rtx, rtx);
+extern void pa_output_addr_diff_vec (rtx, rtx);
extern void pa_output_arg_descriptor (rtx);
extern void pa_output_global_address (FILE *, rtx, int);
extern void pa_print_operand (FILE *, rtx, int);
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 871e4e5c6e8..cf82cd32634 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -8944,40 +8944,15 @@ pa_following_call (rtx insn)
}
/* We use this hook to perform a PA specific optimization which is difficult
- to do in earlier passes.
-
- We surround the jump table itself with BEGIN_BRTAB and END_BRTAB
- insns. Those insns mark where we should emit .begin_brtab and
- .end_brtab directives when using GAS. This allows for better link
- time optimizations. */
+ to do in earlier passes. */
static void
pa_reorg (void)
{
- rtx insn;
-
remove_useless_addtr_insns (1);
if (pa_cpu < PROCESSOR_8000)
pa_combine_instructions ();
-
- /* Still need brtab marker insns. FIXME: the presence of these
- markers disables output of the branch table to readonly memory,
- and any alignment directives that might be needed. Possibly,
- the begin_brtab insn should be output before the label for the
- table. This doesn't matter at the moment since the tables are
- always output in the text section. */
- for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
- {
- /* Find an ADDR_VEC insn. */
- if (! JUMP_TABLE_DATA_P (insn))
- continue;
-
- /* Now generate markers for the beginning and end of the
- branch table. */
- emit_insn_before (gen_begin_brtab (), insn);
- emit_insn_after (gen_end_brtab (), insn);
- }
}
/* The PA has a number of odd instructions which can perform multiple
@@ -10572,4 +10547,46 @@ pa_legitimize_reload_address (rtx ad, enum machine_mode mode,
return NULL_RTX;
}
+/* Output address vector. */
+
+void
+pa_output_addr_vec (rtx lab, rtx body)
+{
+ int idx, vlen = XVECLEN (body, 0);
+
+ targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (lab));
+ if (TARGET_GAS)
+ fputs ("\t.begin_brtab\n", asm_out_file);
+ for (idx = 0; idx < vlen; idx++)
+ {
+ ASM_OUTPUT_ADDR_VEC_ELT
+ (asm_out_file, CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 0, idx), 0)));
+ }
+ if (TARGET_GAS)
+ fputs ("\t.end_brtab\n", asm_out_file);
+}
+
+/* Output address difference vector. */
+
+void
+pa_output_addr_diff_vec (rtx lab, rtx body)
+{
+ rtx base = XEXP (XEXP (body, 0), 0);
+ int idx, vlen = XVECLEN (body, 1);
+
+ targetm.asm_out.internal_label (asm_out_file, "L", CODE_LABEL_NUMBER (lab));
+ if (TARGET_GAS)
+ fputs ("\t.begin_brtab\n", asm_out_file);
+ for (idx = 0; idx < vlen; idx++)
+ {
+ ASM_OUTPUT_ADDR_DIFF_ELT
+ (asm_out_file,
+ body,
+ CODE_LABEL_NUMBER (XEXP (XVECEXP (body, 1, idx), 0)),
+ CODE_LABEL_NUMBER (base));
+ }
+ if (TARGET_GAS)
+ fputs ("\t.end_brtab\n", asm_out_file);
+}
+
#include "gt-pa.h"
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index ac3f0ebe74e..f6c9751a252 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1193,6 +1193,16 @@ do { \
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
fprintf (FILE, "\t.word L$%04d-L$%04d\n", VALUE, REL)
+/* This is how to output an absolute case-vector. */
+
+#define ASM_OUTPUT_ADDR_VEC(LAB,BODY) \
+ pa_output_addr_vec ((LAB),(BODY))
+
+/* This is how to output a relative case-vector. */
+
+#define ASM_OUTPUT_ADDR_DIFF_VEC(LAB,BODY) \
+ pa_output_addr_diff_vec ((LAB),(BODY))
+
/* This is how to output an assembler line that says to advance the
location counter to a multiple of 2**LOG bytes. */
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index e55d0b86b90..a9421ac2e61 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -8508,36 +8508,6 @@ add,l %2,%3,%3\;bv,n %%r0(%3)"
[(set_attr "type" "move")
(set_attr "length" "4")])
-;; These are just placeholders so we know where branch tables
-;; begin and end.
-(define_insn "begin_brtab"
- [(const_int 1)]
- ""
- "*
-{
- /* Only GAS actually supports this pseudo-op. */
- if (TARGET_GAS)
- return \".begin_brtab\";
- else
- return \"\";
-}"
- [(set_attr "type" "move")
- (set_attr "length" "0")])
-
-(define_insn "end_brtab"
- [(const_int 2)]
- ""
- "*
-{
- /* Only GAS actually supports this pseudo-op. */
- if (TARGET_GAS)
- return \".end_brtab\";
- else
- return \"\";
-}"
- [(set_attr "type" "move")
- (set_attr "length" "0")])
-
;;; EH does longjmp's from and within the data section. Thus,
;;; an interspace branch is required for the longjmp implementation.
;;; Registers r1 and r2 are used as scratch registers for the jump
OpenPOWER on IntegriCloud