From: Julian Seward Date: Mon, 8 Nov 2004 18:55:47 +0000 (+0000) Subject: Call specialised report-a-value-error helper functions rather than X-Git-Tag: svn/VALGRIND_3_0_1^2~804 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38d1343963ae543b48439a69d2393abf2185efa2;p=thirdparty%2Fvalgrind.git Call specialised report-a-value-error helper functions rather than endlessly having to pass a size parameter to a generic one. git-svn-id: svn://svn.valgrind.org/vex/trunk@530 --- diff --git a/VEX/head20041019/memcheck/mc_include.h b/VEX/head20041019/memcheck/mc_include.h index d294530d0a..101d63a570 100644 --- a/VEX/head20041019/memcheck/mc_include.h +++ b/VEX/head20041019/memcheck/mc_include.h @@ -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 ); diff --git a/VEX/head20041019/memcheck/mc_translate.c b/VEX/head20041019/memcheck/mc_translate.c index 0c1fcb28f2..f5c963de1e 100644 --- a/VEX/head20041019/memcheck/mc_translate.c +++ b/VEX/head20041019/memcheck/mc_translate.c @@ -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));