Fixed a minor bug -- the condition for determining whether
VG_(handle_esp_assignment)() was needed by a skin (and thus whether to register
it in the baseBlock) was different to that used when determining whether to
call it in code generation... so it could be (attempted to be) called having
not been registered.

Fixed this by consistifying the conditions, using a function
VG_(need_to_handle_esp_assignment)() that is used in both places.  The bug
hadn't been found previously because no existing skin exercised the mismatched
conditions in conflicting ways.

Also took VG_(track).post_mem_write out of consideration because it's no longer
important (due to a change in how stack switching is detected).

----
Improved the error message for when a helper can't be found in the baseBlock --
now looks up the debug info to tell you the name of the not-found function.

----
Increased the number of noncompact helpers allowed from 8 to 24

----
Removed a magic number that was hardcoded all over the place, introducing
VG_MAX_REGS_USED for the size of the arrays needed by VG_(get_reg_usage)()

----
Also added these functions

   VG_(get_archreg)()
   VG_(get_thread_archreg)()
   VG_(get_thread_shadow_archreg)()
   VG_(set_thread_shadow_archreg)()

which can be useful for skins.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1419 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/vg_skin.h b/include/vg_skin.h
index 638ee82..43702fa 100644
--- a/include/vg_skin.h
+++ b/include/vg_skin.h
@@ -289,8 +289,8 @@
 /* Valgrind doesn't use libc at all, for good reasons (trust us).  So here
    are its own versions of C library functions, but with VG_ prefixes.  Note
    that the types of some are slightly different to the real ones.  Some
-   extra useful functions are provided too; descriptions of how they work
-   are given below. */
+   additional useful functions are provided too; descriptions of how they
+   work are given below. */
 
 #if !defined(NULL)
 #  define NULL ((void*)0)
@@ -726,14 +726,16 @@
 /*=== Instrumenting UCode                                          ===*/
 /*====================================================================*/
 
-/* Find what this instruction does to its regs.  `tag' indicates whether we're
-   considering TempRegs (pre-reg-alloc) or RealRegs (post-reg-alloc).
-   `regs' is filled with the affected register numbers, `isWrites' parallels
-   it and indicates if the reg is read or written.  If a reg is read and
-   written, it will appear twice in `regs'.  `regs' and `isWrites' must be
-   able to fit 3 elements.
+/* Maximum number of registers read or written by a single UInstruction. */
+#define VG_MAX_REGS_USED   3
 
-   Useful for analysis/optimisation passes. */
+/* Find what this instruction does to its regs, useful for
+   analysis/optimisation passes.  `tag' indicates whether we're considering
+   TempRegs (pre-reg-alloc) or RealRegs (post-reg-alloc).  `regs' is filled
+   with the affected register numbers, `isWrites' parallels it and indicates
+   if the reg is read or written.  If a reg is read and written, it will
+   appear twice in `regs'.  `regs' and `isWrites' must be able to fit
+   VG_MAX_REGS_USED elements. */
 extern Int VG_(get_reg_usage) ( UInstr* u, Tag tag, Int* regs, Bool* isWrites );
 
 
@@ -836,11 +838,17 @@
                                    Int sz, Bool parens );
 
 /* ------------------------------------------------------------------ */
-/* Accessing shadow archregs */
+/* Accessing archregs and their shadows */
+extern UInt VG_(get_archreg)            ( UInt archreg );
+extern UInt VG_(get_thread_archreg)     ( ThreadId tid, UInt archreg );
+
 extern UInt VG_(get_shadow_archreg)     ( UInt archreg );
 extern void VG_(set_shadow_archreg)     ( UInt archreg, UInt val );
 extern Addr VG_(shadow_archreg_address) ( UInt archreg );
 
+extern UInt VG_(get_thread_shadow_archreg) ( ThreadId tid, UInt archreg );
+extern void VG_(set_thread_shadow_archreg) ( ThreadId tid, UInt archreg,
+                                             UInt val );
 
 /* ------------------------------------------------------------------ */
 /* Offsets of addresses of helper functions.  A "helper" function is one