From cb5301b617b2b8c8d3f8c7c0387ad339647f5d95 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 1 Jan 2002 01:18:17 +0000 Subject: [PATCH] * config/tc-ia64.c (has_suffix_p): New. (note_register_values): Use it instead of strstr. --- gas/ChangeLog | 3 +++ gas/config/tc-ia64.c | 30 +++++++++++++++++++++--------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index d3d8e43..b997270 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -3,6 +3,9 @@ * config/tc-ia64.c (errata_nop_necessary_p): Prototype. (make_unw_section_name): Constify local variables. + * config/tc-ia64.c (has_suffix_p): New. + (note_register_values): Use it instead of strstr. + Mon Dec 31 16:48:07 2001 Jeffrey A Law (law@redhat.com) * config/tc-hppa.c (pa_ip): Handle new 'c' mode completers, diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 4056dc2..fa51977 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -733,6 +733,7 @@ static void add_qp_imply PARAMS((int p1, int p2)); static void clear_qp_branch_flag PARAMS((valueT mask)); static void clear_qp_mutex PARAMS((valueT mask)); static void clear_qp_implies PARAMS((valueT p1_mask, valueT p2_mask)); +static int has_suffix_p PARAMS((const char *, const char *)); static void clear_register_values PARAMS ((void)); static void print_dependency PARAMS ((const char *action, int depind)); static void instruction_serialization PARAMS ((void)); @@ -8630,6 +8631,19 @@ add_qp_mutex (mask) qp_mutexes[qp_mutexeslen++].prmask = mask; } +static int +has_suffix_p (name, suffix) + const char *name; + const char *suffix; +{ + size_t namelen = strlen (name); + size_t sufflen = strlen (suffix); + + if (namelen <= sufflen) + return 0; + return strcmp (name + namelen - sufflen, suffix) == 0; +} + static void clear_register_values () { @@ -8747,21 +8761,19 @@ note_register_values (idesc) } /* In general, clear mutexes and implies which include P1 or P2, with the following exceptions. */ - else if (strstr (idesc->name, ".or.andcm") != NULL) + else if (has_suffix_p (idesc->name, ".or.andcm") + || has_suffix_p (idesc->name, ".and.orcm")) { add_qp_mutex (p1mask | p2mask); clear_qp_implies (p2mask, p1mask); } - else if (strstr (idesc->name, ".and.orcm") != NULL) - { - add_qp_mutex (p1mask | p2mask); - clear_qp_implies (p1mask, p2mask); - } - else if (strstr (idesc->name, ".and") != NULL) + else if (has_suffix_p (idesc->name, ".andcm") + || has_suffix_p (idesc->name, ".and")) { clear_qp_implies (0, p1mask | p2mask); } - else if (strstr (idesc->name, ".or") != NULL) + else if (has_suffix_p (idesc->name, ".orcm") + || has_suffix_p (idesc->name, ".or")) { clear_qp_mutex (p1mask | p2mask); clear_qp_implies (p1mask | p2mask, 0); @@ -8769,7 +8781,7 @@ note_register_values (idesc) else { clear_qp_implies (p1mask | p2mask, p1mask | p2mask); - if (strstr (idesc->name, ".unc") != NULL) + if (has_suffix_p (idesc->name, ".unc")) { add_qp_mutex (p1mask | p2mask); if (CURR_SLOT.qp_regno != 0) -- 2.7.4