|
From: <sv...@va...> - 2012-08-14 22:28:40
|
philippe 2012-08-14 23:28:31 +0100 (Tue, 14 Aug 2012)
New Revision: 12872
Log:
Implement --vex-iropt-register-updates=sp-at-mem-access
Option sp-at-mem-access can be used by tools which do not
need an up to date BP and IP at each mem access.
It is needed however to have SP up to date at each memory
access, as an up to date SP is needed to grow the stack in
m_signals.c
Tools massif, cachegrind and callgrind are using sp-at-mem-access
as default.
None tool could also use sp-at-mem-access but default is kept
to unwindregs-at-mem-access (similar to memcheck, drd, helgrind, exp-sgcheck).
exp-dhat, exp-bbv, lackey have not been looked at to see if they
could make use of sp-at-mem-access.
Validated on x86, amd64, ppc64 and s390x.
Modified files:
trunk/cachegrind/cg_main.c
trunk/callgrind/main.c
trunk/coregrind/m_main.c
trunk/massif/ms_main.c
trunk/none/tests/cmdline2.stdout.exp
Modified: trunk/none/tests/cmdline2.stdout.exp (+2 -1)
===================================================================
--- trunk/none/tests/cmdline2.stdout.exp 2012-08-09 16:51:55 +01:00 (rev 12871)
+++ trunk/none/tests/cmdline2.stdout.exp 2012-08-14 23:28:31 +01:00 (rev 12872)
@@ -119,7 +119,8 @@
Vex options for all Valgrind tools:
--vex-iropt-verbosity=<0..9> [0]
--vex-iropt-level=<0..2> [2]
- --vex-iropt-register-updates=unwindregs-at-mem-access
+ --vex-iropt-register-updates=sp-at-mem-access
+ |unwindregs-at-mem-access
|allregs-at-mem-access
|allregs-at-each-insn [unwindregs-at-mem-access]
--vex-iropt-unroll-thresh=<0..400> [120]
Modified: trunk/massif/ms_main.c (+3 -0)
===================================================================
--- trunk/massif/ms_main.c 2012-08-09 16:51:55 +01:00 (rev 12871)
+++ trunk/massif/ms_main.c 2012-08-14 23:28:31 +01:00 (rev 12872)
@@ -2586,6 +2586,9 @@
VG_(details_avg_translation_sizeB) ( 330 );
+ VG_(clo_vex_control).iropt_register_updates
+ = VexRegUpdSpAtMemAccess; // overridable by the user.
+
// Basic functions.
VG_(basic_tool_funcs) (ms_post_clo_init,
ms_instrument,
Modified: trunk/callgrind/main.c (+27 -2)
===================================================================
--- trunk/callgrind/main.c 2012-08-09 16:51:55 +01:00 (rev 12871)
+++ trunk/callgrind/main.c 2012-08-14 23:28:31 +01:00 (rev 12872)
@@ -1889,9 +1889,29 @@
static
void CLG_(post_clo_init)(void)
{
- VG_(clo_vex_control).iropt_unroll_thresh = 0;
- VG_(clo_vex_control).guest_chase_thresh = 0;
+ if (VG_(clo_vex_control).iropt_register_updates
+ != VexRegUpdSpAtMemAccess) {
+ CLG_DEBUG(1, " Using user specified value for "
+ "--vex-iropt-register-updates\n");
+ } else {
+ CLG_DEBUG(1,
+ " Using default --vex-iropt-register-updates="
+ "sp-at-mem-access\n");
+ }
+ if (VG_(clo_vex_control).iropt_unroll_thresh != 0) {
+ VG_(message)(Vg_UserMsg,
+ "callgrind only works with --vex-iropt-unroll-thresh=0\n"
+ "=> resetting it back to 0\n");
+ VG_(clo_vex_control).iropt_unroll_thresh = 0; // cannot be overriden.
+ }
+ if (VG_(clo_vex_control).guest_chase_thresh != 0) {
+ VG_(message)(Vg_UserMsg,
+ "callgrind only works with --vex-guest-chase-thresh=0\n"
+ "=> resetting it back to 0\n");
+ VG_(clo_vex_control).guest_chase_thresh = 0; // cannot be overriden.
+ }
+
CLG_DEBUG(1, " dump threads: %s\n", CLG_(clo).separate_threads ? "Yes":"No");
CLG_DEBUG(1, " call sep. : %d\n", CLG_(clo).separate_callers);
CLG_DEBUG(1, " rec. sep. : %d\n", CLG_(clo).separate_recursions);
@@ -1936,6 +1956,11 @@
VG_(details_bug_reports_to) (VG_BUGS_TO);
VG_(details_avg_translation_sizeB) ( 500 );
+ VG_(clo_vex_control).iropt_register_updates
+ = VexRegUpdSpAtMemAccess; // overridable by the user.
+ VG_(clo_vex_control).iropt_unroll_thresh = 0; // cannot be overriden.
+ VG_(clo_vex_control).guest_chase_thresh = 0; // cannot be overriden.
+
VG_(basic_tool_funcs) (CLG_(post_clo_init),
CLG_(instrument),
CLG_(fini));
Modified: trunk/coregrind/m_main.c (+6 -1)
===================================================================
--- trunk/coregrind/m_main.c 2012-08-09 16:51:55 +01:00 (rev 12871)
+++ trunk/coregrind/m_main.c 2012-08-14 23:28:31 +01:00 (rev 12872)
@@ -230,7 +230,8 @@
" Vex options for all Valgrind tools:\n"
" --vex-iropt-verbosity=<0..9> [0]\n"
" --vex-iropt-level=<0..2> [2]\n"
-" --vex-iropt-register-updates=unwindregs-at-mem-access\n"
+" --vex-iropt-register-updates=sp-at-mem-access\n"
+" |unwindregs-at-mem-access\n"
" |allregs-at-mem-access\n"
" |allregs-at-each-insn [unwindregs-at-mem-access]\n"
" --vex-iropt-unroll-thresh=<0..400> [120]\n"
@@ -607,6 +608,10 @@
else if VG_BINT_CLO(arg, "--vex-iropt-level",
VG_(clo_vex_control).iropt_level, 0, 2) {}
else if VG_XACT_CLO(arg,
+ "--vex-iropt-register-updates=sp-at-mem-access",
+ VG_(clo_vex_control).iropt_register_updates,
+ VexRegUpdSpAtMemAccess);
+ else if VG_XACT_CLO(arg,
"--vex-iropt-register-updates=unwindregs-at-mem-access",
VG_(clo_vex_control).iropt_register_updates,
VexRegUpdUnwindregsAtMemAccess);
Modified: trunk/cachegrind/cg_main.c (+2 -0)
===================================================================
--- trunk/cachegrind/cg_main.c 2012-08-09 16:51:55 +01:00 (rev 12871)
+++ trunk/cachegrind/cg_main.c 2012-08-14 23:28:31 +01:00 (rev 12872)
@@ -1695,6 +1695,8 @@
VG_(details_bug_reports_to) (VG_BUGS_TO);
VG_(details_avg_translation_sizeB) ( 500 );
+ VG_(clo_vex_control).iropt_register_updates
+ = VexRegUpdSpAtMemAccess; // overridable by the user.
VG_(basic_tool_funcs) (cg_post_clo_init,
cg_instrument,
cg_fini);
|