aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2007-03-09 07:36:43 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2007-03-09 07:36:43 +0000
commitbff4b63d31059f3ebf918e70ca00d5eb4dcbc62e (patch)
tree48b68219ea2954e8bd644e2a8f092df8fd7a9b90
parent1296c31f09a6f9ec9030f4641f8a3bc50e509dc7 (diff)
downloadgcc-bff4b63d31059f3ebf918e70ca00d5eb4dcbc62e.zip
gcc-bff4b63d31059f3ebf918e70ca00d5eb4dcbc62e.tar.gz
gcc-bff4b63d31059f3ebf918e70ca00d5eb4dcbc62e.tar.bz2
rtl.def (ASM_INPUT): Add location.
* rtl.def (ASM_INPUT): Add location. * rtl.h (ASM_INPUT_SOURCE_LOCATION): New. (ASM_INPUT_SOURCE_FILE, ASM_INPUT_SOURCE_LINE): New. (decode_asm_operands): Add loc operand. (gen_rtx_ASM_INPUT, gen_rtx_ASM_INPUT_loc): Define. * stmt.c (expand_asm): Rename to... (expand_asm_loc): ... this. Add locus argument. Pass it on to gen_rtx_ASM_INPUT_loc. (expand_asm_expr): Adjust. * recog.c (decode_asm_operands): Add loc operand. (check_asm_operands, extract_insn): Adjust. * reload1.c (maybe_fix_stack_asms): Likewise. * final.c (asm_insn_count): Likewise. (final_scan_insn): Output # line before and after asm. From-SVN: r122742
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/final.c25
-rw-r--r--gcc/recog.c36
-rw-r--r--gcc/reload1.c2
-rw-r--r--gcc/rtl.def12
-rw-r--r--gcc/rtl.h17
-rw-r--r--gcc/stmt.c11
7 files changed, 92 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48e94f6..6c55f65 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,20 @@
+2007-03-09 Alexandre Oliva <aoliva@redhat.com>
+
+ * rtl.def (ASM_INPUT): Add location.
+ * rtl.h (ASM_INPUT_SOURCE_LOCATION): New.
+ (ASM_INPUT_SOURCE_FILE, ASM_INPUT_SOURCE_LINE): New.
+ (decode_asm_operands): Add loc operand.
+ (gen_rtx_ASM_INPUT, gen_rtx_ASM_INPUT_loc): Define.
+ * stmt.c (expand_asm): Rename to...
+ (expand_asm_loc): ... this. Add locus argument. Pass it on to
+ gen_rtx_ASM_INPUT_loc.
+ (expand_asm_expr): Adjust.
+ * recog.c (decode_asm_operands): Add loc operand.
+ (check_asm_operands, extract_insn): Adjust.
+ * reload1.c (maybe_fix_stack_asms): Likewise.
+ * final.c (asm_insn_count): Likewise.
+ (final_scan_insn): Output # line before and after asm.
+
2007-03-09 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-structalias.c (variable_info): Remove
diff --git a/gcc/final.c b/gcc/final.c
index bd96444..d7d1daf 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -1,6 +1,6 @@
/* Convert RTL to assembler code and output it, for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1357,7 +1357,7 @@ asm_insn_count (rtx body)
if (GET_CODE (body) == ASM_INPUT)
template = XSTR (body, 0);
else
- template = decode_asm_operands (body, NULL, NULL, NULL, NULL);
+ template = decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL);
for (; *template; template++)
if (IS_ASM_LOGICAL_LINE_SEPARATOR (*template) || *template == '\n')
@@ -2068,12 +2068,25 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
if (string[0])
{
+ location_t loc;
+
if (! app_on)
{
fputs (ASM_APP_ON, file);
app_on = 1;
}
+#ifdef USE_MAPPED_LOCATION
+ loc = ASM_INPUT_SOURCE_LOCATION (body);
+#else
+ loc.file = ASM_INPUT_SOURCE_FILE (body);
+ loc.line = ASM_INPUT_SOURCE_LINE (body);
+#endif
+ if (loc.file && loc.line)
+ fprintf (asm_out_file, "%s %i \"%s\" 1\n",
+ ASM_COMMENT_START, loc.line, loc.file);
fprintf (asm_out_file, "\t%s\n", string);
+ if (loc.file && loc.line)
+ fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
}
break;
}
@@ -2084,12 +2097,13 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
unsigned int noperands = asm_noperands (body);
rtx *ops = alloca (noperands * sizeof (rtx));
const char *string;
+ location_t loc;
/* There's no telling what that did to the condition codes. */
CC_STATUS_INIT;
/* Get out the operand values. */
- string = decode_asm_operands (body, ops, NULL, NULL, NULL);
+ string = decode_asm_operands (body, ops, NULL, NULL, NULL, &loc);
/* Inhibit dieing on what would otherwise be compiler bugs. */
insn_noperands = noperands;
this_is_asm_operands = insn;
@@ -2106,7 +2120,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
fputs (ASM_APP_ON, file);
app_on = 1;
}
+ if (loc.file && loc.line)
+ fprintf (asm_out_file, "%s %i \"%s\" 1\n",
+ ASM_COMMENT_START, loc.line, loc.file);
output_asm_insn (string, ops);
+ if (loc.file && loc.line)
+ fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START);
}
this_is_asm_operands = 0;
diff --git a/gcc/recog.c b/gcc/recog.c
index a7dc869..af5387a 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -1,6 +1,6 @@
/* Subroutines used by or related to instruction recognition.
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
- 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -140,7 +140,7 @@ check_asm_operands (rtx x)
operands = alloca (noperands * sizeof (rtx));
constraints = alloca (noperands * sizeof (char *));
- decode_asm_operands (x, operands, NULL, constraints, NULL);
+ decode_asm_operands (x, operands, NULL, constraints, NULL, NULL);
for (i = 0; i < noperands; i++)
{
@@ -1492,15 +1492,16 @@ asm_noperands (rtx body)
const char *
decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs,
- const char **constraints, enum machine_mode *modes)
+ const char **constraints, enum machine_mode *modes,
+ location_t *loc)
{
int i;
int noperands;
- const char *template = 0;
+ rtx asmop = 0;
if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
{
- rtx asmop = SET_SRC (body);
+ asmop = SET_SRC (body);
/* Single output operand: BODY is (set OUTPUT (asm_operands ....)). */
noperands = ASM_OPERANDS_INPUT_LENGTH (asmop) + 1;
@@ -1527,11 +1528,10 @@ decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs,
constraints[0] = ASM_OPERANDS_OUTPUT_CONSTRAINT (asmop);
if (modes)
modes[0] = GET_MODE (SET_DEST (body));
- template = ASM_OPERANDS_TEMPLATE (asmop);
}
else if (GET_CODE (body) == ASM_OPERANDS)
{
- rtx asmop = body;
+ asmop = body;
/* No output operands: BODY is (asm_operands ....). */
noperands = ASM_OPERANDS_INPUT_LENGTH (asmop);
@@ -1549,13 +1549,12 @@ decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs,
if (modes)
modes[i] = ASM_OPERANDS_INPUT_MODE (asmop, i);
}
- template = ASM_OPERANDS_TEMPLATE (asmop);
}
else if (GET_CODE (body) == PARALLEL
&& GET_CODE (XVECEXP (body, 0, 0)) == SET
&& GET_CODE (SET_SRC (XVECEXP (body, 0, 0))) == ASM_OPERANDS)
{
- rtx asmop = SET_SRC (XVECEXP (body, 0, 0));
+ asmop = SET_SRC (XVECEXP (body, 0, 0));
int nparallel = XVECLEN (body, 0); /* Includes CLOBBERs. */
int nin = ASM_OPERANDS_INPUT_LENGTH (asmop);
int nout = 0; /* Does not include CLOBBERs. */
@@ -1591,15 +1590,13 @@ decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs,
if (modes)
modes[i + nout] = ASM_OPERANDS_INPUT_MODE (asmop, i);
}
-
- template = ASM_OPERANDS_TEMPLATE (asmop);
}
else if (GET_CODE (body) == PARALLEL
&& GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
{
/* No outputs, but some CLOBBERs. */
- rtx asmop = XVECEXP (body, 0, 0);
+ asmop = XVECEXP (body, 0, 0);
int nin = ASM_OPERANDS_INPUT_LENGTH (asmop);
for (i = 0; i < nin; i++)
@@ -1614,10 +1611,19 @@ decode_asm_operands (rtx body, rtx *operands, rtx **operand_locs,
modes[i] = ASM_OPERANDS_INPUT_MODE (asmop, i);
}
- template = ASM_OPERANDS_TEMPLATE (asmop);
}
- return template;
+ if (loc)
+ {
+#ifdef USE_MAPPED_LOCATION
+ *loc = ASM_OPERANDS_SOURCE_LOCATION (asmop);
+#else
+ loc->file = ASM_OPERANDS_SOURCE_FILE (asmop);
+ loc->line = ASM_OPERANDS_SOURCE_LINE (asmop);
+#endif
+ }
+
+ return ASM_OPERANDS_TEMPLATE (asmop);
}
/* Check if an asm_operand matches its constraints.
@@ -2086,7 +2092,7 @@ extract_insn (rtx insn)
decode_asm_operands (body, recog_data.operand,
recog_data.operand_loc,
recog_data.constraints,
- recog_data.operand_mode);
+ recog_data.operand_mode, NULL);
if (noperands > 0)
{
const char *p = recog_data.constraints[0];
diff --git a/gcc/reload1.c b/gcc/reload1.c
index c469fb0..2aad6b0 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -1365,7 +1365,7 @@ maybe_fix_stack_asms (void)
/* Get the operand values and constraints out of the insn. */
decode_asm_operands (pat, recog_data.operand, recog_data.operand_loc,
- constraints, operand_mode);
+ constraints, operand_mode, NULL);
/* For every operand, see what registers are allowed. */
for (i = 0; i < noperands; i++)
diff --git a/gcc/rtl.def b/gcc/rtl.def
index 7a04d88..a49f164 100644
--- a/gcc/rtl.def
+++ b/gcc/rtl.def
@@ -168,15 +168,15 @@ DEF_RTL_EXPR(COND_EXEC, "cond_exec", "ee", RTX_EXTRA)
/* Several operations to be done in parallel (perhaps under COND_EXEC). */
DEF_RTL_EXPR(PARALLEL, "parallel", "E", RTX_EXTRA)
+#ifdef USE_MAPPED_LOCATION
/* A string that is passed through to the assembler as input.
One can obviously pass comments through by using the
assembler comment syntax.
These occur in an insn all by themselves as the PATTERN.
They also appear inside an ASM_OPERANDS
as a convenient way to hold a string. */
-DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s", RTX_EXTRA)
+DEF_RTL_EXPR(ASM_INPUT, "asm_input", "si", RTX_EXTRA)
-#ifdef USE_MAPPED_LOCATION
/* An assembler instruction with operands.
1st operand is the instruction template.
2nd operand is the constraint for the output.
@@ -190,6 +190,14 @@ DEF_RTL_EXPR(ASM_INPUT, "asm_input", "s", RTX_EXTRA)
6th is the source line number. */
DEF_RTL_EXPR(ASM_OPERANDS, "asm_operands", "ssiEEi", RTX_EXTRA)
#else
+/* A string that is passed through to the assembler as input.
+ One can obviously pass comments through by using the
+ assembler comment syntax.
+ These occur in an insn all by themselves as the PATTERN.
+ They also appear inside an ASM_OPERANDS
+ as a convenient way to hold a string. */
+DEF_RTL_EXPR(ASM_INPUT, "asm_input", "ssi", RTX_EXTRA)
+
/* An assembler instruction with operands.
1st operand is the instruction template.
2nd operand is the constraint for the output.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 41d50d4..5c39efe 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1090,9 +1090,12 @@ do { \
GET_MODE (XCVECEXP (RTX, 4, N, ASM_OPERANDS))
#ifdef USE_MAPPED_LOCATION
#define ASM_OPERANDS_SOURCE_LOCATION(RTX) XCUINT (RTX, 5, ASM_OPERANDS)
+#define ASM_INPUT_SOURCE_LOCATION(RTX) XCUINT (RTX, 1, ASM_INPUT)
#else
#define ASM_OPERANDS_SOURCE_FILE(RTX) XCSTR (RTX, 5, ASM_OPERANDS)
#define ASM_OPERANDS_SOURCE_LINE(RTX) XCINT (RTX, 6, ASM_OPERANDS)
+#define ASM_INPUT_SOURCE_FILE(RTX) XCSTR (RTX, 1, ASM_INPUT)
+#define ASM_INPUT_SOURCE_LINE(RTX) XCINT (RTX, 2, ASM_INPUT)
#endif
/* 1 if RTX is a mem that is statically allocated in read-only memory. */
@@ -1767,7 +1770,7 @@ extern void free_reg_info (void);
/* recog.c */
extern int asm_noperands (rtx);
extern const char *decode_asm_operands (rtx, rtx *, rtx **, const char **,
- enum machine_mode *);
+ enum machine_mode *, location_t *);
extern enum reg_class reg_preferred_class (int);
extern enum reg_class reg_alternate_class (int);
@@ -1864,7 +1867,17 @@ extern GTY(()) rtx return_address_pointer_rtx;
#ifndef GENERATOR_FILE
#include "genrtl.h"
-#ifndef USE_MAPPED_LOCATION
+#undef gen_rtx_ASM_INPUT
+#ifdef USE_MAPPED_LOCATION
+#define gen_rtx_ASM_INPUT(MODE, ARG0) \
+ gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), 0)
+#define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
+ gen_rtx_fmt_si (ASM_INPUT, (MODE), (ARG0), (LOC))
+#else
+#define gen_rtx_ASM_INPUT(MODE, ARG0) \
+ gen_rtx_fmt_ssi (ASM_INPUT, (MODE), (ARG0), NULL, 0)
+#define gen_rtx_ASM_INPUT_loc(MODE, ARG0, LOC) \
+ gen_rtx_fmt_ssi (ASM_INPUT, (MODE), (ARG0), (LOC).file, (LOC).line)
#undef gen_rtx_ASM_OPERANDS
#define gen_rtx_ASM_OPERANDS(MODE, ARG0, ARG1, ARG2, ARG3, ARG4, LOC) \
gen_rtx_fmt_ssiEEsi (ASM_OPERANDS, (MODE), (ARG0), (ARG1), (ARG2), (ARG3), (ARG4), (LOC).file, (LOC).line)
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 9b4e24f..20ce1aa 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1,6 +1,6 @@
/* Expands front end tree to back end RTL for GCC
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
This file is part of GCC.
@@ -260,15 +260,16 @@ n_occurrences (int c, const char *s)
insn is volatile; don't optimize it. */
static void
-expand_asm (tree string, int vol)
+expand_asm_loc (tree string, int vol, location_t locus)
{
rtx body;
if (TREE_CODE (string) == ADDR_EXPR)
string = TREE_OPERAND (string, 0);
- body = gen_rtx_ASM_INPUT (VOIDmode,
- ggc_strdup (TREE_STRING_POINTER (string)));
+ body = gen_rtx_ASM_INPUT_loc (VOIDmode,
+ ggc_strdup (TREE_STRING_POINTER (string)),
+ locus);
MEM_VOLATILE_P (body) = vol;
@@ -1094,7 +1095,7 @@ expand_asm_expr (tree exp)
if (ASM_INPUT_P (exp))
{
- expand_asm (ASM_STRING (exp), ASM_VOLATILE_P (exp));
+ expand_asm_loc (ASM_STRING (exp), ASM_VOLATILE_P (exp), input_location);
return;
}