diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-14 13:17:24 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-14 13:17:24 -0700 |
commit | 1c384bf142c81baaad7f04c5d3fdaebcbafc5b0c (patch) | |
tree | d43d66a4da24c2d77ee8f88fc747f6a2f149435f /gcc/gimple-pretty-print.c | |
parent | 40c88b9403ef1e2b2e93ff70a5fb794916027665 (diff) | |
download | gcc-1c384bf142c81baaad7f04c5d3fdaebcbafc5b0c.zip gcc-1c384bf142c81baaad7f04c5d3fdaebcbafc5b0c.tar.gz gcc-1c384bf142c81baaad7f04c5d3fdaebcbafc5b0c.tar.bz2 |
builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec.
* builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec.
* cfgbuild.c (make_edges): Handle asm goto.
* cfglayout.c (fixup_reorder_chain): Likewise.
* cfgrtl.c (patch_jump_insn): Likewise.
* gimple-pretty-print.c (dump_gimple_asm): Likewise.
* gimple.c (gimple_build_asm_1): Add and use nlabels parameter.
(gimple_build_asm_vec): Add and use labels parameter.
(gimple_build_asm): Remove.
(walk_gimple_asm): Walk labels too.
* gimple.def (GIMPLE_ASM): Update docs.
* gimple.h: Update decls.
(struct gimple_statement_asm): Change nc to use unsigned char;
add nl member.
(gimple_asm_nlabels): New.
(gimple_asm_label_op, gimple_asm_set_label_op): New.
* gimplify.c (gimplify_asm_expr): Copy labels from ASM_EXPR
into gimple_build_asm_vec.
* jump.c (mark_jump_label_asm): New.
(mark_jump_label): Use it.
(redirect_jump_1): Handle asm goto.
(invert_jump_1): Soft fail if X is null.
* recog.c (extract_asm_operands): New.
(asm_noperands): Use it; handle asm labels.
(decode_asm_operands): Use extract_asm_operands.
(asm_operand_ok): Properly handle empty string.
* reg-stack.c (get_asm_operands_in_out): Rename from
get_asm_operand_n_inputs; use extract_asm_operands; return both
inputs and outputs by reference; update all callers.
* rtl.def (ASM_OPERANDS): Add label vector as operand 6.
* rtl.h (ASM_OPERANDS_LABEL_VEC): New.
(ASM_OPERANDS_LABEL_LENGTH, ASM_OPERANDS_LABEL): New.
(ASM_OPERANDS_SOURCE_LOCATION): Renumber.
(extract_asm_operands): Declare.
* stmt.c (expand_asm_operands): Add and use labels parameter.
(check_unique_operand_names): Likewise.
(resolve_asm_operand_names, resolve_operand_name_1): Likewise.
(expand_asm_stmt): Handle asm labels.
* tree-cfg.c (make_gimple_asm_edges): New.
(make_edges): Use it.
(cleanup_dead_labels): Handle asm labels.
(is_ctrl_altering_stmt): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
* tree.def (ASM_EXPR): Add 5th operand.
* tree.h (ASM_LABELS): New.
(resolve_asm_operand_names): Update decl.
* c-parser.c (c_parser_asm_statement): Parse asm goto.
(c_parser_asm_goto_operands): New.
* c-tree.h (build_asm_expr): Update decl.
* c-typeck.c (build_asm_expr): Add and use labels parameter.
* doc/extend.texi: Document asm goto.
gcc/ada/
* gcc-interface/trans.c (Pragma_to_gnu): Use build5 for ASM_EXPR.
gcc/cp/
* cp-tree.h (finish_asm_stmt): Update decl.
* parser.c (cp_parser_asm_definition): Parse asm goto.
(cp_parser_asm_label_list): New.
* pt.c (tsubst_copy_asm_operands): Don't recurse on labels.
(tsubst_expr): Handle asm labels.
* semantics.c (finish_asm_stmt): Add and use labels parameter.
gcc/testsuite/
* c-c++-common/asmgoto-1.c, c-c++-common/asmgoto-2.c,
c-c++-common/asmgoto-3.c, gcc.c-torture/compile/asmgoto-1.c,
gcc.dg/tree-ssa/asmgoto-1.c: New files.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r151701
Diffstat (limited to 'gcc/gimple-pretty-print.c')
-rw-r--r-- | gcc/gimple-pretty-print.c | 194 |
1 files changed, 128 insertions, 66 deletions
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c index 8903c66..3d3134b 100644 --- a/gcc/gimple-pretty-print.c +++ b/gcc/gimple-pretty-print.c @@ -1101,89 +1101,151 @@ dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags) static void dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags) { - unsigned int i; + unsigned int i, n, f, fields; if (flags & TDF_RAW) - dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs, - gimple_asm_string (gs)); + { + dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs, + gimple_asm_string (gs)); + + n = gimple_asm_noutputs (gs); + if (n) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "OUTPUT: "); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_output_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + } + + n = gimple_asm_ninputs (gs); + if (n) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "INPUT: "); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_input_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + } + + n = gimple_asm_nclobbers (gs); + if (n) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "CLOBBER: "); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + } + + n = gimple_asm_nlabels (gs); + if (n) + { + newline_and_indent (buffer, spc + 2); + pp_string (buffer, "LABEL: "); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_label_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + } + + newline_and_indent (buffer, spc); + pp_character (buffer, '>'); + } else { pp_string (buffer, "__asm__"); if (gimple_asm_volatile_p (gs)) pp_string (buffer, " __volatile__"); + if (gimple_asm_nlabels (gs)) + pp_string (buffer, " goto"); pp_string (buffer, "(\""); pp_string (buffer, gimple_asm_string (gs)); pp_string (buffer, "\""); - } - if (gimple_asm_ninputs (gs) - || gimple_asm_noutputs (gs) - || gimple_asm_nclobbers (gs)) - { - if (gimple_asm_noutputs (gs)) - { - if (flags & TDF_RAW) - { - newline_and_indent (buffer, spc + 2); - pp_string (buffer, "OUTPUT: "); - } - else - pp_string (buffer, " : "); - } + if (gimple_asm_nlabels (gs)) + fields = 4; + else if (gimple_asm_nclobbers (gs)) + fields = 3; + else if (gimple_asm_ninputs (gs)) + fields = 2; + else if (gimple_asm_noutputs (gs)) + fields = 1; + else + fields = 0; - for (i = 0; i < gimple_asm_noutputs (gs); i++) - { - dump_generic_node (buffer, gimple_asm_output_op (gs, i), spc, flags, - false); - if ( i < gimple_asm_noutputs (gs) -1) - pp_string (buffer, ", "); - } + for (f = 0; f < fields; ++f) + { + pp_string (buffer, " : "); - if (gimple_asm_ninputs (gs)) - { - if (flags & TDF_RAW) - { - newline_and_indent (buffer, spc + 2); - pp_string (buffer, "INPUT: "); - } - else - pp_string (buffer, " : "); - } + switch (f) + { + case 0: + n = gimple_asm_noutputs (gs); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_output_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + break; - for (i = 0; i < gimple_asm_ninputs (gs); i++) - { - dump_generic_node (buffer, gimple_asm_input_op (gs, i), spc, flags, - false); - if (i < gimple_asm_ninputs (gs) -1) - pp_string (buffer, " : "); - } + case 1: + n = gimple_asm_ninputs (gs); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_input_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + break; - if (gimple_asm_nclobbers (gs)) - { - if (flags & TDF_RAW) - { - newline_and_indent (buffer, spc + 2); - pp_string (buffer, "CLOBBER: "); - } - else - pp_string (buffer, " : "); - } + case 2: + n = gimple_asm_nclobbers (gs); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + break; - for (i = 0; i < gimple_asm_nclobbers (gs); i++) - { - dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), spc, flags, - false); - if ( i < gimple_asm_nclobbers (gs) -1) - pp_string (buffer, ", "); - } - } - if (flags & TDF_RAW) - { - newline_and_indent (buffer, spc); - pp_character (buffer, '>'); + case 3: + n = gimple_asm_nlabels (gs); + for (i = 0; i < n; i++) + { + dump_generic_node (buffer, gimple_asm_label_op (gs, i), + spc, flags, false); + if (i < n - 1) + pp_string (buffer, ", "); + } + break; + + default: + gcc_unreachable (); + } + } + + pp_string (buffer, ");"); } - else - pp_string (buffer, ");"); } |