aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde@tbsaunde.org>2021-07-12 02:55:17 -0400
committerTrevor Saunders <tbsaunde@tbsaunde.org>2021-07-15 01:10:47 -0400
commit8d76ff99220c7aa428516e93998457dbe299f037 (patch)
treed45fe4868eed25ad00ab6be6167b613c84134ae4
parent329769b72001dcca18a120ab751f58de1b716ff8 (diff)
downloadgcc-8d76ff99220c7aa428516e93998457dbe299f037.zip
gcc-8d76ff99220c7aa428516e93998457dbe299f037.tar.gz
gcc-8d76ff99220c7aa428516e93998457dbe299f037.tar.bz2
pass location to md_asm_adjust
So the hook can use it as the location of diagnostics. gcc/ChangeLog: * cfgexpand.c (expand_asm_loc): Adjust. (expand_asm_stmt): Likewise. * config/arm/aarch-common-protos.h (arm_md_asm_adjust): Likewise. * config/arm/aarch-common.c (arm_md_asm_adjust): Likewise. * config/arm/arm.c (thumb1_md_asm_adjust): Likewise. * config/avr/avr.c (avr_md_asm_adjust): Likewise. * config/cris/cris.c (cris_md_asm_adjust): Likewise. * config/i386/i386.c (ix86_md_asm_adjust): Likewise. * config/mn10300/mn10300.c (mn10300_md_asm_adjust): Likewise. * config/nds32/nds32.c (nds32_md_asm_adjust): Likewise. * config/pdp11/pdp11.c (pdp11_md_asm_adjust): Likewise. * config/rs6000/rs6000.c (rs6000_md_asm_adjust): Likewise. * config/s390/s390.c (s390_md_asm_adjust): Likewise. * config/vax/vax.c (vax_md_asm_adjust): Likewise. * config/visium/visium.c (visium_md_asm_adjust): Likewise. * doc/tm.texi: Regenerate. * target.def: Add location argument to md_asm_adjust. Signed-off-by: Trevor Saunders <tbsaunde@tbsaunde.org>
-rw-r--r--gcc/cfgexpand.c9
-rw-r--r--gcc/config/arm/aarch-common-protos.h3
-rw-r--r--gcc/config/arm/aarch-common.c8
-rw-r--r--gcc/config/arm/arm.c4
-rw-r--r--gcc/config/avr/avr.c3
-rw-r--r--gcc/config/cris/cris.c4
-rw-r--r--gcc/config/i386/i386.c8
-rw-r--r--gcc/config/mn10300/mn10300.c2
-rw-r--r--gcc/config/nds32/nds32.c3
-rw-r--r--gcc/config/pdp11/pdp11.c4
-rw-r--r--gcc/config/rs6000/rs6000.c2
-rw-r--r--gcc/config/s390/s390.c2
-rw-r--r--gcc/config/vax/vax.c5
-rw-r--r--gcc/config/visium/visium.c4
-rw-r--r--gcc/doc/tm.texi5
-rw-r--r--gcc/target.def5
16 files changed, 39 insertions, 32 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 7dd1225..8183280 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2897,7 +2897,8 @@ expand_asm_loc (tree string, int vol, location_t locus)
if (targetm.md_asm_adjust)
targetm.md_asm_adjust (output_rvec, input_rvec, input_mode,
- constraints, clobber_rvec, clobbered_regs);
+ constraints, clobber_rvec, clobbered_regs,
+ locus);
asm_op = body;
nclobbers = clobber_rvec.length ();
@@ -3074,8 +3075,7 @@ expand_asm_stmt (gasm *stmt)
return;
}
- /* There are some legacy diagnostics in here, and also avoids an extra
- parameter to targetm.md_asm_adjust. */
+ /* There are some legacy diagnostics in here. */
save_input_location s_i_l(locus);
unsigned noutputs = gimple_asm_noutputs (stmt);
@@ -3456,7 +3456,8 @@ expand_asm_stmt (gasm *stmt)
if (targetm.md_asm_adjust)
after_md_seq
= targetm.md_asm_adjust (output_rvec, input_rvec, input_mode,
- constraints, clobber_rvec, clobbered_regs);
+ constraints, clobber_rvec, clobbered_regs,
+ locus);
/* Do not allow the hook to change the output and input count,
lest it mess up the operand numbering. */
diff --git a/gcc/config/arm/aarch-common-protos.h b/gcc/config/arm/aarch-common-protos.h
index b6171e8..6be5fb1 100644
--- a/gcc/config/arm/aarch-common-protos.h
+++ b/gcc/config/arm/aarch-common-protos.h
@@ -147,6 +147,7 @@ struct cpu_cost_table
rtx_insn *arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> &constraints,
- vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs);
+ vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs,
+ location_t loc);
#endif /* GCC_AARCH_COMMON_PROTOS_H */
diff --git a/gcc/config/arm/aarch-common.c b/gcc/config/arm/aarch-common.c
index 0dbdc56..67343fe 100644
--- a/gcc/config/arm/aarch-common.c
+++ b/gcc/config/arm/aarch-common.c
@@ -534,7 +534,7 @@ rtx_insn *
arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> &constraints, vec<rtx> & /*clobbers*/,
- HARD_REG_SET & /*clobbered_regs*/)
+ HARD_REG_SET & /*clobbered_regs*/, location_t loc)
{
bool saw_asm_flag = false;
@@ -547,7 +547,7 @@ arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
con += 4;
if (strchr (con, ',') != NULL)
{
- error ("alternatives not allowed in %<asm%> flag output");
+ error_at (loc, "alternatives not allowed in %<asm%> flag output");
continue;
}
@@ -608,7 +608,7 @@ arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
mode = CC_Vmode, code = NE;
break;
default:
- error ("unknown %<asm%> flag output %qs", constraints[i]);
+ error_at (loc, "unknown %<asm%> flag output %qs", constraints[i]);
continue;
}
@@ -618,7 +618,7 @@ arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
machine_mode dest_mode = GET_MODE (dest);
if (!SCALAR_INT_MODE_P (dest_mode))
{
- error ("invalid type for %<asm%> flag output");
+ error_at (loc, "invalid type for %<asm%> flag output");
continue;
}
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index de37c90..6d781e2 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -333,7 +333,7 @@ static HOST_WIDE_INT arm_constant_alignment (const_tree, HOST_WIDE_INT);
static rtx_insn *thumb1_md_asm_adjust (vec<rtx> &, vec<rtx> &,
vec<machine_mode> &,
vec<const char *> &, vec<rtx> &,
- HARD_REG_SET &);
+ HARD_REG_SET &, location_t);
/* Table of machine attributes. */
static const struct attribute_spec arm_attribute_table[] =
@@ -34105,7 +34105,7 @@ rtx_insn *
thumb1_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> &constraints, vec<rtx> & /*clobbers*/,
- HARD_REG_SET & /*clobbered_regs*/)
+ HARD_REG_SET & /*clobbered_regs*/, location_t /*loc*/)
{
for (unsigned i = 0, n = outputs.length (); i < n; ++i)
if (startswith (constraints[i], "=@cc"))
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index c95c436..200701a 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -14498,7 +14498,8 @@ static rtx_insn *
avr_md_asm_adjust (vec<rtx> &/*outputs*/, vec<rtx> &/*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> &/*constraints*/,
- vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs)
+ vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs,
+ location_t /*loc*/)
{
clobbers.safe_push (cc_reg_rtx);
SET_HARD_REG_BIT (clobbered_regs, REG_CC);
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index d9213d7..f458ea0 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -151,7 +151,7 @@ static void cris_function_arg_advance (cumulative_args_t,
const function_arg_info &);
static rtx_insn *cris_md_asm_adjust (vec<rtx> &, vec<rtx> &,
vec<machine_mode> &, vec<const char *> &,
- vec<rtx> &, HARD_REG_SET &);
+ vec<rtx> &, HARD_REG_SET &, location_t);
static void cris_option_override (void);
@@ -3507,7 +3507,7 @@ static rtx_insn *
cris_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &inputs,
vec<machine_mode> & /*input_modes*/,
vec<const char *> &constraints, vec<rtx> &clobbers,
- HARD_REG_SET &clobbered_regs)
+ HARD_REG_SET &clobbered_regs, location_t /*loc*/)
{
/* For the time being, all asms clobber condition codes.
Revisit when there's a reasonable use for inputs/outputs
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index cff2690..530d357 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -21596,7 +21596,7 @@ static rtx_insn *
ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> &constraints, vec<rtx> &clobbers,
- HARD_REG_SET &clobbered_regs)
+ HARD_REG_SET &clobbered_regs, location_t loc)
{
bool saw_asm_flag = false;
@@ -21609,7 +21609,7 @@ ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
con += 4;
if (strchr (con, ',') != NULL)
{
- error ("alternatives not allowed in %<asm%> flag output");
+ error_at (loc, "alternatives not allowed in %<asm%> flag output");
continue;
}
@@ -21673,7 +21673,7 @@ ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
}
if (code == UNKNOWN)
{
- error ("unknown %<asm%> flag output %qs", constraints[i]);
+ error_at (loc, "unknown %<asm%> flag output %qs", constraints[i]);
continue;
}
if (invert)
@@ -21702,7 +21702,7 @@ ix86_md_asm_adjust (vec<rtx> &outputs, vec<rtx> & /*inputs*/,
machine_mode dest_mode = GET_MODE (dest);
if (!SCALAR_INT_MODE_P (dest_mode))
{
- error ("invalid type for %<asm%> flag output");
+ error_at (loc, "invalid type for %<asm%> flag output");
continue;
}
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index c1c2e6e..6f842a3 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -2850,7 +2850,7 @@ static rtx_insn *
mn10300_md_asm_adjust (vec<rtx> & /*outputs*/, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> & /*constraints*/, vec<rtx> &clobbers,
- HARD_REG_SET &clobbered_regs)
+ HARD_REG_SET &clobbered_regs, location_t /*loc*/)
{
clobbers.safe_push (gen_rtx_REG (CCmode, CC_REG));
SET_HARD_REG_BIT (clobbered_regs, CC_REG);
diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c
index 7217d78..2c9cfcf 100644
--- a/gcc/config/nds32/nds32.c
+++ b/gcc/config/nds32/nds32.c
@@ -4199,7 +4199,8 @@ nds32_md_asm_adjust (vec<rtx> &outputs ATTRIBUTE_UNUSED,
vec<rtx> &inputs ATTRIBUTE_UNUSED,
vec<machine_mode> &input_modes ATTRIBUTE_UNUSED,
vec<const char *> &constraints ATTRIBUTE_UNUSED,
- vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs)
+ vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs,
+ location_t /*loc*/)
{
if (!flag_inline_asm_r15)
{
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index 4cab3ae..ced6531 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -156,7 +156,7 @@ static int pdp11_addr_cost (rtx, machine_mode, addr_space_t, bool);
static int pdp11_insn_cost (rtx_insn *insn, bool speed);
static rtx_insn *pdp11_md_asm_adjust (vec<rtx> &, vec<rtx> &,
vec<machine_mode> &, vec<const char *> &,
- vec<rtx> &, HARD_REG_SET &);
+ vec<rtx> &, HARD_REG_SET &, location_t);
static bool pdp11_return_in_memory (const_tree, const_tree);
static rtx pdp11_function_value (const_tree, const_tree, bool);
static rtx pdp11_libcall_value (machine_mode, const_rtx);
@@ -2139,7 +2139,7 @@ static rtx_insn *
pdp11_md_asm_adjust (vec<rtx> & /*outputs*/, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> & /*constraints*/, vec<rtx> &clobbers,
- HARD_REG_SET &clobbered_regs)
+ HARD_REG_SET &clobbered_regs, location_t /*loc*/)
{
clobbers.safe_push (gen_rtx_REG (CCmode, CC_REGNUM));
SET_HARD_REG_BIT (clobbered_regs, CC_REGNUM);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index ce29b37..779de95 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -3444,7 +3444,7 @@ static rtx_insn *
rs6000_md_asm_adjust (vec<rtx> & /*outputs*/, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> & /*constraints*/, vec<rtx> &clobbers,
- HARD_REG_SET &clobbered_regs)
+ HARD_REG_SET &clobbered_regs, location_t /*loc*/)
{
clobbers.safe_push (gen_rtx_REG (SImode, CA_REGNO));
SET_HARD_REG_BIT (clobbered_regs, CA_REGNO);
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 590dd8f..800e0ab 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -16771,7 +16771,7 @@ static rtx_insn *
s390_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &inputs,
vec<machine_mode> &input_modes,
vec<const char *> &constraints, vec<rtx> & /*clobbers*/,
- HARD_REG_SET & /*clobbered_regs*/)
+ HARD_REG_SET & /*clobbered_regs*/, location_t /*loc*/)
{
if (!TARGET_VXE)
/* Long doubles are stored in FPR pairs - nothing to do. */
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 3aacd1e..e26ab3b 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -57,7 +57,7 @@ static bool vax_rtx_costs (rtx, machine_mode, int, int, int *, bool);
static machine_mode vax_cc_modes_compatible (machine_mode, machine_mode);
static rtx_insn *vax_md_asm_adjust (vec<rtx> &, vec<rtx> &,
vec<machine_mode> &, vec<const char *> &,
- vec<rtx> &, HARD_REG_SET &);
+ vec<rtx> &, HARD_REG_SET &, location_t);
static rtx vax_function_arg (cumulative_args_t, const function_arg_info &);
static void vax_function_arg_advance (cumulative_args_t,
const function_arg_info &);
@@ -1181,7 +1181,8 @@ vax_md_asm_adjust (vec<rtx> &outputs ATTRIBUTE_UNUSED,
vec<rtx> &inputs ATTRIBUTE_UNUSED,
vec<machine_mode> &input_modes ATTRIBUTE_UNUSED,
vec<const char *> &constraints ATTRIBUTE_UNUSED,
- vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs)
+ vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs,
+ location_t /*loc*/)
{
clobbers.safe_push (gen_rtx_REG (CCmode, VAX_PSL_REGNUM));
SET_HARD_REG_BIT (clobbered_regs, VAX_PSL_REGNUM);
diff --git a/gcc/config/visium/visium.c b/gcc/config/visium/visium.c
index 7eb2248..58e5355 100644
--- a/gcc/config/visium/visium.c
+++ b/gcc/config/visium/visium.c
@@ -190,7 +190,7 @@ static tree visium_build_builtin_va_list (void);
static rtx_insn *visium_md_asm_adjust (vec<rtx> &, vec<rtx> &,
vec<machine_mode> &,
vec<const char *> &, vec<rtx> &,
- HARD_REG_SET &);
+ HARD_REG_SET &, location_t);
static bool visium_legitimate_constant_p (machine_mode, rtx);
@@ -795,7 +795,7 @@ static rtx_insn *
visium_md_asm_adjust (vec<rtx> & /*outputs*/, vec<rtx> & /*inputs*/,
vec<machine_mode> & /*input_modes*/,
vec<const char *> & /*constraints*/, vec<rtx> &clobbers,
- HARD_REG_SET &clobbered_regs)
+ HARD_REG_SET &clobbered_regs, location_t /*loc*/)
{
clobbers.safe_push (gen_rtx_REG (CCmode, FLAGS_REGNUM));
SET_HARD_REG_BIT (clobbered_regs, FLAGS_REGNUM);
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 2a41ae5..3ad3944 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -11708,11 +11708,12 @@ from shared libraries (DLLs).
You need not define this macro if it would always evaluate to zero.
@end defmac
-@deftypefn {Target Hook} {rtx_insn *} TARGET_MD_ASM_ADJUST (vec<rtx>& @var{outputs}, vec<rtx>& @var{inputs}, vec<machine_mode>& @var{input_modes}, vec<const char *>& @var{constraints}, vec<rtx>& @var{clobbers}, HARD_REG_SET& @var{clobbered_regs})
+@deftypefn {Target Hook} {rtx_insn *} TARGET_MD_ASM_ADJUST (vec<rtx>& @var{outputs}, vec<rtx>& @var{inputs}, vec<machine_mode>& @var{input_modes}, vec<const char *>& @var{constraints}, vec<rtx>& @var{clobbers}, HARD_REG_SET& @var{clobbered_regs}, location_t @var{loc})
This target hook may add @dfn{clobbers} to @var{clobbers} and
@var{clobbered_regs} for any hard regs the port wishes to automatically
clobber for an asm. The @var{outputs} and @var{inputs} may be inspected
-to avoid clobbering a register that is already used by the asm.
+to avoid clobbering a register that is already used by the asm. @var{loc}
+is the source location of the asm.
It may modify the @var{outputs}, @var{inputs}, @var{input_modes}, and
@var{constraints} as necessary for other pre-processing. In this case the
diff --git a/gcc/target.def b/gcc/target.def
index c009671..2e40448 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -4226,7 +4226,8 @@ DEFHOOK
"This target hook may add @dfn{clobbers} to @var{clobbers} and\n\
@var{clobbered_regs} for any hard regs the port wishes to automatically\n\
clobber for an asm. The @var{outputs} and @var{inputs} may be inspected\n\
-to avoid clobbering a register that is already used by the asm.\n\
+to avoid clobbering a register that is already used by the asm. @var{loc}\n\
+is the source location of the asm.\n\
\n\
It may modify the @var{outputs}, @var{inputs}, @var{input_modes}, and\n\
@var{constraints} as necessary for other pre-processing. In this case the\n\
@@ -4236,7 +4237,7 @@ to @var{input_modes}.",
rtx_insn *,
(vec<rtx>& outputs, vec<rtx>& inputs, vec<machine_mode>& input_modes,
vec<const char *>& constraints, vec<rtx>& clobbers,
- HARD_REG_SET& clobbered_regs),
+ HARD_REG_SET& clobbered_regs, location_t loc),
NULL)
/* This target hook allows the backend to specify a calling convention