diff options
author | Richard Henderson <rth@redhat.com> | 2001-01-02 15:49:45 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2001-01-02 15:49:45 -0800 |
commit | 4f78b9a896ea942d9241538d15532b8f1587f420 (patch) | |
tree | 6f47d15496d0c5ff8d25acd1c69deaf37c24d9ed | |
parent | f941340f5a825b0320300e70ed828577d4b46260 (diff) | |
download | gcc-4f78b9a896ea942d9241538d15532b8f1587f420.zip gcc-4f78b9a896ea942d9241538d15532b8f1587f420.tar.gz gcc-4f78b9a896ea942d9241538d15532b8f1587f420.tar.bz2 |
c-common.h (ASM_INPUT_P): New.
* c-common.h (ASM_INPUT_P): New.
* c-parse.in (asm): Set it when needed.
* c-semantics.c (genrtl_asm_stmt): Test it instead of the
existance of an operand.
* cp/parse.y (asm): Set ASM_INPUT_P.
From-SVN: r38638
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-common.h | 7 | ||||
-rw-r--r-- | gcc/c-parse.in | 3 | ||||
-rw-r--r-- | gcc/c-semantics.c | 23 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/parse.y | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/asm-2.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/asm-3.c | 9 |
8 files changed, 51 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4537c1f..1e3497f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2001-01-02 Richard Henderson <rth@redhat.com> + + * c-common.h (ASM_INPUT_P): New. + * c-parse.in (asm): Set it when needed. + * c-semantics.c (genrtl_asm_stmt): Test it instead of the + existance of an operand. + Tue Jan 2 20:27:07 MET 2001 Jan Hubicka <jh@suse.cz> * dwarf2out.c (stack_adjust_offset): Handle PRE_MODIFY. diff --git a/gcc/c-common.h b/gcc/c-common.h index 77c54f3..c37c38a 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */ SCOPE_BEGIN_P (in SCOPE_STMT) DECL_PRETTY_FUNCTION_P (in VAR_DECL) NEW_FOR_SCOPE_P (in FOR_STMT) + ASM_INPUT_P (in ASM_STMT) 1: C_DECLARED_LABEL_FLAG (in LABEL_DECL) STMT_IS_FULL_EXPR_P (in _STMT) 2: STMT_LINENO_FOR_FN_P (in _STMT) @@ -666,6 +667,10 @@ extern tree strip_array_types PARAMS ((tree)); initialization variables. */ #define NEW_FOR_SCOPE_P(NODE) (TREE_LANG_FLAG_0 (NODE)) +/* Nonzero if we want to create an ASM_INPUT instead of an + ASM_OPERAND with no operands. */ +#define ASM_INPUT_P(NODE) (TREE_LANG_FLAG_0 (NODE)) + #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM, enum c_tree_code { @@ -694,7 +699,7 @@ extern void genrtl_case_label PARAMS ((tree)); extern void genrtl_compound_stmt PARAMS ((tree)); extern void genrtl_asm_stmt PARAMS ((tree, tree, tree, tree, - tree)); + tree, int)); extern void genrtl_decl_cleanup PARAMS ((tree, tree)); extern int stmts_are_full_exprs_p PARAMS ((void)); extern int anon_aggr_type_p PARAMS ((tree)); diff --git a/gcc/c-parse.in b/gcc/c-parse.in index f944ac3..5c46b20 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -1,6 +1,6 @@ /* YACC parser for C syntax and for Objective C. -*-c-*- Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GNU CC. @@ -1953,6 +1953,7 @@ stmt: $$ = add_stmt (build_stmt (ASM_STMT, NULL_TREE, $4, NULL_TREE, NULL_TREE, NULL_TREE)); + ASM_INPUT_P ($$) = 1; } else { diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 4cf4572..d6477f6 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -1,8 +1,8 @@ /* This file contains the definitions and documentation for the common tree codes used in the GNU C and C++ compilers (see c-common.def for the standard codes). - Copyright (C) 2000 Free Software Foundation, Inc. Written by - Benjamin Chelf (chelf@codesourcery.com). + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Written by Benjamin Chelf (chelf@codesourcery.com). This file is part of GNU CC. @@ -717,12 +717,13 @@ genrtl_compound_stmt (t) void genrtl_asm_stmt (cv_qualifier, string, output_operands, - input_operands, clobbers) + input_operands, clobbers, asm_input_p) tree cv_qualifier; tree string; tree output_operands; tree input_operands; tree clobbers; + int asm_input_p; { if (cv_qualifier != NULL_TREE && cv_qualifier != ridpointers[(int) RID_VOLATILE]) @@ -733,15 +734,12 @@ genrtl_asm_stmt (cv_qualifier, string, output_operands, } emit_line_note (input_filename, lineno); - if (output_operands != NULL_TREE || input_operands != NULL_TREE - || clobbers != NULL_TREE) - c_expand_asm_operands (string, output_operands, - input_operands, - clobbers, - cv_qualifier != NULL_TREE, - input_filename, lineno); - else + if (asm_input_p) expand_asm (string); + else + c_expand_asm_operands (string, output_operands, input_operands, + clobbers, cv_qualifier != NULL_TREE, + input_filename, lineno); } /* Generate the RTL for a DECL_CLEANUP. */ @@ -842,7 +840,8 @@ expand_stmt (t) case ASM_STMT: genrtl_asm_stmt (ASM_CV_QUAL (t), ASM_STRING (t), - ASM_OUTPUTS (t), ASM_INPUTS (t), ASM_CLOBBERS (t)); + ASM_OUTPUTS (t), ASM_INPUTS (t), + ASM_CLOBBERS (t), ASM_INPUT_P (t)); break; case SCOPE_STMT: diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 61bd1f2..3d89415 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2001-01-02 Richard Henderson <rth@redhat.com> + + * parse.y (asm): Set ASM_INPUT_P. + 2001-01-02 Jason Merrill <jason@redhat.com> * tree.c (cp_valid_lang_attribute): Don't set CLASSTYPE_COM_INTERFACE diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 4e76394..27f949a 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -1,6 +1,6 @@ /* YACC parser for C++ syntax. Copyright (C) 1988, 1989, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000 Free Software Foundation, Inc. + 1999, 2000, 2001 Free Software Foundation, Inc. Hacked by Michael Tiemann (tiemann@cygnus.com) This file is part of GNU CC. @@ -3398,7 +3398,8 @@ simple_stmt: { $$ = finish_return_stmt ($2); } | asm_keyword maybe_cv_qualifier '(' string ')' ';' { $$ = finish_asm_stmt ($2, $4, NULL_TREE, NULL_TREE, - NULL_TREE); } + NULL_TREE); + ASM_INPUT_P ($$) = 1; } /* This is the case with just output operands. */ | asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ')' ';' { $$ = finish_asm_stmt ($2, $4, $6, NULL_TREE, NULL_TREE); } diff --git a/gcc/testsuite/gcc.dg/asm-2.c b/gcc/testsuite/gcc.dg/asm-2.c new file mode 100644 index 0000000..80396ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int f() +{ + asm volatile ("foo%%bar" : : ); +} + +/* { dg-final { scan-assembler asm-2.c "foo%bar" } } */ diff --git a/gcc/testsuite/gcc.dg/asm-3.c b/gcc/testsuite/gcc.dg/asm-3.c new file mode 100644 index 0000000..5c68647 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asm-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int f() +{ + asm ("foo%%bar"); +} + +/* { dg-final { scan-assembler asm-3.c "foo%%bar" } } */ |