diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2019-04-13 05:55:34 -0300 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-04-25 08:35:13 +0930 |
commit | 38c3873e5d53902cf9cc73a4a5a05adf371296a6 (patch) | |
tree | c833fb3857be146bd9f1085b943b3a5acc31b842 /gas/frags.h | |
parent | 1670072efb31e82d52d408940062860e2835d79c (diff) | |
download | gdb-38c3873e5d53902cf9cc73a4a5a05adf371296a6.zip gdb-38c3873e5d53902cf9cc73a4a5a05adf371296a6.tar.gz gdb-38c3873e5d53902cf9cc73a4a5a05adf371296a6.tar.bz2 |
Speed up locview resolution with relaxable frags
Targets such as xtensa incur a much higher overhead to resolve
location view numbers than e.g. x86, because the expressions used to
compute view numbers cannot be resolved soon enough.
Each view number is computed by incrementing the previous view, if
they are both at the same address, or by resetting it to zero
otherwise. If PV is the previous view number, PL is its location, and
NL is the location of the next view, its number is computed by
evaluating NV = !(NL > PL) * (PV + 1).
set_or_check_view uses resolve_expression to decide whether portions
of this expression can be simplified to constants. The (NL > PL)
subexpression is one that can often be resolved to a constant,
breaking chains of view number computations at instructions of nonzero
length, but not after alignment that might be unnecessary.
Alas, when nearly every frag ends with a relaxable instruction,
frag_offset_fixed_p will correctly fail to determine a known offset
between two unresolved addresses in neighboring frags, so the
unresolved symbolic operation will be constructed and used in the
computation of most view numbers. This results in very deep
expressions.
As view numbers get referenced in location view lists, each operand in
the list goes through symbol_clone_if_forward_ref, which recurses on
every subexpression. If each view number were to be referenced, this
would exhibit O(n^2) behavior, where n is the depth of the view number
expressions, i.e., the length of view number sequences without an
early resolution that cuts the expression short.
This patch enables address compares used by view numbering to be
resolved even when exact offsets are not known, using new logic to
determine when the location either remained the same or changed for
sure, even with the possibility of relaxation. This enables most view
number expressions to be resolved with a small, reasonable depth.
PR gas/24444
* frags.c (frag_gtoffset_p): New.
* frags.h (frag_gtoffset_p): Declare it.
* expr.c (resolve_expression): Use it.
Diffstat (limited to 'gas/frags.h')
-rw-r--r-- | gas/frags.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gas/frags.h b/gas/frags.h index 741ae2b..6d84aaa 100644 --- a/gas/frags.h +++ b/gas/frags.h @@ -154,6 +154,8 @@ char *frag_var (relax_stateT type, char *opcode); bfd_boolean frag_offset_fixed_p (const fragS *, const fragS *, offsetT *); +bfd_boolean frag_gtoffset_p (valueT, const fragS *, valueT, const fragS *, + offsetT *); int get_frag_count (void); void clear_frag_count (void); |