]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Call specialised report-a-value-error helper functions rather than
authorJulian Seward <jseward@acm.org>
Mon, 8 Nov 2004 18:55:47 +0000 (18:55 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 8 Nov 2004 18:55:47 +0000 (18:55 +0000)
endlessly having to pass a size parameter to a generic one.

git-svn-id: svn://svn.valgrind.org/vex/trunk@530

VEX/head20041019/memcheck/mc_include.h
VEX/head20041019/memcheck/mc_translate.c

index d294530d0a7135a11cc540f09615e13f3ab8c6c5..101d63a570816d57b7b0fffba2a31a0873200922 100644 (file)
@@ -115,6 +115,8 @@ extern Bool MC_(clo_avoid_strlen_errors);
 
 /* Functions defined in mc_main.c */
 extern REGPARM(1) void MC_(helperc_complain_undef) ( HWord );
+extern void MC_(helperc_value_check4_fail) ( void );
+extern void MC_(helperc_value_check0_fail) ( void );
 
 extern REGPARM(1) void MC_(helperc_STOREV8) ( Addr, ULong );
 extern REGPARM(2) void MC_(helperc_STOREV4) ( Addr, UInt );
index 0c1fcb28f2bb8d6fdc9af6ce72bac7a6b42df7aa..f5c963de1e5044f5bacf3a1862e78f26dd505344 100644 (file)
@@ -479,8 +479,6 @@ static void setHelperAnns ( MCEnv* mce, IRDirty* di ) {
 */
 static void complainIfUndefined ( MCEnv* mce, IRAtom* atom )
 {
-   //static Int zzz=0;
-
    /* Since the original expression is atomic, there's no duplicated
       work generated by making multiple V-expressions for it.  So we
       don't really care about the possibility that someone else may
@@ -498,13 +496,28 @@ static void complainIfUndefined ( MCEnv* mce, IRAtom* atom )
    IRAtom* cond = mkPCastTo( mce, Ity_Bit, vatom );
    /* cond will be 0 if all defined, and 1 if any not defined. */
 
-   IRDirty* di 
-      = unsafeIRDirty_0_N( 1/*regparms*/, 
-                           "MC_(helperc_complain_undef)",
-                           &MC_(helperc_complain_undef),
-                           mkIRExprVec_1( mkIRExpr_HWord( sz 
-                                                          // zzz++
-                        ) ));
+   IRDirty* di;
+   if (sz == 4) {
+      di = unsafeIRDirty_0_N( 0/*regparms*/, 
+                              "MC_(helperc_value_check4_fail)",
+                              &MC_(helperc_value_check4_fail),
+                              mkIRExprVec_0() 
+                            );
+   }
+   else if (sz == 0) {
+      di = unsafeIRDirty_0_N( 0/*regparms*/, 
+                              "MC_(helperc_value_check0_fail)",
+                              &MC_(helperc_value_check0_fail),
+                              mkIRExprVec_0() 
+                            );
+   }
+   else {
+      di = unsafeIRDirty_0_N( 1/*regparms*/, 
+                              "MC_(helperc_complain_undef)",
+                              &MC_(helperc_complain_undef),
+                              mkIRExprVec_1( mkIRExpr_HWord( sz ))
+                            );
+   }
    di->guard = cond;
    setHelperAnns( mce, di );
    stmt( mce->bb, IRStmt_Dirty(di));