2007-04-03 Richard Guenther <rguenther@suse.de>
* genpreds.c (write_insn_constraint_len): Write function
optimized for CONSTRAINT_LEN implementation.
(write_tm_preds_h): Output insn_constraint_len inline and
use it for CONSTRAINT_LEN.
(write_insn_preds_c): Don't output insn_constraint_len.
* doc/md.texi (define_register_constraint): Document multi-letter
constraints shall have the same length if they start with the same
letter.
From-SVN: r123451
Fix bug in constraint-check generator, reported by Rask Ingemann
Lambertsen:
* genpreds.c (add_constraint): Don't remove anything from the
expression here.
(write_tm_constrs_h): Detect whether "op" argument is used, and
mark it ARG_UNUSED if it isn't.
(write_insn_const_int_ok_for_constraint): Skip the part of the
expression that would test whether "op" (which is not available
here) is a CONST_INT.
From-SVN: r117433
* genpreds.c (generate_switch_p): New function.
(add_mode_tests): Push the new mode test down inside an AND expr
if this allows the switch-suitable MATCH_CODE to be near the root.
(write_match_code_switch): New function to write a MATCH_CODE as
a switch statement.
(write_predicate_stmts): New function to write a predicate RTX
expression as a sequence of statements.
(write_one_predicate_function): Use write_predicate_stmts.
(write_tm_constrs_h): Likewise.
From-SVN: r115055
(define_memory_constraint, define_address_constraint): New MD forms.
* gensupport.c (process_rtx): Put define_constraint etc on the
predicate queue.
* genpreds.c (process_define_predicate): Adjust comment. Validate
the name, and call validate_exp to validate the expression.
(mark_mode_tests, write_extract_subexp): Can assume correct input.
(write_predicate_expr): Likewise. NAME argument no longer necessary;
all callers changed.
(validate_exp, needs_variable, struct constraint_data)
(constraints_by_letter_table, first_constraint, last_constraint_ptr)
(FOR_ALL_CONSTRAINTS, generic_constraint_letters, const_int_constraints)
(const_dbl_constraints, constraint_max_namelen)
(have_register_constraints, have_memory_constraints)
(have_address_constraints, have_address_constraints)
(have_extra_constraints, have_const_int_constraints)
(have_const_dbl_constraints, mangle, add_constraint)
(process_define_constraint, process_define_register_constraint)
(write_enum_constraint_num, write_lookup_constraint)
(write_insn_constraint_len, write_regclass_for_constraint)
(write_constraint_satisfied_p, write_insn_const_int_ok_for_constraint)
(write_insn_extra_memory_constraint)
(write_insn_extra_address_constraint)
(write_satisfies_constraint_fns): New.
(write_tm_preds_h): If we have new-style constraint definitions,
prototype the functions generated from them, and define the
old constraint interface (still used by generic code) in terms of
those functions.
(write_insn_preds_c): If we have new-style constraint definitions,
generate all relevant functions from those definitions.
(main): Handle define_constraint etc.
* genoutput.c (struct constraint_data, indep_constraints)
(mdep_constraint_letters, constraints_by_letter_table, note_constraint)
(mdep_constraint_len): New data structures and functions, defined
#ifdef USE_MD_CONSTRAINTS.
(check_constraint_len): Don't define #ifdef USE_MD_CONSTRAINTS.
(validate_insn_alternatives): If USE_MD_CONSTRAINTS is defined,
use new logic to validate operand constraints against constraint
definitions.
(main): Process define_constraint etc. if USE_MD_CONSTRAINTS is
defined.
* defaults.h: If none of the old-style constraint macros are
defined, define USE_MD_CONSTRAINTS; do not provide defaults for any
old-style macros; and poison REG_CLASS_FROM_LETTER,
CONST_OK_FOR_LETTER_P, CONST_DOUBLE_OK_FOR_LETTER_P, and
EXTRA_CONSTRAINT.
* recog.c (reg_fits_class_p): If cl is NO_REGS, return 0 immediately.
* doc/md.texi: Document new constraint-definition mechanism and the
C interface it provides. Remove references to old mechanism
elsewhere in the document.
(Machine Constraints): Use pathnames relative to gcc directory,
i.e. config/ARCH/FILE. Change i386 section to refer to
config/i386/predicates.md; update that section to match docstrings.
* doc/tm.texi: Move all documentation of the old constraint-
definition macros to their own section, clearly mark as obsolete.
* config/i386/predicates.md (R, q, Q, l, a, b, c, d, S, D, A, f, t)
(u, y, x, Y, I, J, K, L, M, N, O, G, C, e, Z): New constraint
definitions.
* config/i386/i386.h (REG_CLASS_FROM_LETTER, CONST_OK_FOR_LETTER_P)
(CONST_DOUBLE_OK_FOR_LETTER_P, EXTRA_CONSTRAINT): Delete.
* config/i386/i386.md (*movdf_nointeger): Remove stray 'H' from
constraint strings.
(splits and peepholes): Use satisfies_constraint_*.
* config/i386/i386.c (memory_address_length)
(ix86_attr_length_immediate_default): Use satisfies_constraint_*.
From-SVN: r111508
r110130@banpei: zack | 2006-01-22 14:52:43 -0800
* rtl.def (match_code): Add second argument.
* genpreds.c (write_extract_subexp): New function.
(write_match_code): Add path argument. Use write_extract_subexp.
(write_predicate_expr): Pass path to write_match_code.
(mark_mode_tests): MATCH_CODE applied to a subexpression does
not perform a mode test.
* genrecog.c (compute_predicate_codes): MATCH_CODE applied to
a subexpression does not constrain the top-level code set.
* read-rtl.c (read_rtx_variadic): New function.
(read_rtx_1): Use it; allow AND and IOR to be variadic.
* doc/md.texi: Document new notation.
* config/i386/predicates.md (cmpsi_operand_1): Fold into ...
(cmpsi_operand): ... here, using new notation.
From-SVN: r110126
* tree-inline.c (copy_body_r): Use explicit cast when
converting
from void *.
(copy_bb): Likewise.
(copy_edges_for_bb): Likewise.
(remap_decl_1): Likewise.
(estimate_num_insns_1): Likewise.
* cgraph.c (hash_node): Use explicit cast when converting from
void *.
(eq_node): Likewise.
(cgraph_create_node): Use GGC_CNEW.
(cgraph_create_edge): Use GGC_NEW.
(cgraph_remove_node): Use explicit cast when converting from
void *.
(hash_varpool_node): Likewise.
(eq_varpool_node): Likewise.
(cgraph_varpool_node): Use GGC_CNEW.
* lambda.h (lambda_vector_new): Use GGC_CNEWVEC.
* tree-scalar-evolution.c (new_scev_info_str): Use XNEW.
(eq_scev_info): Use explicit cast when converting from void *.
(find_var_scev_info): Likewise.
(set_instantiated_value): Likewise.
(gather_stats_on_scev_database_1): Likewise.
* cfgloop.h (simple_loop_desc): Use explicit cast when
converting
from void *.
* c-pch.c (c_common_write_pch): Use XNEWVEC.
(c_common_read_pch): Likewise.
* prefix.c (save_string): Use XNEWVEC.
(translate_name): Use explicit cast when converting from void
*.
* c-ppoutput.c (print_line): Use explicit cast when converting
from void *.
(pp_dir_change): Likewise.
* c-cppbuiltin.c (builtin_define_std): Likewise.
(builtin_define_with_value): Likewise.
(builtin_define_with_value_n): Likewise.
(builtin_define_with_int_value): Likewise.
(builtin_define_type_max): Likewise.
* c-incpath.c (add_env_var_paths): Use XNEWVEC.
(add_path): Use XNEW.
* c-format.c (check_format_info_main): Use GGC_NEW.
(format_type_warning): Use explicit cast when converting from
void *.
* c-typeck.c (alloc_tagged_tu_seen_cache): Use XNEW instead of
xmalloc.
(start_init): Likewise.
* tree-flow-inline.h (first_referenced_var): Use explicit cast
when converting from void *.
(next_referenced_var): Likewise.
* c-pragma.c (push_alignment): Use GGC_NEW instead of
ggc_alloc.
* gensupport.c (lookup_predicate): Use explicit cast to
convert
from void *.
(init_predicate_table): Use XCNEW instead of xcalloc.
* genpreds.c (process_define_predicate): Likewise.
From-SVN: r108723
(print_c_condition): Declare.
* read-rtl.c (ptr_loc): New structure.
(ptr_locs, ptr_loc_obstack, joined_conditions)
(joined_conditions_obstack): New variables.
(leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc)
(get_rtx_ptr_loc, copy_rtx_ptr_loc, print_rtx_ptr_loc)
(join_c_conditions, print_c_condition): New functions.
(apply_macro_to_string): Associate the new string with the same
source location as the old one.
(add_condition_to_string): Use join_c_conditions.
(read_string): Use set_rtx_ptr_loc to record a filename and line
number for the string.
(read_rtx): Initialize the new variables above.
* genattrtab.c (write_test_expr, write_attr_value): Use
print_c_condition.
* genconditions.c (write_header): Don't define MAYBE_EVAL. Move its
comment above the GCC_VERSION check.
(write_one_condition): Use print_rtx_ptr_loc and print_c_condition.
Inline the definition of MAYBE_EVAL.
* genemit.c (gen_expand, gen_split): Use print_rtx_ptr_loc.
* genoutput.c (process_template): Likewise.
* genpreds.c (write_predicate_subfunction): Likewise.
(write_predicate_expr): Use print_c_condition.
* genrecog.c (write_cond): Likewise.
* gensupport.c (process_rtx): Use join_c_conditions to join the
conditions of a define_insn_and_split. Record a source location
for the string after the "&&".
(alter_test_for_insn): Use join_c_conditions.
From-SVN: r95883
* genpreds.c: Add capability to generate predicate bodies as
well as function prototypes. Write function prototypes for
the generic predicates too.
(process_define_predicate, write_tm_preds_h, write_insn_preds_c)
(write_predicate_subfunction, mark_mode_tests, add_mode_tests)
(write_match_code, write_predicate_expr, write_one_predicate_function)
(parse_option): New functions.
(output_predicate_decls): Delete.
(main): Read the machine description, process DEFINE_PREDICATE or
DEFINE_SPECIAL_PREDICATE patterns, write tm-preds.h or insn-preds.c
as appropriate.
* genrecog.c (struct decision_test): Replace index with
struct pred_data pointer.
(next_index): Remove, unused.
(pred_table, preds, special_mode_pred_table): Delete.
(compute_predicate_codes, process_define_predicate): New functions.
(validate_pattern, add_to_sequence, write_switch): Update for
new data structures.
(main): Handle DEFINE_PREDICATE and DEFINE_SPECIAL_PREDICATE.
Check both error_count and have_error.
* gensupport.c (in_fname, first_predicate): New globals.
(define_pred_queue, define_pred_tail): New RTL-pattern queue.
(predicate_table, last_predicate, old_pred_table)
(old_special_pred_table): New statics.
(hash_struct_pred_data, eq_struct_pred_data, lookup_predicate)
(add_predicate, init_predicate_table): New functions.
(process_rtx): Handle DEFINE_PREDICATE and DEFINE_SPECIAL_PREDICATE.
(init_md_reader_args_cb): Use the global in_fname. No need to zero
it or max_include_len. Call init_predicate_table.
(read_rtx): Run the predicate queue after the attribute queue
but before all the others.
* gensupport.h (in_fname, struct pred_data, first_predicate)
(lookup_predicate, add_predicate, FOR_ALL_PREDICATES): Declare.
* rtl.def (MATCH_CODE, MATCH_TEST, DEFINE_PREDICATE)
(DEFINE_SPECIAL_PREDICATE): New RTL codes.
* dummy-conditions.c: Don't include bconfig.h, system.h,
coretypes.h, tm.h, or system.h. Do include stddef.h.
Duplicate declaration of struct c_test from gensupport.h.
* Makefile.in (OBJS-common): Add insn-preds.o.
(STAGESTUFF, .PRECIOUS): Add insn-preds.c.
(insn-preds.c, insn-preds.o): New rules.
(s-preds): Also generate insn-preds.c.
(dummy-conditions.o, genpreds$(build_exeext), genpreds.o):
Update dependencies.
(print-rtl.o, print-rtl1.o): Correct dependencies.
* recog.h: Delete prototypes of predicate functions.
* doc/md.texi (Predicates): New section with complete
documentation of operand/operator predicates. Remove some
incomplete documentation of predicates from other places.
* doc/tm.texi (Misc): Move SPECIAL_MODE_PREDICATES next to
PREDICATE_CODES; indicate that both are deprecated in favor
of define_predicate/define_special_predicate.
* config/ia64/ia64.c: All predicate function definitions moved
to ia64.md, except
(small_addr_symbolic_operand, tls_symbolic_operand): Delete.
(ia64_expand_load_address, ia64_expand_move):
Check SYMBOL_REF_TLS_MODEL directly, don't use tls_symbolic_operand.
* config/ia64/ia64.md: All predicates now defined here.
(symbolic_operand): Is now a special predicate.
* config/ia64/ia64.h: Declare ia64_section_threshold.
(PREDICATE_CODES): Delete.
From-SVN: r85855
* Makefile.in (HOST_CFLAGS): Take out -DGENERATOR_FILE.
(CONFIG_H, TCONFIG_H, TM_P_H): Update.
(GEN, STAGESTUFF): Add new files.
(insn-constants.h, s-constants, tm-preds.h, s-preds,
genconstants, genpreds, genconstants.o, genpreds.o): New rules.
(hashtab.o, safe-ctype.o): Add -DGENERATOR_FILE.
* mkconfig.sh: Include tm-preds.h in tm_p.h; insn-constants.h
as well as insn-codes.h and insn-flags.h in config.h; and no
extra headers in tconfig.h and hconfig.h.
* gencodes.c: Eliminate code to generate predicate declarations
or #defines for md-file constants.
* genconstants.c, genpreds.c: New files.
* i386.md: Re-order guard expressions such that TARGET_64BIT
comes first, when this permits better optimization. Add
TARGET_64BIT to more x86-64 patterns. Add comment explaining
why this is desirable.
From-SVN: r44743