aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ia64.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/config/tc-ia64.c')
-rw-r--r--gas/config/tc-ia64.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 517b6d3..49fa4cd 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -5664,7 +5664,9 @@ IA-64 options:\n\
stream);
}
-static inline int
+/* Return true if TYPE fits in TEMPL at SLOT. */
+
+static int
match (int templ, int type, int slot)
{
enum ia64_unit unit;
@@ -5687,6 +5689,19 @@ match (int templ, int type, int slot)
return result;
}
+/* Add a bit of extra goodness if a nop of type F or B would fit
+ in TEMPL at SLOT. */
+
+static inline int
+extra_goodness (int templ, int slot)
+{
+ if (match (templ, IA64_TYPE_F, slot))
+ return 2;
+ if (match (templ, IA64_TYPE_B, slot))
+ return 1;
+ return 0;
+}
+
/* This function is called once, at assembler startup time. It sets
up all the tables, etc. that the MD part of the assembler will need
that can be determined before arguments are parsed. */
@@ -5739,7 +5754,11 @@ md_begin ()
symbol_new (".<ltoff.fptr>", undefined_section, FUNC_LT_FPTR_RELATIVE,
&zero_address_frag);
- /* compute the table of best templates: */
+ /* Compute the table of best templates. We compute goodness as a
+ base 4 value, in which each match counts for 3, each F counts
+ for 2, each B counts for 1. This should maximize the number of
+ F and B nops in the chosen bundles, which is good because these
+ pipelines are least likely to be overcommitted. */
for (i = 0; i < IA64_NUM_TYPES; ++i)
for (j = 0; j < IA64_NUM_TYPES; ++j)
for (k = 0; k < IA64_NUM_TYPES; ++k)
@@ -5753,24 +5772,28 @@ md_begin ()
if (match (t, j, 1))
{
if (match (t, k, 2))
- goodness = 3;
+ goodness = 3 + 3 + 3;
else
- goodness = 2;
+ goodness = 3 + 3 + extra_goodness (t, 2);
}
else if (match (t, j, 2))
- goodness = 2;
+ goodness = 3 + 3 + extra_goodness (t, 1);
else
- goodness = 1;
+ {
+ goodness = 3;
+ goodness += extra_goodness (t, 1);
+ goodness += extra_goodness (t, 2);
+ }
}
else if (match (t, i, 1))
{
if (match (t, j, 2))
- goodness = 2;
+ goodness = 3 + 3;
else
- goodness = 1;
+ goodness = 3 + extra_goodness (t, 2);
}
else if (match (t, i, 2))
- goodness = 1;
+ goodness = 3 + extra_goodness (t, 1);
if (goodness > best)
{