Author: xiaohua_zhang Date: 2010-10-19 18:49:38 -0400 (Tue, 19 Oct 2010) New Revision: 3377
Modified: trunk/osprey/be/cg/MIPS/cgtarget.cxx trunk/osprey/be/cg/NVISA/cgtarget.cxx trunk/osprey/be/cg/SL/cgtarget.cxx trunk/osprey/be/cg/cgtarget.h trunk/osprey/be/cg/ia64/cgtarget.cxx trunk/osprey/be/cg/loongson/cgtarget.cxx trunk/osprey/be/cg/ppc32/cgtarget.cxx trunk/osprey/be/cg/whirl2ops.cxx trunk/osprey/be/cg/x8664/cgtarget.cxx trunk/osprey/be/com/erbe.desc trunk/osprey/be/com/erbe.h Log: Bug 605 - Assertion failure at line 3174 of osprey/be/cg/x8664/cgtarget.cxx ### Cannot find immediate operand for ASM The test case is negative test, the gcc emitts error message: The gcc 4.6.0 emits following error: bug605.c: In function 'foo': bug605.c:6:3: warning: asm operand 0 probably doesn't match constraints [enabled by default] bug605.c:7:3: warning: asm operand 0 probably doesn't match constraints [enabled by default] The fix is to report an error instead of generating assertion. Modified: trunk/osprey/be/cg/MIPS/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/MIPS/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/MIPS/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -1977,7 +1977,8 @@ CGTARG_TN_For_Asm_Operand (const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass, TYPE_ID id) + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn, TYPE_ID id) { // skip constraint modifiers: // = input and output parameters are separated in the WHIRL for ASM Modified: trunk/osprey/be/cg/NVISA/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/NVISA/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/NVISA/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -1796,7 +1796,8 @@ CGTARG_TN_For_Asm_Operand (const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass, + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn, TYPE_ID type) { // skip constraint modifiers: Modified: trunk/osprey/be/cg/SL/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/SL/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/SL/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -1970,7 +1970,8 @@ CGTARG_TN_For_Asm_Operand (const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass, TYPE_ID id) + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn, TYPE_ID id) { // skip constraint modifiers: // = input and output parameters are separated in the WHIRL for ASM Modified: trunk/osprey/be/cg/cgtarget.h =================================================================== --- trunk/osprey/be/cg/cgtarget.h 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/cgtarget.h 2010-10-19 22:49:38 UTC (rev 3377) @@ -810,12 +810,14 @@ extern TN* CGTARG_TN_For_Asm_Operand(const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass); + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn); #else extern TN* CGTARG_TN_For_Asm_Operand(const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass, + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn, TYPE_ID type); #endif Modified: trunk/osprey/be/cg/ia64/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/ia64/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/ia64/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -3561,7 +3561,8 @@ CGTARG_TN_For_Asm_Operand (const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass) + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn) { // skip constraint modifiers: // = input and output parameters are separated in the WHIRL for ASM Modified: trunk/osprey/be/cg/loongson/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/loongson/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/loongson/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -1951,7 +1951,8 @@ CGTARG_TN_For_Asm_Operand(const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass) + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn) { // skip constraint modifiers: // = input and output parameters are separated in the WHIRL for ASM Modified: trunk/osprey/be/cg/ppc32/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/ppc32/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/ppc32/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -1864,7 +1864,8 @@ CGTARG_TN_For_Asm_Operand (const char* constraint, const WN* load, TN* pref_tn, - ISA_REGISTER_SUBCLASS* subclass) + ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn) { // skip constraint modifiers: // = input and output parameters are separated in the WHIRL for ASM Modified: trunk/osprey/be/cg/whirl2ops.cxx =================================================================== --- trunk/osprey/be/cg/whirl2ops.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/whirl2ops.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -6649,9 +6649,9 @@ ISA_REGISTER_SUBCLASS subclass = ISA_REGISTER_SUBCLASS_UNDEFINED; #if defined(TARG_IA64) || defined(TARG_PPC32) || defined(TARG_LOONGSON) - TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass); + TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass, asm_wn); #else - TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass, + TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass, asm_wn, default_type); #endif @@ -6714,9 +6714,9 @@ ISA_REGISTER_SUBCLASS subclass = ISA_REGISTER_SUBCLASS_UNDEFINED; #if defined(TARG_IA64) || defined(TARG_PPC32) || defined(TARG_LOONGSON) - TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass); + TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass, asm_wn); #else - TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass, + TN* tn = CGTARG_TN_For_Asm_Operand(constraint, load, pref_tn, &subclass, asm_wn, MTYPE_I4); #endif Modified: trunk/osprey/be/cg/x8664/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/x8664/cgtarget.cxx 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/cg/x8664/cgtarget.cxx 2010-10-19 22:49:38 UTC (rev 3377) @@ -105,6 +105,7 @@ #include "calls.h" #include "cg_loop.h" #include "config_lno.h" // for LNO_Prefetch_Ahead +#include "erbe.h" UINT32 CGTARG_branch_taken_penalty; BOOL CGTARG_branch_taken_penalty_overridden = FALSE; @@ -3111,6 +3112,7 @@ const WN* load, TN* pref_tn, ISA_REGISTER_SUBCLASS* subclass, + const WN* asm_wn, TYPE_ID type) { // skip constraint modifiers: @@ -3185,17 +3187,21 @@ // immediate could have been put in preg by wopt load = Preg_Is_Rematerializable(WN_load_offset(load), NULL); } - FmtAssert(load && (WN_operator(load) == OPR_INTCONST || + if (!(load && (WN_operator(load) == OPR_INTCONST || (WN_operator(load) == OPR_LDA && - ST_sym_class(WN_st(load)) == CLASS_CONST)), - ("Cannot find immediate operand for ASM")); + ST_sym_class(WN_st(load)) == CLASS_CONST)))) { + ErrMsgSrcpos(EC_Invalid_Asm_Constrain, WN_Get_Linenum(asm_wn), + ": Cannot find immediate operand for ASM"); + } if (WN_operator(load) == OPR_INTCONST) { ret_tn = Gen_Literal_TN(WN_const_val(load), MTYPE_bit_size(WN_rtype(load))/8); // Bugs 3177, 3043 - safety check from gnu/config/i386/i386.h. - FmtAssert(CONST_OK_FOR_LETTER(WN_const_val(load), *constraint), - ("The value of immediate operand supplied is not within expected range.")); + if (!CONST_OK_FOR_LETTER(WN_const_val(load), *constraint)) { + ErrMsgSrcpos(EC_Invalid_Asm_Constrain, WN_Get_Linenum(asm_wn), + ": The value of immediate operand supplied is not within expected range."); + } } else { Modified: trunk/osprey/be/com/erbe.desc =================================================================== --- trunk/osprey/be/com/erbe.desc 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/com/erbe.desc 2010-10-19 22:49:38 UTC (rev 3377) @@ -339,6 +339,10 @@ 1, ET_INT, 0,0,0,0 }, #endif /* TARG_NVISA */ + { EC_Invalid_Asm_Constrain, EM_User | ES_ERRABORT, RAG_EN_NONE, + "Invalid 'asm' constrain %s", + 1, ET_STRING, 0,0,0,0 }, + /* All error descriptor lists must end with a -1 error code: */ { -1, 0, RAG_EN_NONE, "", 0, 0,0,0,0,0,0 } }; Modified: trunk/osprey/be/com/erbe.h =================================================================== --- trunk/osprey/be/com/erbe.h 2010-10-19 09:34:01 UTC (rev 3376) +++ trunk/osprey/be/com/erbe.h 2010-10-19 22:49:38 UTC (rev 3377) @@ -190,9 +190,11 @@ #define EC_Ptr_Assumed_Global EC_BASE_BE+152 #define EC_Load_Past_Struct EC_BASE_BE+153 #define EC_Shared_Atomic64_Opnd EC_BASE_BE+154 -#define EC_Memset_Too_Large EC_BASE_BE+155 /* int */ +#define EC_Memset_Too_Large EC_BASE_BE+155 /* int */ #endif /* TARG_NVISA */ +#define EC_Invalid_Asm_Constrain EC_BASE_BE+156 /* str */ + #ifdef __cplusplus } #endif ------------------------------------------------------------------------------ Download new Adobe(R) Flash(R) Builder(TM) 4 The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly Flex(R) Builder(TM)) enable the development of rich applications that run across multiple browsers and platforms. Download your free trials today! http://p.sf.net/sfu/adobe-dev2dev _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel