@@ -260,6 +260,10 @@ int dbg_dead = 0;
int fmem_report = 0;
int fdump_ir;
unsigned long long fmemcpy_max_count = 100000;
+int fpromote_symbols_usage = 1;
+int fsimplify_loads = 1;
+int fsimplify_loads_full = 0; // currently broken
+int fsimplify_stores = 1;
int preprocess_only;
@@ -780,6 +784,10 @@ err:
static struct flag fflags[] = {
{ "mem-report", &fmem_report },
+ { "promote-symbols-usage", &fpromote_symbols_usage },
+ { "simplify-loads", &fsimplify_loads },
+ { "simplify-loads-full", &fsimplify_loads_full },
+ { "simplify-stores", &fsimplify_stores },
{ },
};
@@ -154,9 +154,13 @@ extern int dump_macro_defs;
extern int dbg_entry;
extern int dbg_dead;
-extern int fmem_report;
extern int fdump_ir;
+extern int fmem_report;
extern unsigned long long fmemcpy_max_count;
+extern int fpromote_symbols_usage;
+extern int fsimplify_loads;
+extern int fsimplify_loads_full;
+extern int fsimplify_stores;
extern int arch_m64;
extern int arch_msize_long;
@@ -359,6 +359,9 @@ void promote_symbols_usage(struct entrypoint *ep)
{
pseudo_t pseudo;
+ if (!fpromote_symbols_usage)
+ return;
+
FOR_EACH_PTR(ep->accesses, pseudo) {
promote_symbol(ep, pseudo->sym);
} END_FOR_EACH_PTR(pseudo);
@@ -120,15 +120,30 @@ next_store:
} END_FOR_EACH_PTR_REVERSE(insn);
}
-void simplify_memops(struct entrypoint *ep)
+static void simplify_all_loads(struct entrypoint *ep)
{
struct basic_block *bb;
+ if (!fsimplify_loads)
+ return;
FOR_EACH_PTR_REVERSE(ep->bbs, bb) {
simplify_loads(bb);
} END_FOR_EACH_PTR_REVERSE(bb);
+}
+
+static void simplify_all_stores(struct entrypoint *ep)
+{
+ struct basic_block *bb;
+ if (!fsimplify_stores)
+ return;
FOR_EACH_PTR_REVERSE(ep->bbs, bb) {
kill_dominated_stores(bb);
} END_FOR_EACH_PTR_REVERSE(bb);
}
+
+void simplify_memops(struct entrypoint *ep)
+{
+ simplify_all_loads(ep);
+ simplify_all_stores(ep);
+}
@@ -378,6 +378,34 @@ Set the distance between tab stops. This helps sparse report correct
column numbers in warnings or errors. If the value is less than 1 or
greater than 100, the option is ignored. The default is 8.
.
+.SH DEVELOPER OPTIONS
+.TP
+.B \-fno-promote-symbol-usage
+Enable or disable the promotion of memory accesses via symbol to registers.
+
+This option is enabled by default.
+.
+.TP
+.B \-fno-simplify-loads
+Enable or disable the promotion of memory loads to registers during
+the optimization passes.
+
+This option is enabled by default.
+.
+.TP
+.B \-fsimplify-loads-full
+Enable or disable the promotion of complex memory loads to registers during
+the optimization passes.
+
+This option is disabled by default.
+.
+.TP
+.B \-fno-simplify-stores
+Enable or disable the elimination of some stores to memory during
+the optimization passes.
+
+This option is enabled by default.
+.
.SH SEE ALSO
.BR cgcc (1)
.