Author: lupus
Date: 2006-09-25 05:08:19 -0400 (Mon, 25 Sep 2006)
New Revision: 65875
Added:
trunk/mono/mono/mini/optflags-def.h
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/Makefile.am
trunk/mono/mono/mini/driver.c
trunk/mono/mono/mini/mini.h
Log:
Mon Sep 25 11:05:24 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
* mini.h, driver.c, optflags-def.h, Makefile.am: reduce runtime
relocations and memory requirements, put the optimization flags
definitions in their own file.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2006-09-24 23:06:33 UTC (rev 65874)
+++ trunk/mono/mono/mini/ChangeLog 2006-09-25 09:08:19 UTC (rev 65875)
@@ -1,3 +1,10 @@
+
+Mon Sep 25 11:05:24 CEST 2006 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * mini.h, driver.c, optflags-def.h, Makefile.am: reduce runtime
+ relocations and memory requirements, put the optimization flags
+ definitions in their own file.
+
2006-09-24 Zoltan Varga <[EMAIL PROTECTED]>
* jit-icalls.c (mono_helper_stelem_ref): Remove this unused helper
function.
Modified: trunk/mono/mono/mini/Makefile.am
===================================================================
--- trunk/mono/mono/mini/Makefile.am 2006-09-24 23:06:33 UTC (rev 65874)
+++ trunk/mono/mono/mini/Makefile.am 2006-09-25 09:08:19 UTC (rev 65875)
@@ -178,6 +178,7 @@
common_sources = \
mini.c \
mini.h \
+ optflags-def.h \
jit-icalls.h \
jit-icalls.c \
trace.c \
Modified: trunk/mono/mono/mini/driver.c
===================================================================
--- trunk/mono/mono/mini/driver.c 2006-09-24 23:06:33 UTC (rev 65874)
+++ trunk/mono/mono/mini/driver.c 2006-09-25 09:08:19 UTC (rev 65875)
@@ -62,40 +62,51 @@
typedef void (*OptFunc) (const char *p);
-/* keep in sync with enum in mini.h */
+#undef OPTFLAG
+#ifdef HAVE_ARRAY_ELEM_INIT
+#define MSGSTRFIELD(line) MSGSTRFIELD1(line)
+#define MSGSTRFIELD1(line) str##line
+
+static const struct msgstr_t {
+#define OPTFLAG(id,shift,name,desc) char MSGSTRFIELD(__LINE__) [sizeof (name)
+ sizeof (desc)];
+#include "optflags-def.h"
+#undef OPTFLAG
+} opstr = {
+#define OPTFLAG(id,shift,name,desc) name "\0" desc,
+#include "optflags-def.h"
+#undef OPTFLAG
+};
+static const gint16 opt_names [] = {
+#define OPTFLAG(id,shift,name,desc) [(shift)] = offsetof (struct msgstr_t,
MSGSTRFIELD(__LINE__)),
+#include "optflags-def.h"
+#undef OPTFLAG
+};
+
+#define optflag_get_name(id) ((const char*)&opstr + opt_names [(id)])
+#define optflag_get_desc(id) (optflag_get_name(id) + 1 + strlen
(optflag_get_name(id)))
+
+#else /* !HAVE_ARRAY_ELEM_INIT */
typedef struct {
const char* name;
const char* desc;
- const OptFunc func;
} OptName;
+#define OPTFLAG(id,shift,name,desc) {name,desc},
static const OptName
opt_names [] = {
- {"peephole", "Peephole postpass"},
- {"branch", "Branch optimizations"},
- {"inline", "Inline method calls"},
- {"cfold", "Constant folding"},
- {"consprop", "Constant propagation"},
- {"copyprop", "Copy propagation"},
- {"deadce", "Dead code elimination"},
- {"linears", "Linear scan global reg allocation"},
- {"cmov", "Conditional moves"},
- {"shared", "Emit per-domain code"},
- {"sched", "Instruction scheduling"},
- {"intrins", "Intrinsic method implementations"},
- {"tailc", "Tail recursion and tail calls"},
- {"loop", "Loop related optimizations"},
- {"fcmov", "Fast x86 FP compares"},
- {"leaf", "Leaf procedures optimizations"},
- {"aot", "Usage of Ahead Of Time compiled code"},
- {"precomp", "Precompile all methods before executing Main"},
- {"abcrem", "Array bound checks removal"},
- {"ssapre", "SSA based Partial Redundancy Elimination"},
- {"exception", "Optimize exception catch blocks"},
- {"ssa", "Use plain SSA form"},
- {"treeprop", "Tree propagation"}
+#include "optflags-def.h"
+ {NULL, NULL}
};
+#define optflag_get_name(id) (opt_names [(id)].name)
+#define optflag_get_desc(id) (opt_names [(id)].desc)
+#endif
+
+static const OptFunc
+opt_funcs [sizeof (int) * 8] = {
+ NULL
+};
+
#define DEFAULT_OPTIMIZATIONS ( \
MONO_OPT_PEEPHOLE | \
MONO_OPT_CFOLD | \
@@ -135,8 +146,8 @@
} else {
invert = FALSE;
}
- for (i = 0; i < G_N_ELEMENTS (opt_names); ++i) {
- n = opt_names [i].name;
+ for (i = 0; i < G_N_ELEMENTS (opt_names) && optflag_get_name
(i); ++i) {
+ n = optflag_get_name (i);
len = strlen (n);
if (strncmp (p, n, len) == 0) {
if (invert)
@@ -149,8 +160,8 @@
break;
} else if (*p == '=') {
p++;
- if (opt_names [i].func)
- opt_names [i].func (p);
+ if (opt_funcs [i])
+ opt_funcs [i] (p);
while (*p && *p++ != ',');
break;
}
@@ -177,18 +188,18 @@
}
typedef struct {
- const char* name;
- const char* desc;
+ const char name [6];
+ const char desc [18];
MonoGraphOptions value;
} GraphName;
static const GraphName
graph_names [] = {
- {"cfg", "Control Flow Graph (CFG)" , MONO_GRAPH_CFG},
+ {"cfg", "Control Flow", MONO_GRAPH_CFG},
{"dtree", "Dominator Tree",
MONO_GRAPH_DTREE},
{"code", "CFG showing code",
MONO_GRAPH_CFG_CODE},
- {"ssa", "CFG showing code after SSA translation",
MONO_GRAPH_CFG_SSA},
- {"optcode", "CFG showing code after IR optimizations",
MONO_GRAPH_CFG_OPTCODE}
+ {"ssa", "CFG after SSA",
MONO_GRAPH_CFG_SSA},
+ {"optc", "CFG after IR opts",
MONO_GRAPH_CFG_OPTCODE}
};
static MonoGraphOptions
@@ -227,7 +238,7 @@
if (flags & (1 << i)) {
if (need_comma)
g_string_append_c (str, ',');
- g_string_append (str, opt_names [i].name);
+ g_string_append (str, optflag_get_name (i));
need_comma = 1;
}
}
@@ -588,7 +599,7 @@
int i;
for (i = 0; i < G_N_ELEMENTS (opt_names); ++i)
- fprintf (stdout, " %-10s %s\n",
opt_names [i].name, opt_names [i].desc);
+ fprintf (stdout, " %-10s %s\n",
optflag_get_name (i), optflag_get_desc (i));
}
static void
Modified: trunk/mono/mono/mini/mini.h
===================================================================
--- trunk/mono/mono/mini/mini.h 2006-09-24 23:06:33 UTC (rev 65874)
+++ trunk/mono/mono/mini/mini.h 2006-09-25 09:08:19 UTC (rev 65875)
@@ -516,31 +516,11 @@
MONO_TRAMPOLINE_NUM
} MonoTrampolineType;
-/* optimization flags: keep up to date with the name array in driver.c */
+/* optimization flags */
+#define OPTFLAG(id,shift,name,descr) MONO_OPT_ ## id = 1 << shift,
enum {
- MONO_OPT_PEEPHOLE = 1 << 0,
- MONO_OPT_BRANCH = 1 << 1,
- MONO_OPT_INLINE = 1 << 2,
- MONO_OPT_CFOLD = 1 << 3,
- MONO_OPT_CONSPROP = 1 << 4,
- MONO_OPT_COPYPROP = 1 << 5,
- MONO_OPT_DEADCE = 1 << 6,
- MONO_OPT_LINEARS = 1 << 7,
- MONO_OPT_CMOV = 1 << 8,
- MONO_OPT_SHARED = 1 << 9,
- MONO_OPT_SCHED = 1 << 10,
- MONO_OPT_INTRINS = 1 << 11,
- MONO_OPT_TAILC = 1 << 12,
- MONO_OPT_LOOP = 1 << 13,
- MONO_OPT_FCMOV = 1 << 14,
- MONO_OPT_LEAF = 1 << 15,
- MONO_OPT_AOT = 1 << 16,
- MONO_OPT_PRECOMP = 1 << 17,
- MONO_OPT_ABCREM = 1 << 18,
- MONO_OPT_SSAPRE = 1 << 19,
- MONO_OPT_EXCEPTION= 1 << 20,
- MONO_OPT_SSA = 1 << 21,
- MONO_OPT_TREEPROP = 1 << 22
+#include "optflags-def.h"
+ MONO_OPT_LAST
};
/* Bit-fields in the MonoBasicBlock.region */
Added: trunk/mono/mono/mini/optflags-def.h
===================================================================
--- trunk/mono/mono/mini/optflags-def.h 2006-09-24 23:06:33 UTC (rev 65874)
+++ trunk/mono/mono/mini/optflags-def.h 2006-09-25 09:08:19 UTC (rev 65875)
@@ -0,0 +1,23 @@
+OPTFLAG(PEEPHOLE ,0, "peephole", "Peephole postpass")
+OPTFLAG(BRANCH ,1, "branch", "Branch optimizations")
+OPTFLAG(INLINE ,2, "inline", "Inline method calls")
+OPTFLAG(CFOLD ,3, "cfold", "Constant folding")
+OPTFLAG(CONSPROP ,4, "consprop", "Constant propagation")
+OPTFLAG(COPYPROP ,5, "copyprop", "Copy propagation")
+OPTFLAG(DEADCE ,6, "deadce", "Dead code elimination")
+OPTFLAG(LINEARS ,7, "linears", "Linear scan global reg allocation")
+OPTFLAG(CMOV ,8, "cmov", "Conditional moves")
+OPTFLAG(SHARED ,9, "shared", "Emit per-domain code")
+OPTFLAG(SCHED ,10, "sched", "Instruction scheduling")
+OPTFLAG(INTRINS ,11, "intrins", "Intrinsic method implementations")
+OPTFLAG(TAILC ,12, "tailc", "Tail recursion and tail calls")
+OPTFLAG(LOOP ,13, "loop", "Loop related optimizations")
+OPTFLAG(FCMOV ,14, "fcmov", "Fast x86 FP compares")
+OPTFLAG(LEAF ,15, "leaf", "Leaf procedures optimizations")
+OPTFLAG(AOT ,16, "aot", "Usage of Ahead Of Time compiled code")
+OPTFLAG(PRECOMP ,17, "precomp", "Precompile all methods before executing
Main")
+OPTFLAG(ABCREM ,18, "abcrem", "Array bound checks removal")
+OPTFLAG(SSAPRE ,19, "ssapre", "SSA based Partial Redundancy Elimination")
+OPTFLAG(EXCEPTION,20, "exception", "Optimize exception catch blocks")
+OPTFLAG(SSA ,21, "ssa", "Use plain SSA form")
+OPTFLAG(TREEPROP ,22, "treeprop", "Tree propagation")
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches