GCC Middle and Back End API Reference
|
Data Structures | |
struct | insn_def |
struct | insn_ent |
struct | attr_value |
struct | attr_desc |
struct | delay_desc |
struct | attr_value_list |
struct | attr_hash |
struct | insn_reserv |
struct | bypass_list |
Functions | |
static char * | attr_string (const char *, int) |
static char * | attr_printf (unsigned int, const char *,...) ATTRIBUTE_PRINTF_2 |
static rtx | make_numeric_value (int) |
static struct attr_desc * | find_attr (const char **, int) |
static rtx | mk_attr_alt (int) |
static char * | next_comma_elt (const char **) |
static rtx | insert_right_side (enum rtx_code, rtx, rtx, int, int) |
static rtx | copy_boolean (rtx) |
static int | compares_alternatives_p (rtx) |
static void | make_internal_attr (const char *, rtx, int) |
static void | insert_insn_ent (struct attr_value *, struct insn_ent *) |
static void | walk_attr_value (rtx) |
static int | max_attr_value (rtx, int *) |
static int | min_attr_value (rtx, int *) |
static int | or_attr_value (rtx, int *) |
static rtx | simplify_test_exp (rtx, int, int) |
static rtx | simplify_test_exp_in_temp (rtx, int, int) |
static rtx | copy_rtx_unchanging (rtx) |
static bool | attr_alt_subset_p (rtx, rtx) |
static bool | attr_alt_subset_of_compl_p (rtx, rtx) |
static void | clear_struct_flag (rtx) |
static void | write_attr_valueq (FILE *, struct attr_desc *, const char *) |
static struct attr_value * | find_most_used (struct attr_desc *) |
static void | write_attr_set (FILE *, struct attr_desc *, int, rtx, const char *, const char *, rtx, int, int, unsigned int) |
static void | write_attr_case (FILE *, struct attr_desc *, struct attr_value *, int, const char *, const char *, int, rtx) |
static void | write_attr_value (FILE *, struct attr_desc *, rtx) |
static void | write_upcase (FILE *, const char *) |
static void | write_indent (FILE *, int) |
static rtx | identity_fn (rtx) |
static rtx | zero_fn (rtx) |
static rtx | one_fn (rtx) |
static rtx | max_fn (rtx) |
static rtx | min_fn (rtx) |
static void | attr_hash_add_rtx () |
static void | attr_hash_add_string () |
static rtx | attr_rtx_1 () |
static rtx | attr_rtx () |
static char * | attr_printf () |
static rtx | attr_eq () |
static const char * | attr_numeral () |
static char * | attr_string () |
static int | attr_equal_p () |
static rtx | attr_copy_rtx () |
static rtx | check_attr_test () |
static rtx | check_attr_value () |
static rtx | convert_set_attr_alternative () |
static rtx | convert_set_attr () |
static void | check_defs () |
static rtx | make_canonical () |
static rtx | copy_boolean () |
static struct attr_value * | get_attr_value () |
static void | expand_delays () |
static void | fill_attr () |
static rtx | substitute_address (rtx exp, rtx(*no_address_fn)(rtx), rtx(*address_fn)(rtx)) |
static void | make_length_attrs () |
static rtx | identity_fn () |
static rtx | zero_fn () |
static rtx | one_fn () |
static rtx | max_fn () |
static rtx | min_fn () |
static void | write_length_unit_log () |
static int | attr_rtx_cost () |
static rtx | simplify_cond () |
static void | remove_insn_ent () |
static void | insert_insn_ent () |
static rtx | insert_right_side () |
static int | compute_alternative_mask () |
static rtx | make_alternative_compare () |
static rtx | evaluate_eq_attr (rtx exp, struct attr_desc *attr, rtx value, int insn_code, int insn_index) |
static rtx | simplify_and_tree () |
static rtx | simplify_or_tree () |
static rtx | simplify_test_exp_in_temp () |
static bool | attr_alt_subset_p () |
static bool | attr_alt_subset_of_compl_p () |
static rtx | attr_alt_intersection () |
static rtx | attr_alt_union () |
static rtx | attr_alt_complement () |
static rtx | mk_attr_alt () |
static rtx | simplify_test_exp () |
static int | tests_attr_p () |
static int | get_attr_order () |
static void | optimize_attrs () |
static void | clear_struct_flag () |
static void | add_attr_value () |
static void | gen_attr () |
static int | count_alternatives () |
static int | compares_alternatives_p () |
static void | gen_insn () |
static void | gen_delay () |
static void | find_attrs_to_cache () |
static unsigned int | write_test_expr () |
static int | max_attr_value () |
static int | min_attr_value () |
static int | or_attr_value () |
static void | walk_attr_value () |
static void | write_attr_get () |
static rtx | eliminate_known_true () |
static void | write_insn_cases () |
static void | write_attr_valueq () |
static void | write_attr_value () |
static void | write_upcase () |
static void | write_indent () |
static void | write_eligible_delay () |
static char * | next_comma_elt () |
static struct attr_desc * | find_attr () |
static void | make_internal_attr () |
static struct attr_value * | find_most_used () |
static rtx | make_numeric_value () |
static rtx | copy_rtx_unchanging () |
static void | write_const_num_delay_slots () |
static void | gen_insn_reserv () |
static void | gen_bypass_1 () |
static void | gen_bypass () |
static void | process_bypasses () |
static bool | check_tune_attr () |
static struct attr_desc * | find_tune_attr () |
static void | make_automaton_attrs () |
static void | write_header () |
static FILE * | open_outfile () |
static bool | handle_arg () |
int | main () |
Variables | |
static struct obstack obstack1 | obstack2 |
static struct obstack * | hash_obstack = &obstack1 |
static struct obstack * | temp_obstack = &obstack2 |
static struct attr_desc * | attrs [MAX_ATTRS_INDEX] |
static struct insn_def * | defs |
static struct delay_desc * | delays |
struct attr_value_list ** | insn_code_values |
static int | insn_code_number |
static int | insn_index_number |
static int | got_define_asm_attributes |
static int | must_extract |
static int | must_constrain |
static int | address_used |
static int | length_used |
static int | num_delays |
static int | have_annul_true |
static int | have_annul_false |
static int | num_insn_ents |
static int * | insn_n_alternatives |
static int * | insn_alternatives |
static rtx | true_rtx |
static rtx | false_rtx |
static const char * | alternative_name |
static const char * | length_str |
static const char * | delay_type_str |
static const char * | delay_1_0_str |
static const char * | num_delay_slots_str |
static const char * | attr_file_name = NULL |
static const char * | dfa_file_name = NULL |
static const char * | latency_file_name = NULL |
static FILE * | attr_file |
static FILE * | dfa_file |
static FILE * | latency_file |
static struct attr_hash * | attr_hash_table [RTL_HASH_SIZE] |
static const char * | cached_attrs [32] |
static int | cached_attr_count |
static unsigned int | attrs_seen_once |
static unsigned int | attrs_seen_more_than_once |
static unsigned int | attrs_to_cache |
static unsigned int | attrs_cached_inside |
static unsigned int | attrs_cached_after |
static struct insn_reserv * | all_insn_reservs = 0 |
static struct insn_reserv ** | last_insn_reserv_p = &all_insn_reservs |
static size_t | n_insn_reservs |
static struct bypass_list * | all_bypasses |
static size_t | n_bypasses |
|
static |
Add attribute value NAME to the beginning of ATTR's list.
References count_alternatives(), insn_def::def, defs, exp(), insn_code_number, insn_index_number, insn_def::lineno, and insn_def::num_alternatives.
|
static |
Return EQ_ATTR_ALT expression representing complement of S.
References compute_alternative_mask(), fatal(), and insn_alternatives.
|
static |
Return EQ_ATTR_ALT expression representing intersection of S1 and S2.
|
static |
|
static |
Returns true if S1 is a subset of S2.
|
static |
Return EQ_ATTR_ALT expression representing union of S1 and S2.
|
static |
Copy an attribute value expression, descending to all depths, but not copying any permanent hashed subexpressions.
No need to copy a permanent object.
References rtvec_alloc().
Referenced by get_attr_order().
|
static |
|
static |
Check two rtx's for equality of contents, taking advantage of the fact that if both are hashed then they can't be equal unless they are the same object.
|
static |
Add an entry to the hash table for RTL with hash code HASHCODE.
References attr_hash::hashcode.
|
static |
Add an entry to the hash table for STRING with hash code HASHCODE.
References attr_hash::hashcode, HOST_WIDE_INT, attr_hash::next, attr_hash::rtl, and attr_hash::u.
|
static |
|
static |
|
static |
Create a new string printed with the printf line arguments into a space of at most LEN bytes: rtx attr_printf (len, format, [arg1, ..., argn])
References attr_hash::hashcode, len, and attr_hash::next.
|
static |
Referenced by compute_alternative_mask(), mk_attr_alt(), and walk_attr_value().
|
static |
Generate an RTL expression, but avoid duplicates. Set the ATTR_PERMANENT_P flag for these permanent objects. In some cases we cannot uniquify; then we return an ordinary impermanent rtx with ATTR_PERMANENT_P clear. Args are as follows: rtx attr_rtx (code, [element1, ..., elementn])
For each of several cases, search the hash table for an existing entry. Use that entry if one is found; otherwise create a new RTL and add it to the table.
A permanent object cannot point to impermanent ones.
A permanent object cannot point to impermanent ones.
References hash_obstack, and rtl_obstack.
|
static |
Compute approximate cost of the expression. Used to decide whether expression is cheap enough for inline.
Alternatives don't result into function call.
Referenced by get_attr_order(), and max_fn().
|
static |
Forward declarations of functions used before their definitions, only.
|
static |
Return a permanent (possibly shared) copy of a string STR (not assumed to be null terminated) with LEN bytes.
Compute the hash code.
Search the table for the string.
Not found; create a permanent copy and add it to the hash table.
References rtx_equal_p().
|
static |
Given a test expression for an attribute, ensure it is validly formed. IS_CONST indicates whether the expression is constant for each compiler run (a constant expression may not test any particular insn). Convert (eq_attr "att" "a1,a2") to (ior (eq_attr ... ) (eq_attrq ..)) and (eq_attr "att" "!a1") to (not (eq_attr "att" "a1")). Do the latter test first so that (eq_attr "att" "!a1,a2,a3") works as expected. Update the string address in EQ_ATTR expression to be the same used in the attribute (or `alternative_name') to speed up subsequent `find_attr' calls and eliminate most `strcmp' calls. Return the new expression, if any.
Handle negation test.
Copy this just to make it permanent, so expressions using it can be permanent too.
It shouldn't be possible to simplify the value given to a constant attribute, so don't expand this until it's time to write the test expression.
Make an IOR tree of the possible values.
Either TRUE or FALSE.
These cases can't be simplified.
These cases can't be simplified.
These cases are valid for constant attributes, but can't be simplified.
References fatal().
|
static |
Given an expression, ensure that it is validly formed and that all named attribute values are valid for the given attribute. Issue a fatal error if not. If no attribute is specified, assume a numeric attribute. Return a perhaps modified replacement expression for the value.
Fall through.
A constant SYMBOL_REF is valid as a constant attribute test and is expanded later by make_canonical into a COND. In a non-constant attribute test, it is left be.
Referenced by check_defs().
|
static |
Scan all definitions, checking for validity. Also, convert any SET_ATTR and SET_ATTR_ALTERNATIVE expressions to the corresponding SET expressions.
References check_attr_value(), copy_boolean(), attr_desc::default_val, fatal(), attr_desc::is_const, make_canonical(), make_numeric_value(), rtvec_alloc(), and attr_value::value.
|
static |
Check that attribute NAME is used in define_insn_reservation condition EXP. Return true if it is.
References insn_reserv::condexp, insn_reserv::default_latency, insn_reserv::insn_num, and make_numeric_value().
|
static |
Referenced by get_attr_order(), and optimize_attrs().
|
static |
Clear the ATTR_CURR_SIMPLIFIED_P flag in EXP and its subexpressions.
Compare the elements. If any pair of corresponding elements fail to match, return 0 for the whole things.
|
static |
|
static |
Returns nonzero if the given expression contains an EQ_ATTR with the `alternative' attribute.
|
static |
If we have an expression which AND's a bunch of (not (eq_attrq "alternative" "n")) terms, we may have covered all or all but one of the possible alternatives. If so, we can optimize. Similarly for IOR's of EQ_ATTR. This routine is passed an expression and either AND or IOR. It returns a bitmask indicating which alternatives are mentioned within EXP.
References attr_rtx(), attr_desc::enum_name, and attr_desc::name.
Referenced by attr_alt_complement().
|
static |
Given a SET_ATTR, convert to the appropriate SET. If a comma-separated list of values is given, convert to SET_ATTR_ALTERNATIVE first.
See how many alternative specified.
Process each comma-separated name.
|
static |
Given an SET_ATTR_ALTERNATIVE expression, convert to the canonical SET. It becomes a COND with each test being (eq_attr "alternative" "n")
Make a COND with all tests but the last. Select the last value via the default.
Referenced by check_defs().
|
static |
References make_numeric_value(), delay_desc::next, num_delays, and rtvec_alloc().
|
static |
|
static |
Given a pattern for DEFINE_PEEPHOLE or DEFINE_INSN, return the number of alternatives in the constraints. Assume all MATCH_OPERANDs have the same number of alternatives as this should be checked elsewhere.
References alternative_name, cached_attr_count, find_attr(), and find_attrs_to_cache().
Referenced by add_attr_value().
|
static |
Given an AND tree of known true terms (because we are inside an `if' with that as the condition or are in an `else' clause) and an expression, replace any known true terms with TRUE. Use `simplify_and_tree' to do the bulk of the work.
Referenced by walk_attr_value().
|
static |
If we are processing an (eq_attr "attr" "value") test, we find the value of "attr" for this insn code. From that value, we can compute a test showing when the EQ_ATTR will be true. This routine performs that computation. If a test condition involves an address, we leave the EQ_ATTR intact because addresses are only valid for the `length' attribute. EXP is the EQ_ATTR expression and ATTR is the attribute to which it refers. VALUE is the value of that attribute for the insn corresponding to INSN_CODE and INSN_INDEX.
We construct an IOR of all the cases for which the requested attribute value is present. Since we start with FALSE, if it is not present, FALSE will be returned. Each case is the AND of the NOT's of the previous conditions with the current condition; in the default case the current condition is TRUE. For each possible COND value, call ourselves recursively. The extra TRUE and FALSE expressions will be eliminated by another call to the simplification routine.
Add this condition into the AND expression.
Handle the default case.
If uses an address, must return original expression. But set the ATTR_IND_SIMPLIFIED_P bit so we don't try to simplify it again.
|
static |
After all DEFINE_DELAYs have been read in, create internal attributes to generate the required routines. First, we compute the number of delay slots for each insn (as a COND of each of the test expressions in DEFINE_DELAYs). Then, if more than one delay type is specified, we compute a similar function giving the DEFINE_DELAY ordinal for each insn. Finally, for each [DEFINE_DELAY, slot #] pair, we compute an attribute that tells whether a given insn can be in that delay slot. Normal attribute filling and optimization expands these to contain the information needed to handle delay slots.
First, generate data for `num_delay_slots' function.
If more than one delay type, do the same for computing the delay type.
For each delay possibility and delay slot, compute an eligibility attribute for non-annulled insns and for each type of annulled (annul if true and annul if false).
|
static |
Once all attributes and insns have been read and checked, we construct for each attribute value a list of all the insns that have that value for the attribute.
Don't fill constant attributes. The value is independent of any particular insn.
If no value is specified for this insn for this attribute, use the default.
|
staticread |
Referenced by count_alternatives(), and substitute_address().
|
staticread |
Return a `struct attr_desc' pointer for a given named attribute. If CREATE is nonzero, build a new attribute, if one does not exist. *NAME_P is replaced by a pointer to a canonical copy of the string.
Before we resort to using `strcmp', see if the string address matches anywhere. In most cases, it should have been canonicalized to do so.
Otherwise, do it the slow way.
References gen_bypass_1().
|
static |
Finds non-const attributes that could be possibly cached. When create is TRUE, fills in cached_attrs array. Computes ATTRS_SEEN_ONCE and ATTRS_SEEN_MORE_THAN_ONCE bitmasks.
Referenced by count_alternatives(), and walk_attr_value().
|
staticread |
|
staticread |
Find the most used value of an attribute.
|
staticread |
Try to find a const attribute (usually cpu or tune) that is used in all define_insn_reservation conditions.
References insn_reserv::condexp, and make_numeric_value().
|
static |
Create table entries for DEFINE_ATTR or DEFINE_ENUM_ATTR.
Make a new attribute structure. Check for duplicate by looking at attr->default_val, since it is initialized by this routine.
Get rid of the CONST node. It is allowed only at top-level.
Set up the default value.
|
static |
|
static |
Referenced by find_attr().
|
static |
Process a DEFINE_DELAY. Validate the vector length, check if annul true or annul false is specified, and make a `struct delay_desc'.
|
static |
Process DEFINE_PEEPHOLE, DEFINE_INSN, and DEFINE_ASM_ATTRIBUTES.
References comparison_operator(), and write_test_expr().
Referenced by main().
|
static |
Store information from a DEFINE_INSN_RESERVATION for future attribute generation.
|
static |
Calculate a topological sorting of all attributes so that all attributes only depend on attributes in front of it. Place the result in *RET (which is a pointer to an array of attr_desc pointers), and return the size of that array.
We have only few attributes hence we can live with the inner loop being O(n^2), unlike the normal fast variants of topological sorting.
Let's see if I depends on anything interesting.
Something in I depends on K.
Nothing in I depended on anything intersting, so it's done.
References attr_value_list::attr, attr_copy_rtx(), attr_rtx_cost(), attr_value_list::av, clear_struct_flag(), insn_ent::def, get_attr_value(), attr_value_list::ie, insert_insn_ent(), insn_def::insn_code, insn_def::insn_index, attr_value_list::next, obstack, remove_insn_ent(), rtl_obstack, simplify_cond(), temp_obstack, and attr_value::value.
|
staticread |
Given a value and an attribute description, return a `struct attr_value *' that represents that value. This is either an existing structure, if the value has been previously encountered, or a newly-created structure. `insn_code' is the code of an insn whose attribute has the specified value (-2 if not processing an insn). We ensure that all insns for a given value have the same number of alternatives if the value checks alternatives.
References delay_desc::def, and make_numeric_value().
Referenced by get_attr_order(), and substitute_address().
|
static |
Referenced by substitute_address().
|
static |
Utility functions called from above routine.
|
static |
Referenced by get_attr_order(), and substitute_address().
|
static |
Insert an insn entry in an attribute value list.
Referenced by walk_attr_value().
|
static |
This is a utility routine to take an expression that is a tree of either AND or IOR expressions and insert a new term. The new term will be inserted at the right side of the first node whose code does not match the root. A new node will be created with the root's code. Its left side will be the old right side and its right side will be the new term. If the `term' is itself a tree, all its leaves will be inserted.
Avoid consing in some special cases.
Make a copy of this expression and call recursively.
Insert the new term.
int main | ( | ) |
Set up true and false rtx's
Read the machine description.
If we didn't have a DEFINE_ASM_ATTRIBUTES, make a null one.
Expand DEFINE_DELAY information into new attribute.
Make `insn_alternatives'.
Make `insn_n_alternatives'.
Construct extra attributes for automata.
Prepare to write out attribute subroutines by checking everything stored away and building the attribute cases.
Construct extra attributes for `length'.
Perform any possible optimizations to speed up compilation.
Now write out all the `gen_attr_...' routines. Do these before the special routines so that they get defined before they are used.
Write out delay eligibility information, if DEFINE_DELAY present. (The function to compute the number of delay slots will be written below.)
Write out constant delay slot info.
|
static |
Given I, a single-bit mask, return RTX to compare the `alternative' attribute with the value represented by that bit.
Referenced by mk_attr_alt().
|
static |
Create all of the attributes that describe automaton properties. Write the DFA and latency function prototypes to the files that need to have them, and write the init_sched_attrs().
Write the prototypes for all DFA functions.
Write the prototypes for all latency functions.
Write the prototypes for all automaton functions.
|
static |
Given a valid expression for an attribute value, remove any IF_THEN_ELSE expressions by converting them into a COND. This removes cases from this program. Also, replace an attribute value of "*" with the default attribute value.
The SYMBOL_REF is constant for a given run, so mark it as unchanging. This makes the COND something that won't be considered an arbitrary expression by walk_attr_value.
Fall through to COND case since this is now a COND.
First, check for degenerate COND.
Referenced by check_defs().
|
static |
Referenced by substitute_address().
|
static |
Create internal attribute with the given default value.
|
static |
Make new attributes from the `length' attribute. The following are made, each corresponding to a function called from `shorten_branches' or `get_attr_length': *insn_default_length This is the length of the insn to be returned by `get_attr_length' before `shorten_branches' has been called. In each case where the length depends on relative addresses, the largest possible is used. This routine is also used to compute the initial size of the insn. *insn_variable_length_p This returns 1 if the insn's length depends on relative addresses, zero otherwise. *insn_current_length This is only called when it is known that the insn has a variable length and returns the current length, based on relative addresses.
See if length attribute is defined. If so, it must be numeric. Make it special so we don't output anything for it.
Make each new attribute, in turn.
References make_numeric_value(), max_attr_value(), and unknown.
|
static |
Referenced by check_defs(), check_tune_attr(), copy_boolean(), find_tune_attr(), get_attr_value(), and make_length_attrs().
|
static |
Return (attr_value "n")
|
static |
Referenced by make_length_attrs().
|
static |
Given an attribute value, return the maximum CONST_STRING argument encountered. Set *UNKNOWNP and return INT_MAX if the value is unknown.
Referenced by substitute_address().
|
static |
References attr_rtx_cost().
|
static |
|
static |
Given an attribute value, return the minimum CONST_STRING argument encountered. Set *UNKNOWNP and return 0 if the value is unknown.
Referenced by substitute_address().
|
static |
|
static |
|
static |
Return EQ_ATTR_ALT expression representing set containing elements set in E.
References attr_rtx(), make_alternative_compare(), and simplify_and_tree().
|
static |
|
static |
This page contains miscellaneous utility routines.
Given a pointer to a (char *), return a malloc'ed string containing the next comma-separated element. Advance the pointer to after the string scanned, or the end-of-string. Return NULL if at end of string.
Referenced by substitute_address().
|
static |
References gdbhooks::GET_RTX_FORMAT(), and gdbhooks::GET_RTX_LENGTH().
|
static |
|
static |
Optimize the attribute lists by seeing if we can determine conditional values from the known values of other attributes. This will save subroutine calls during the compilation.
For each insn code, make a list of all the insn_ent's for it, for all values for all attributes.
Make 2 extra elements, for "code" values -2 and -1.
Offset the table address so we can index by -2 or -1.
Create the chain of insn*attr values such that we see dependend attributes after their dependencies. As we use a stack via the next pointers start from the end of the topological order.
Sanity check on num_insn_ents.
Process one insn code at a time.
Clear the ATTR_CURR_SIMPLIFIED_P flag everywhere relevant. We use it to mean "already simplified for this insn".
If we created a new value for this instruction, and it's cheaper than the old value, and overall cheap, use that one as specific value for the current instruction. The last test is to avoid exploding the get_attr_ function sizes for no much gain.
References clear_struct_flag().
|
static |
|
static |
Given an attribute value, return the result of ORing together all CONST_STRING arguments encountered. Set *UNKNOWNP and return -1 if the numeric value is not known.
|
static |
Find and mark all of the bypassed insns.
The reservation list is likely to be much longer than the bypass list.
|
static |
Remove an insn entry from an attribute value.
Referenced by get_attr_order().
|
static |
This routine is called when an AND of a term with a tree of AND's is encountered. If the term or its complement is present in the tree, it can be replaced with TRUE or FALSE, respectively. Note that (eq_attr "att" "v1") and (eq_attr "att" "v2") cannot both be true and hence are complementary. There is one special case: If we see (and (not (eq_attr "att" "v1")) (eq_attr "att" "v2")) this can be replaced by (eq_attr "att" "v2"). To do this we need to replace the term, not anything in the AND tree. So we pass a pointer to the term.
For the IOR case, we do the same as above, except that we can only eliminate `term' if both sides of the IOR would do so.
Check for simplifications. Do some extra checking here since this routine is called so many times.
Referenced by mk_attr_alt().
|
static |
Take a COND expression and see if any of the conditions in it can be simplified. If any are known true or known false for the particular insn code, the COND can be further simplified. Also call ourselves on any COND operations that are values of this COND. We do not modify EXP; rather, we make and return a new rtx.
We store the desired contents here, then build a new expression if they don't match EXP.
This lets us free all storage allocated below, if appropriate.
See if default value needs simplification.
Simplify the subexpressions, and see what tests we can get rid of.
Simplify this test.
See if this value may need simplification.
Look for ways to delete or combine this test.
If test is true, make this value the default and discard this + any following tests.
If test is false, discard it and its value.
If this value and the value for the prev test are the same, merge the tests.
Delete this test/value.
If the last test in a COND has the same value as the default value, that test isn't needed.
See if we changed anything.
Referenced by get_attr_order().
|
static |
Similar to `simplify_and_tree', but for IOR trees.
For the AND case, we do the same as above, except that we can only eliminate `term' if both sides of the AND would do so.
|
static |
Given an expression, see if it can be simplified for a particular insn code based on the values of other attributes being tested. This can eliminate nested get_attr_... calls. Note that if an endless recursion is specified in the patterns, the optimization will loop. However, it will do so in precisely the cases where an infinite recursion loop could occur during compilation. It's better that it occurs here!
Don't re-simplify something we already simplified.
If either side is an IOR and we have (eq_attr "alternative" ..") present on both sides, apply the distributive law since this will yield simplifications.
Try with the term on both sides.
See if all or all but one of the insn's alternatives are specified in this tree. Optimize if so.
If all alternatives are excluded, this is false.
If just one excluded, AND a comparison with that one to the front of the tree. The others will be eliminated by optimization. We do not want to do this if the insn has one alternative and we have tested none of them!
Test for simple cases where the distributive law is useful. I.e., convert (ior (and (x) (y)) (and (x) (z))) to (and (x) (ior (y) (z)))
Similarly, convert (ior (and (y) (x)) (and (z) (x))) to (and (ior (y) (z)) (x)) Note that we want the common term to stay at the end.
See if all or all but one of the insn's alternatives are specified in this tree. Optimize if so.
If all alternatives are included, this is true.
If just one excluded, IOR a comparison with that one to the front of the tree. The others will be eliminated by optimization. We do not want to do this if the insn has one alternative and we have tested none of them!
Try to apply De`Morgan's laws.
Look at the value for this insn code in the specified attribute. We normally can replace this comparison with the condition that would give this insn the values being tested for.
We have already simplified this expression. Simplifying it again won't buy anything unless we weren't given a valid insn code to process (i.e., we are canonicalizing something.).
|
static |
Simplify test expression and use temporary obstack in order to avoid memory bloat. Use ATTR_IND_SIMPLIFIED to avoid unnecessary simplifications and avoid unnecessary copying if possible.
Given an expression EXP, see if it is a COND or IF_THEN_ELSE that has a test that checks relative positions of insns (uses MATCH_DUP or PC). If so, replace it with what is obtained by passing the expression to ADDRESS_FN. If not but it is a COND or IF_THEN_ELSE, call this routine recursively on each value (including the default value). Otherwise, return the value returned by NO_ADDRESS_FN applied to EXP.
See if any tests use addresses.
Make a new copy of this COND, replacing each element.
References insn_ent::def, attr_desc::default_val, fatal(), find_attr(), attr_value::first_insn, attr_desc::first_value, get_attr_value(), identity_fn(), insert_insn_ent(), insn_def::insn_code, attr_desc::is_const, attr_desc::is_numeric, attr_desc::is_special, length_str, make_internal_attr(), max_fn(), min_fn(), insn_ent::next, attr_value::next, one_fn(), attr_value::value, and zero_fn().
|
static |
Return 1 if any EQ_ATTR subexpression of P refers to ATTR, otherwise return 0.
|
static |
|
static |
Scan an attribute value, possibly a conditional, and record what actions will be required to do any conditional tests in it. Specifically, set `must_extract' if we need to extract the insn operands `must_constrain' if we must compute `which_alternative' `address_used' if an address expression was used `length_used' if an (eq_attr "length" ...) was used
Since this is an arbitrary expression, it can look at anything. However, constant expressions do not depend on any particular insn.
References attr_rtx(), attrs_cached_after, attrs_seen_more_than_once, attr_desc::default_val, eliminate_known_true(), find_attrs_to_cache(), insert_right_side(), write_indent(), and write_test_expr().
|
static |
Write out the computation for one attribute value.
See what we have to do to output this value.
|
static |
Write out a function to obtain the attribute for a given INSN.
Find the most used attribute value. Handle that as the `default' of the switch we will generate.
Write out start of function, then all values with explicit `case' lines, then a `default', then the value with the most uses.
If the attribute name starts with a star, the remainder is the name of the subroutine to use, instead of `get_attr_...'.
Find attributes that are worth caching in the conditions.
Remove those that aren't worth caching from the array.
|
static |
Write out a series of tests and assignment statements to perform tests and sets of an attribute value. We are passed an indentation amount and prefix and suffix strings to write around each attribute value (e.g., "return" and ";").
Assume the default value will be the default of the COND unless we find an always true expression.
Reset our_known_true after some time to not accumulate too much cruft (slowing down genattrtab).
If the test expression is always true or if the next `known_true' expression is always false, this is the last case, so break out and let this value be the `else' case.
Compute the expression to pass to our recursive call as being known true.
If this is always false, skip it.
|
static |
|
static |
|
static |
Utilities to write in various forms.
|
static |
Determine if an insn has a constant number of delay slots, i.e., the number of delay slots is not a function of the length of the insn.
References attr_desc::default_val, and attr_value::value.
|
static |
Write a subroutine that is given an insn that requires a delay slot, a delay slot ordinal, and a candidate insn. It returns nonzero if the candidate can be placed in the specified delay slot of the insn. We can write as many as three subroutines. `eligible_for_delay' handles normal delay slots, `eligible_for_annul_true' indicates that the specified insn can be annulled if the branch is true, and likewise for `eligible_for_annul_false'. KIND is a string distinguishing these three cases ("delay", "annul_true", or "annul_false").
Compute the maximum number of delay slots required. We use the delay ordinal times this number plus one, plus the slot number as an index into the appropriate predicate to test.
Write function prelude.
Allow dbr_schedule to pass labels, etc. This can happen if try_split converts a compound instruction into a loop.
If more than one delay type, find out which type the delay insn is.
Ensure matched. Otherwise, shouldn't have been called.
If just one type of delay slot, write simple switch.
Write a nested CASE. The first indicates which condition we need to test, and the inner CASE tests the condition.
|
static |
|
static |
Referenced by walk_attr_value().
|
static |
|
static |
Write a series of case statements for every instruction in list IE. INDENT is the amount of indentation to write before each case.
|
static |
|
static |
In order not to worry about operator precedence, surround our part of the expression with parentheses.
Binary operators.
Fall through.
For if (something && (cached_x = get_attr_x (insn)) == X) cached_x is only known to be initialized in then block.
For if (something || (cached_x = get_attr_x (insn)) == X) cached_x is only known to be initialized in else block and else if conditions.
For if ((something || (cached_x = get_attr_x (insn)) == X) && something_else) cached_x is not know to be initialized anywhere.
Special-case (not (eq_attrq "alternative" "x"))
Otherwise, fall through to normal unary operator.
Unary operators.
Comparison test of an attribute with a value. Most of these will have been removed by optimization. Handle "alternative" specially and give error if EQ_ATTR present inside a comparison.
Now is the time to expand the value of a constant attribute.
Comparison test of flags for define_delays.
See if an operand matches a predicate.
If only a mode is given, just ensure the mode matches the operand. If neither a mode nor predicate is given, error.
Constant integer.
A random C expression.
The address of the branch target.
The address of the current insn. We implement this actually as the address of the current insn for backward branches, but the last address of the next insn for forward branches, and both with adjustments that account for the worst-case possible stretching of intervening alignments between this insn and its destination.
Referenced by gen_insn(), and walk_attr_value().
|
static |
|
static |
The argument of TOUPPER should not have side effects.
Referenced by substitute_address().
|
static |
|
static |
|
static |
|
static |
|
static |
Used to reduce calls to `strcmp'
Referenced by count_alternatives().
|
static |
|
static |
This gen* file is unique, in that it writes out multiple files. Before GCC 4.8, insn-attrtab.c was written out containing many large functions and tables. This made insn-attrtab.c _the_ bottle-neck in a parallel build, and even made it impossible to build GCC on machines with relatively small RAM space (PR other/29442). Therefore, the atrribute functions/tables are now written out to three separate files: all "*insn_default_latency" functions go to LATENCY_FILE_NAME, all "*internal_dfa_insn_code" functions go to DFA_FILE_NAME, and the rest goes to ATTR_FILE_NAME.
|
static |
|
static |
Referenced by walk_attr_value().
|
static |
|
static |
Referenced by walk_attr_value().
|
static |
Bitmasks of possibly cached attributes.
|
static |
|
static |
Number of such attributes.
Referenced by count_alternatives().
|
static |
Names of attributes that could be possibly cached.
|
static |
Referenced by add_attr_value(), find_call_stack_args(), and prescan_insns_for_dce().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by attr_alt_subset_of_compl_p(), and find_comparison_args().
|
static |
|
static |
Referenced by attr_rtx_1().
|
static |
|
static |
|
static |
Stores, for each insn code, a bitmap that has bits on for each possible alternative.
Referenced by attr_alt_complement().
|
static |
Other variables.
Referenced by add_attr_value(), likely_spilled_retval_p(), and main().
struct attr_value_list** insn_code_values |
|
static |
Referenced by add_attr_value().
|
static |
Stores, for each insn code, the number of constraint alternatives.
|
static |
|
static |
|
static |
|
static |
Referenced by substitute_address().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Referenced by copy_boolean().
|
static |
|
static |
Referenced by get_attr_order().
|
static |
Used to simplify expressions.
Referenced by find_comparison_args().