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
This commit is contained in:
Richard Henderson 2001-01-02 15:49:45 -08:00 committed by Richard Henderson
parent f941340f5a
commit 4f78b9a896
8 changed files with 51 additions and 16 deletions

View File

@ -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.

View File

@ -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));

View File

@ -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
{

View File

@ -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:

View File

@ -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

View File

@ -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); }

View File

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "" } */
int f()
{
asm volatile ("foo%%bar" : : );
}
/* { dg-final { scan-assembler asm-2.c "foo%bar" } } */

View File

@ -0,0 +1,9 @@
/* { dg-do compile } */
/* { dg-options "" } */
int f()
{
asm ("foo%%bar");
}
/* { dg-final { scan-assembler asm-3.c "foo%%bar" } } */