This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[yara-branch] the 1st patch
- From: "Vladimir N. Makarov" <vmakarov at redhat dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 18 Mar 2006 13:03:41 -0500
- Subject: [yara-branch] the 1st patch
The patch has been commited.
2006-03-18 Vladimir Makarov <vmakarov@redhat.com>
* yara.h, yara-int.h, yara.c, yara-ir.c, yara-trans.c,
yara-color.c, yara-insns.c, yara-final.c: New files.
* tree-pass.h (pass_yara): New external definition.
* reload.h (cleanup_subreg_operands): Move to output.h.
(add_auto_inc_notes): New prototype.
* final.c (alter_subreg): simply subreg of reg only after reload
or for hard register.
* params.h (YARA_PARAMS, YARA_SPLIT_THRESHOLD): New params.
* toplev.h (flag_yara, flag_optimistic_coalescing,
flag_extended_coalescing, flag_rematerialize, flag_slit): New
external definitions.
* toplev.c (yara.h): Add header.
(backend_init): Call yara_init_once.
* regs.h (contains_reg_of_mode, move_cost): External definitions.
* dbxout.c (yara.h): Add header.
(dbxout_symbol, dbxout_parms): Call yara_eliminate_regs for YARA.
* global.c (gate_handle_global_alloc): New guard to prevent global
when YARA.
(pass_global_alloc): Initialize the guard.
* dwarf2out.c (yara.h): Add header.
(based_loc_descr, compute_frame_pointer_to_fb_displacement): Call
yara_eliminate_regs for YARA.
* timevar.def (TV_YARA): Define.
* hard-reg-set.h (reg_class_subclasses): External definition.
* regmove.c (gate_handle_regmove): Prevent regmove when YARA.
* local-alloc.c (update_equiv_regs): Make it global.
(gate_handle_local_alloc): New guard to prevent local when YARA.
(pass_local_alloc): Initialize the guard.
* sdbout.c (yara.h): Add header.
(sdbout_symbol, sdbout_parms): Call yara_eliminate_regs for YARA.
* common.opt (fextended-coalescing, foptimistic-coalescing,
frematerialize, fsplit, fyara): New options.
* regclass.c (reg_class_subclasses, contains_reg_of_mode,
move_cost): Make them global.
* rtl.h (update_equiv_regs): External definition.
* output.h (cleanup_subreg_operands): External definition.
* Makefile.in (OBJS-common): Add YARA object files.
(toplev.o, passes.o, dbxout.o, sdbout.o, dwarf2out.o): Add
yara.h.
(yara.o, yara-ir.o, yara-trans.o, yara-color.o, yara-insn.o,
yara-final.o): New entries.
(gt-yara-trans.h): New entry.
* passes.c (yara.h): Add header.
(init_optimization_passes): Add new pass pass_yara.
* config/i386/i386.h (SECONDARY_RELOAD_MODE_P): New macro.
(SECONDARY_OUTPUT_RELOAD_CLASS): Change it.
* config/i386/i386.c (pentium4_cost): Fix typo in a comment.
* params.def (YARA_PARAMS, YARA_PARAM_RA_SPLIT_THRESHOLD): New
parameters.
* reload1.c (add_auto_inc_notes): Make it global.
* doc/invoke.texi (fyara, foptimistic-coalescing,
fextended-coalescing, fsplit, frematerialize): Add new options.
(yara-params, yara-split-threshold): New parameters.
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi (revision 112200)
+++ doc/invoke.texi (working copy)
@@ -307,7 +307,7 @@
-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol
-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol
-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol
--fexpensive-optimizations -ffast-math -ffloat-store @gol
+-fexpensive-optimizations -fextended-coalescing -ffast-math -ffloat-store @gol
-fforce-addr -ffunction-sections @gol
-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
-fcrossjumping -fif-conversion -fif-conversion2 @gol
@@ -320,10 +320,10 @@
-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
-funsafe-math-optimizations -funsafe-loop-optimizations -ffinite-math-only @gol
-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
--fomit-frame-pointer -foptimize-register-move @gol
+-fomit-frame-pointer -foptimistic-coalescing -foptimize-register-move @gol
-foptimize-sibling-calls -fprefetch-loop-arrays @gol
-fprofile-generate -fprofile-use @gol
--fregmove -frename-registers @gol
+-fregmove -frematerialize -frename-registers @gol
-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
-frerun-cse-after-loop @gol
-frounding-math -frtl-abstract-sequences @gol
@@ -334,7 +334,7 @@
-fsched2-use-superblocks @gol
-fsched2-use-traces -freschedule-modulo-scheduled-loops @gol
-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol
--fstack-protector -fstack-protector-all @gol
+-fsplit -fstack-protector -fstack-protector-all @gol
-fstrict-aliasing -ftracer -fthread-jumps @gol
-funroll-all-loops -funroll-loops -fpeel-loops @gol
-fsplit-ivs-in-unroller -funswitch-loops @gol
@@ -345,6 +345,7 @@
-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
+-fyara @gol
--param @var{name}=@var{value}
-O -O0 -O1 -O2 -O3 -Os}
@@ -5788,6 +5789,21 @@
Not all targets support this option.
+@item -fyara
+Run yet another register allocator (YARA) instead of the original one.
+
+@item -foptimistic-coalescing
+Do optimistic coalescing in YARA. By default it is off.
+
+@item -foptimistic-coalescing
+Do extended coalescing in YARA. By default it is off.
+
+@item -fsplit
+Do register live range splitting in YARA. By default it is off.
+
+@item -frematerialize
+Do register value rematerialization in YARA. By default it is off.
+
@item --param @var{name}=@var{value}
@opindex param
In some places, GCC uses various constants to control the amount of
@@ -6233,6 +6249,14 @@
Maximum number of fields in a structure we will treat in
a field sensitive manner during pointer analysis.
+@item yara-params
+Mask to switch on/off internal passes of YARA which are normally
+always on. This parameter is used for debugging YARA.
+
+@item yara-split-threshold
+The minimal ratio of one part register live range to another part to try
+splitting the two parts in YARA.
+
@end table
@end table
Index: tree-pass.h
===================================================================
--- tree-pass.h (revision 112200)
+++ tree-pass.h (working copy)
@@ -361,6 +361,7 @@
extern struct tree_opt_pass pass_sched;
extern struct tree_opt_pass pass_local_alloc;
extern struct tree_opt_pass pass_global_alloc;
+extern struct tree_opt_pass pass_yara;
extern struct tree_opt_pass pass_postreload;
extern struct tree_opt_pass pass_clean_state;
extern struct tree_opt_pass pass_branch_prob;
Index: reload.h
===================================================================
--- reload.h (revision 112200)
+++ reload.h (working copy)
@@ -359,9 +359,6 @@
/* Find the places where hard regs are live across calls and save them. */
extern void save_call_clobbered_regs (void);
-/* Replace (subreg (reg)) with the appropriate (reg) for any operands. */
-extern void cleanup_subreg_operands (rtx);
-
/* Debugging support. */
extern void debug_reload_to_stream (FILE *);
extern void debug_reload (void);
@@ -369,3 +366,7 @@
/* Compute the actual register we should reload to, in case we're
reloading to/from a register that is wider than a word. */
extern rtx reload_adjust_reg_for_mode (rtx, enum machine_mode);
+
+#ifdef AUTO_INC_DEC
+extern void add_auto_inc_notes (rtx, rtx);
+#endif
Index: final.c
===================================================================
--- final.c (revision 112200)
+++ final.c (working copy)
@@ -2575,7 +2575,7 @@
*xp = adjust_address (y, GET_MODE (x), offset);
}
- else
+ else if (reload_completed || HARD_REGISTER_P (y))
{
rtx new = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
SUBREG_BYTE (x));
Index: params.h
===================================================================
--- params.h (revision 112200)
+++ params.h (working copy)
@@ -149,4 +149,8 @@
PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO)
#define MAX_FIELDS_FOR_FIELD_SENSITIVE \
((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE))
+#define YARA_PARAMS \
+ PARAM_VALUE (PARAM_YARA_PARAMS)
+#define YARA_SPLIT_THRESHOLD \
+ PARAM_VALUE (PARAM_YARA_SPLIT_THRESHOLD)
#endif /* ! GCC_PARAMS_H */
Index: toplev.c
===================================================================
--- toplev.c (revision 112200)
+++ toplev.c (working copy)
@@ -67,6 +67,7 @@
#include "diagnostic.h"
#include "params.h"
#include "reload.h"
+#include "yara.h"
#include "dwarf2asm.h"
#include "integrate.h"
#include "real.h"
@@ -1832,6 +1833,7 @@
init_rtlanal ();
init_regs ();
+ yara_init_once ();
init_fake_stack_mems ();
init_alias_once ();
init_reload ();
Index: toplev.h
===================================================================
--- toplev.h (revision 112200)
+++ toplev.h (working copy)
@@ -131,6 +131,11 @@
extern int flag_unswitch_loops;
extern int flag_cprop_registers;
extern int time_report;
+extern int flag_yara;
+extern int flag_optimistic_coalescing;
+extern int flag_extended_coalescing;
+extern int flag_rematerialize;
+extern int flag_split;
/* Things to do with target switches. */
extern void print_version (FILE *, const char *);
Index: regs.h
===================================================================
--- regs.h (revision 112200)
+++ regs.h (working copy)
@@ -230,6 +230,13 @@
/* Allocate reg_n_info tables */
extern void allocate_reg_info (size_t, int, int);
+/* 1 if class does contain register of given mode. */
+extern char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
+
+/* Maximum cost of moving from a register in one class to a register
+ in another class. */
+extern int move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][N_REG_CLASSES];
+
/* Specify number of hard registers given machine mode occupy. */
extern unsigned char hard_regno_nregs[FIRST_PSEUDO_REGISTER][MAX_MACHINE_MODE];
Index: dbxout.c
===================================================================
--- dbxout.c (revision 112200)
+++ dbxout.c (working copy)
@@ -80,6 +80,7 @@
#include "regs.h"
#include "insn-config.h"
#include "reload.h"
+#include "yara.h"
#include "output.h"
#include "dbxout.h"
#include "toplev.h"
@@ -2692,7 +2693,9 @@
if (!decl_rtl)
DBXOUT_DECR_NESTING_AND_RETURN (0);
- decl_rtl = eliminate_regs (decl_rtl, 0, NULL_RTX);
+ decl_rtl = (flag_yara
+ ? yara_eliminate_regs (decl_rtl, 0)
+ : eliminate_regs (decl_rtl, 0, NULL_RTX));
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
leaf_renumber_regs_insn (decl_rtl);
@@ -3036,8 +3039,13 @@
/* Perform any necessary register eliminations on the parameter's rtl,
so that the debugging output will be accurate. */
DECL_INCOMING_RTL (parms)
- = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
- SET_DECL_RTL (parms, eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
+ = (flag_yara
+ ? yara_eliminate_regs (DECL_INCOMING_RTL (parms), 0)
+ : eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX));
+ SET_DECL_RTL (parms,
+ (flag_yara
+ ? yara_eliminate_regs (DECL_RTL (parms), 0)
+ : eliminate_regs (DECL_RTL (parms), 0, NULL_RTX)));
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
{
Index: global.c
===================================================================
--- global.c (revision 112200)
+++ global.c (working copy)
@@ -2497,6 +2497,14 @@
}
free_bb_info ();
}
+
+static bool
+gate_handle_global_alloc (void)
+{
+ return ! flag_yara;
+}
+
+
/* Run old register allocator. Return TRUE if we must exit
rest_of_compilation upon return. */
static unsigned int
@@ -2530,7 +2538,7 @@
struct tree_opt_pass pass_global_alloc =
{
"greg", /* name */
- NULL, /* gate */
+ gate_handle_global_alloc, /* gate */
rest_of_handle_global_alloc, /* execute */
NULL, /* sub */
NULL, /* next */
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 112200)
+++ dwarf2out.c (working copy)
@@ -47,6 +47,7 @@
#include "regs.h"
#include "insn-config.h"
#include "reload.h"
+#include "yara.h"
#include "function.h"
#include "output.h"
#include "expr.h"
@@ -8678,7 +8679,9 @@
argument pointer and soft frame pointer rtx's. */
if (reg == arg_pointer_rtx || reg == frame_pointer_rtx)
{
- rtx elim = eliminate_regs (reg, VOIDmode, NULL_RTX);
+ rtx elim = (flag_yara
+ ? yara_eliminate_regs (reg, VOIDmode)
+ : eliminate_regs (reg, VOIDmode, NULL_RTX));
if (elim != reg)
{
@@ -10449,7 +10452,9 @@
offset += ARG_POINTER_CFA_OFFSET (current_function_decl);
#endif
- elim = eliminate_regs (reg, VOIDmode, NULL_RTX);
+ elim = (flag_yara
+ ? yara_eliminate_regs (reg, VOIDmode)
+ : eliminate_regs (reg, VOIDmode, NULL_RTX));
if (GET_CODE (elim) == PLUS)
{
offset += INTVAL (XEXP (elim, 1));
Index: timevar.def
===================================================================
--- timevar.def (revision 112200)
+++ timevar.def (working copy)
@@ -149,6 +149,7 @@
DEFTIMEVAR (TV_SCHED , "scheduling")
DEFTIMEVAR (TV_LOCAL_ALLOC , "local alloc")
DEFTIMEVAR (TV_GLOBAL_ALLOC , "global alloc")
+DEFTIMEVAR (TV_YARA , "yet another RA")
DEFTIMEVAR (TV_RELOAD_CSE_REGS , "reload CSE regs")
DEFTIMEVAR (TV_SEQABSTR , "sequence abstraction")
DEFTIMEVAR (TV_GCSE_AFTER_RELOAD , "load CSE after reload")
Index: hard-reg-set.h
===================================================================
--- hard-reg-set.h (revision 112200)
+++ hard-reg-set.h (working copy)
@@ -464,6 +464,10 @@
extern unsigned int reg_class_size[N_REG_CLASSES];
+/* For each reg class, table listing all the classes contained in it. */
+
+extern enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
+
/* For each pair of reg classes,
a largest reg class contained in their union. */
Index: regmove.c
===================================================================
--- regmove.c (revision 112200)
+++ regmove.c (working copy)
@@ -2464,7 +2464,7 @@
static bool
gate_handle_regmove (void)
{
- return (optimize > 0 && flag_regmove);
+ return (optimize > 0 && flag_regmove && ! flag_yara);
}
Index: local-alloc.c
===================================================================
--- local-alloc.c (revision 112200)
+++ local-alloc.c (working copy)
@@ -292,7 +292,6 @@
static int contains_replace_regs (rtx);
static int memref_referenced_p (rtx, rtx);
static int memref_used_between_p (rtx, rtx, rtx);
-static void update_equiv_regs (void);
static void no_equiv (rtx, rtx, void *);
static void block_alloc (int);
static int qty_sugg_compare (int, int);
@@ -790,7 +789,7 @@
Initialize the REG_EQUIV_INIT array of initializing insns. */
-static void
+void
update_equiv_regs (void)
{
rtx insn;
@@ -2521,6 +2520,12 @@
fprintf (file, ";; Register %d in %d.\n", i, reg_renumber[i]);
}
+static bool
+gate_handle_local_alloc (void)
+{
+ return ! flag_yara;
+}
+
/* Run old register allocator. Return TRUE if we must exit
rest_of_compilation upon return. */
static unsigned int
@@ -2572,7 +2577,7 @@
struct tree_opt_pass pass_local_alloc =
{
"lreg", /* name */
- NULL, /* gate */
+ gate_handle_local_alloc, /* gate */
rest_of_handle_local_alloc, /* execute */
NULL, /* sub */
NULL, /* next */
Index: sdbout.c
===================================================================
--- sdbout.c (revision 112200)
+++ sdbout.c (working copy)
@@ -74,6 +74,7 @@
#include "flags.h"
#include "insn-config.h"
#include "reload.h"
+#include "yara.h"
#include "output.h"
#include "toplev.h"
#include "tm_p.h"
@@ -770,7 +771,9 @@
return;
SET_DECL_RTL (decl,
- eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
+ (flag_yara
+ ? yara_eliminate_regs (DECL_RTL (decl), 0)
+ : eliminate_regs (DECL_RTL (decl), 0, NULL_RTX)));
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
leaf_renumber_regs_insn (DECL_RTL (decl));
@@ -1263,9 +1266,13 @@
/* Perform any necessary register eliminations on the parameter's rtl,
so that the debugging output will be accurate. */
DECL_INCOMING_RTL (parms)
- = eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX);
+ = (flag_yara
+ ? yara_eliminate_regs (DECL_INCOMING_RTL (parms), 0)
+ : eliminate_regs (DECL_INCOMING_RTL (parms), 0, NULL_RTX));
SET_DECL_RTL (parms,
- eliminate_regs (DECL_RTL (parms), 0, NULL_RTX));
+ (flag_yara
+ ? yara_eliminate_regs (DECL_RTL (parms), 0)
+ : eliminate_regs (DECL_RTL (parms), 0, NULL_RTX)));
if (PARM_PASSED_IN_MEMORY (parms))
{
Index: common.opt
===================================================================
--- common.opt (revision 112200)
+++ common.opt (working copy)
@@ -399,6 +399,10 @@
Common Report Var(flag_expensive_optimizations)
Perform a number of minor, expensive optimizations
+fextended-coalescing
+Common Report Var(flag_extended_coalescing)
+Do extended coalescing
+
ffast-math
Common
@@ -614,6 +618,10 @@
Common Report Var(flag_omit_frame_pointer)
When possible do not generate stack frames
+foptimistic-coalescing
+Common Report Var(flag_optimistic_coalescing)
+Do optimistic coalescing
+
foptimize-register-move
Common Report Var(flag_regmove)
Do the full register move optimization pass
@@ -701,6 +709,10 @@
Common Report Var(flag_regmove)
Enables a register move optimization
+frematerialize
+Common Report Var(flag_rematerialize)
+Perform a register rematerialization
+
frename-registers
Common Report Var(flag_rename_registers) Init(2)
Perform a register renaming optimization pass
@@ -807,6 +819,10 @@
Common Report Var(flag_single_precision_constant)
Convert floating point constants to single precision constants
+fsplit
+Common Report Var(flag_split)
+Register live range splitting.
+
fsplit-ivs-in-unroller
Common Report Var(flag_split_ivs_in_unroller) Init(1)
Split lifetimes of induction variables when loops are unrolled
@@ -1061,6 +1077,10 @@
Common Report Var(flag_wrapv)
Assume signed arithmetic overflow wraps around
+fyara
+Common Report Var(flag_yara)
+Use yet another register allocator.
+
fzero-initialized-in-bss
Common Report Var(flag_zero_initialized_in_bss) Init(1)
Put zero initialized data in the bss section
Index: regclass.c
===================================================================
--- regclass.c (revision 112200)
+++ regclass.c (working copy)
@@ -172,7 +172,7 @@
/* For each reg class, table listing all the classes contained in it. */
-static enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
+enum reg_class reg_class_subclasses[N_REG_CLASSES][N_REG_CLASSES];
/* For each pair of reg classes,
a largest reg class contained in their union. */
@@ -205,12 +205,12 @@
/* 1 if class does contain register of given mode. */
-static char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
+char contains_reg_of_mode [N_REG_CLASSES] [MAX_MACHINE_MODE];
/* Maximum cost of moving from a register in one class to a register in
another class. Based on REGISTER_MOVE_COST. */
-static int move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][N_REG_CLASSES];
+int move_cost[MAX_MACHINE_MODE][N_REG_CLASSES][N_REG_CLASSES];
/* Similar, but here we don't have to move if the first index is a subset
of the second so in that case the cost is zero. */
Index: rtl.h
===================================================================
--- rtl.h (revision 112200)
+++ rtl.h (working copy)
@@ -2183,6 +2183,7 @@
/* In local-alloc.c */
extern void dump_local_alloc (FILE *);
+extern void update_equiv_regs (void);
/* In reload1.c */
extern int function_invariant_p (rtx);
Index: output.h
===================================================================
--- output.h (revision 112200)
+++ output.h (working copy)
@@ -74,6 +74,13 @@
be scanned. */
extern rtx final_scan_insn (rtx, FILE *, int, int, int *);
+/* For each operand in INSN, simplify (subreg (reg)) so that it refers
+ directly to the desired hard register. */
+extern void cleanup_subreg_operands (rtx);
+
+/* Replace (subreg (reg)) with the appropriate (reg) for any operands. */
+extern void cleanup_subreg_operands (rtx);
+
/* Replace a SUBREG with a REG or a MEM, based on the thing it is a
subreg of. */
extern rtx alter_subreg (rtx *);
Index: Makefile.in
===================================================================
--- Makefile.in (revision 112200)
+++ Makefile.in (working copy)
@@ -996,8 +996,8 @@
tree-profile.o rtlhooks.o cfgexpand.o lambda-mat.o \
lambda-trans.o lambda-code.o tree-loop-linear.o tree-ssa-sink.o \
tree-vrp.o tree-stdarg.o tree-cfgcleanup.o tree-ssa-reassoc.o \
- tree-ssa-structalias.o tree-object-size.o \
- rtl-factoring.o
+ tree-ssa-structalias.o tree-object-size.o rtl-factoring.o \
+ yara.o yara-ir.o yara-trans.o yara-insn.o yara-color.o yara-final.o
OBJS-md = $(out_object_file)
@@ -2119,7 +2119,7 @@
$(INSN_ATTR_H) output.h $(DIAGNOSTIC_H) debug.h insn-config.h intl.h \
$(RECOG_H) Makefile toplev.h dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \
hard-reg-set.h $(BASIC_BLOCK_H) graph.h except.h $(REGS_H) $(TIMEVAR_H) \
- value-prof.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
+ value-prof.h $(PARAMS_H) $(TM_P_H) reload.h yara.h dwarf2asm.h $(TARGET_H) \
langhooks.h insn-flags.h $(CFGLAYOUT_H) $(CFGLOOP_H) hosthooks.h \
$(CGRAPH_H) $(COVERAGE_H) alloc-pool.h $(GGC_H) $(INTEGRATE_H) \
$(CPPLIB_H) opts.h params.def tree-mudflap.h $(REAL_H)
@@ -2132,7 +2132,7 @@
$(DIAGNOSTIC_H) debug.h insn-config.h intl.h $(RECOG_H) toplev.h \
dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \
graph.h except.h $(REGS_H) $(TIMEVAR_H) value-prof.h \
- $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h $(TARGET_H) \
+ $(PARAMS_H) $(TM_P_H) reload.h yara.h dwarf2asm.h $(TARGET_H) \
langhooks.h insn-flags.h $(CFGLAYOUT_H) $(REAL_H) $(CFGLOOP_H) \
hosthooks.h $(CGRAPH_H) $(COVERAGE_H) tree-pass.h $(TREE_DUMP_H) \
$(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h tree-flow.h $(TREE_INLINE_H)
@@ -2211,17 +2211,18 @@
gt-optabs.h $(BASIC_BLOCK_H) $(TARGET_H) $(FUNCTION_H)
dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(FLAGS_H) $(REGS_H) debug.h $(TM_P_H) $(TARGET_H) $(FUNCTION_H) \
- langhooks.h insn-config.h reload.h gstab.h xcoffout.h output.h dbxout.h \
- toplev.h $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
+ langhooks.h insn-config.h reload.h yara.h gstab.h xcoffout.h output.h \
+ dbxout.h toplev.h $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
$(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
output.h toplev.h $(TM_P_H) gsyms.h langhooks.h $(TARGET_H) sdbout.h \
- gt-sdbout.h reload.h $(VARRAY_H)
+ gt-sdbout.h reload.h yara.h $(VARRAY_H)
dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) version.h $(RTL_H) dwarf2.h debug.h $(FLAGS_H) insn-config.h \
output.h $(DIAGNOSTIC_H) $(REAL_H) hard-reg-set.h $(REGS_H) $(EXPR_H) \
- libfuncs.h toplev.h dwarf2out.h reload.h $(GGC_H) except.h dwarf2asm.h \
+ libfuncs.h toplev.h dwarf2out.h reload.h yara.h $(GGC_H) except.h \
+ dwarf2asm.h \
$(TM_P_H) langhooks.h $(HASHTAB_H) gt-dwarf2out.h $(TARGET_H) $(CGRAPH_H) \
$(MD5_H) input.h $(FUNCTION_H) $(VARRAY_H)
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
@@ -2501,6 +2502,37 @@
$(ALIAS_H) $(EMIT_RTL_H) $(GGC_H) $(FUNCTION_H) cselib.h $(TREE_H) $(TM_P_H) \
langhooks.h $(TARGET_H) gt-alias.h $(TIMEVAR_H) $(CGRAPH_H) \
$(SPLAY_TREE_H) $(VARRAY_H) $(IPA_TYPE_ESCAPE_H) tree-pass.h
+yara.o: yara.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TARGET_H) $(RTL_H) insn-codes.h $(OPTABS_H) $(RECOG_H) \
+ $(REGS_H) hard-reg-set.h $(FLAGS_H) $(OBSTACK_H) $(HASHTAB_H) errors.h \
+ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) \
+ $(CFGLOOP_H) yara.h yara-int.h $(TIMEVAR_H) tree-pass.h output.h \
+ integrate.h $(GGC_H)
+yara-ir.o: yara-ir.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TARGET_H) $(RTL_H) $(TREE_H) insn-codes.h insn-config.h \
+ $(OPTABS_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) $(HASHTAB_H) \
+ errors.h $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) langhooks.h\
+ $(CFGLOOP_H) yara.h yara-int.h $(GGC_H) gt-yara-ir.h
+yara-trans.o: yara-trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TARGET_H) $(RTL_H) insn-codes.h insn-config.h $(OPTABS_H) $(RECOG_H) \
+ $(REGS_H) hard-reg-set.h $(FLAGS_H) $(HASHTAB_H) errors.h \
+ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) \
+ $(CFGLOOP_H) yara-int.h yara-int.h $(GGC_H) gt-yara-trans.h
+yara-color.o: yara-color.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TARGET_H) $(RTL_H) insn-codes.h insn-config.h $(OPTABS_H) $(RECOG_H) \
+ $(REGS_H) hard-reg-set.h $(FLAGS_H) errors.h \
+ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) \
+ $(CFGLOOP_H) yara.h yara-int.h
+yara-insn.o: yara-insn.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TARGET_H) $(RTL_H) insn-codes.h $(OPTABS_H) $(RECOG_H) \
+ $(REGS_H) hard-reg-set.h $(FLAGS_H) errors.h \
+ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) \
+ $(CFGLOOP_H) yara.h yara-int.h
+yara-final.o: yara-final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ $(TARGET_H) $(RTL_H) insn-codes.h $(OPTABS_H) $(RECOG_H) \
+ $(REGS_H) hard-reg-set.h $(FLAGS_H) errors.h \
+ $(EXPR_H) $(BASIC_BLOCK_H) toplev.h $(TM_P_H) \
+ $(CFGLOOP_H) yara.h yara-int.h
regmove.o : regmove.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
insn-config.h timevar.h tree-pass.h \
$(RECOG_H) output.h $(REGS_H) hard-reg-set.h $(FLAGS_H) $(FUNCTION_H) \
@@ -2824,8 +2856,8 @@
$(srcdir)/tree-profile.c $(srcdir)/tree-nested.c \
$(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \
$(srcdir)/tree-ssa-structalias.c \
- $(srcdir)/c-pragma.h $(srcdir)/omp-low.c \
- $(srcdir)/targhooks.c $(out_file) \
+ $(srcdir)/c-pragma.h $(srcdir)/omp-low.c $(srcdir)/targhooks.c \
+ $(srcdir)/yara-ir.c $(srcdir)/yara-trans.c $(out_file) \
@all_gtfiles@
GTFILES_FILES_LANGS = @all_gtfiles_files_langs@
@@ -2858,7 +2890,7 @@
gt-tree-phinodes.h gt-tree-nested.h \
gt-tree-ssa-operands.h gt-tree-ssa-propagate.h \
gt-tree-ssa-structalias.h \
-gt-stringpool.h gt-targhooks.h gt-omp-low.h : s-gtype ; @true
+gt-stringpool.h gt-targhooks.h gt-omp-low.h gt-yara-trans.h : s-gtype ; @true
define echo_quoted_to_gtyp
echo "\"$(gtyp)\", " >> tmp-gtyp.h
Index: passes.c
===================================================================
--- passes.c (revision 112200)
+++ passes.c (working copy)
@@ -65,6 +65,7 @@
#include "diagnostic.h"
#include "params.h"
#include "reload.h"
+#include "yara.h"
#include "dwarf2asm.h"
#include "integrate.h"
#include "real.h"
@@ -654,6 +655,7 @@
NEXT_PASS (pass_sched);
NEXT_PASS (pass_local_alloc);
NEXT_PASS (pass_global_alloc);
+ NEXT_PASS (pass_yara);
NEXT_PASS (pass_postreload);
*p = NULL;
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h (revision 112200)
+++ config/i386/i386.h (working copy)
@@ -1227,14 +1227,28 @@
#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
ix86_secondary_memory_needed ((CLASS1), (CLASS2), (MODE), 1)
+
+/* Macro saying that value of MODE may need a secondary reload. If it
+ is not defined, all modes are eligible for secondary reload. This
+ macro is used to speed up the register allocation. */
+#define SECONDARY_RELOAD_MODE_P(MODE) (!TARGET_64BIT && (MODE) == QImode)
+
/* QImode spills from non-QI registers need a scratch. This does not
happen often -- the only example so far requires an uninitialized
pseudo. */
+#if 0
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
(((CLASS) == GENERAL_REGS || (CLASS) == LEGACY_REGS \
|| (CLASS) == INDEX_REGS) && !TARGET_64BIT && (MODE) == QImode \
? Q_REGS : NO_REGS)
+#else
+#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, OUT) \
+ ((CLASS) != AREG && (CLASS) != BREG && (CLASS) != CREG \
+ && (CLASS) != DREG && (CLASS) != AD_REGS && (CLASS) != Q_REGS \
+ && !TARGET_64BIT && (MODE) == QImode \
+ ? Q_REGS : NO_REGS)
+#endif
/* Return the maximum number of consecutive registers
needed to represent mode MODE in a register of class CLASS. */
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 112200)
+++ config/i386/i386.c (working copy)
@@ -512,7 +512,7 @@
2, /* cost of reg,reg fld/fst */
{2, 2, 6}, /* cost of loading fp registers
in SFmode, DFmode and XFmode */
- {4, 4, 6}, /* cost of loading integer registers */
+ {4, 4, 6}, /* cost of storing fp registers */
2, /* cost of moving MMX register */
{2, 2}, /* cost of loading MMX registers
in SImode and DImode */
Index: params.def
===================================================================
--- params.def (revision 112200)
+++ params.def (working copy)
@@ -582,6 +582,17 @@
"max-fields-for-field-sensitive",
"Maximum number of fields in a structure before pointer analysis treats the structure as a single variable",
100, 0, 0)
+
+DEFPARAM (PARAM_YARA_PARAMS,
+ "yara-params",
+ "Mask to switch off/one internal YARA passes",
+ 0, 0, 0)
+
+DEFPARAM (PARAM_YARA_SPLIT_THRESHOLD,
+ "yara-split-thershold",
+ "The min conflicting regs/the reg (in freq) to start split the reg live range",
+ 5, 0, 0)
+
/*
Local variables:
mode:c
Index: reload1.c
===================================================================
--- reload1.c (revision 112200)
+++ reload1.c (working copy)
@@ -433,9 +433,6 @@
static void delete_address_reloads (rtx, rtx);
static void delete_address_reloads_1 (rtx, rtx, rtx);
static rtx inc_for_reload (rtx, rtx, rtx, int);
-#ifdef AUTO_INC_DEC
-static void add_auto_inc_notes (rtx, rtx);
-#endif
static void copy_eh_notes (rtx, rtx);
static int reloads_conflict (int, int);
static rtx gen_reload (rtx, rtx, int, enum reload_type);
@@ -8199,7 +8196,7 @@
}
#ifdef AUTO_INC_DEC
-static void
+void
add_auto_inc_notes (rtx insn, rtx x)
{
enum rtx_code code = GET_CODE (x);