Author: yug Date: 2011-11-19 09:46:56 -0500 (Sat, 19 Nov 2011) New Revision: 3817
Modified: trunk/osprey/be/cg/x8664/cgtarget.cxx trunk/osprey/be/com/be_symtab.cxx trunk/osprey/be/com/be_symtab.h trunk/osprey/be/com/wn_lower.cxx Log: fix bug916. asm constraint 'i' wrong assertion enable pattern like 'i'(p&v). Also introduce the TARG_NVISA code lda for class BE_PREG, solve preg can't get lda expression issue like below: struct u{ int a; void (*f)(void); } p; int main(void) { void * ret__; asm volatile ("mov %" "1"",%0" : "=r" (ret__) : "i" (&(p.f))); asm volatile ("mov %" "1"",%0" : "=r" (ret__) : "i" (&(p.f))); return 0; } code review: Lai Jian-Xin. Modified: trunk/osprey/be/cg/x8664/cgtarget.cxx =================================================================== --- trunk/osprey/be/cg/x8664/cgtarget.cxx 2011-11-19 14:27:08 UTC (rev 3816) +++ trunk/osprey/be/cg/x8664/cgtarget.cxx 2011-11-19 14:46:56 UTC (rev 3817) @@ -106,6 +106,8 @@ #include "cg_loop.h" #include "config_lno.h" // for LNO_Prefetch_Ahead #include "erbe.h" +#include "stblock.h" //for Base_Symbol_And_Offset_For_Addressing +#include "be_symtab.h" //Preg_Lda UINT32 CGTARG_branch_taken_penalty; BOOL CGTARG_branch_taken_penalty_overridden = FALSE; @@ -3407,7 +3409,7 @@ : (C) == 'L' ? (VALUE) == 0xff || (VALUE) == 0xffff \ : (C) == 'M' ? (VALUE) >= 0 && (VALUE) <= 3 \ : (C) == 'N' ? (VALUE) >= 0 && (VALUE) <= 255 \ - : (C) == 'i' ? ((VALUE) >> 32) == 0 || ((VALUE) >> 32) == -1 \ + : (C) == 'i' ? 1 \ : (C) == 'n' ? 1 \ : 0) @@ -3493,11 +3495,22 @@ if (load && WN_operator(load)==OPR_LDID && WN_class(load)==CLASS_PREG) { // immediate could have been put in preg by wopt - load = Preg_Is_Rematerializable(WN_load_offset(load), NULL); + if (Preg_Is_Rematerializable(WN_load_offset(load), NULL)) { + load = Preg_Is_Rematerializable(WN_load_offset(load), NULL); + } + // shared load(lda) has been lifted to preg + else if (Preg_Lda(WN_load_offset(load))) { + load = Preg_Lda(WN_load_offset(load)); + } + else { + load = NULL; + } } if (!(load && (WN_operator(load) == OPR_INTCONST || (WN_operator(load) == OPR_LDA && - ST_sym_class(WN_st(load)) == CLASS_CONST)))) { + // &var.field is also allowed, bug916 open64.net + (ST_sym_class(WN_st(load)) == CLASS_VAR || + ST_sym_class(WN_st(load)) == CLASS_CONST))))) { ErrMsgSrcpos(EC_Invalid_Asm_Constrain, WN_Get_Linenum(asm_wn), ": Cannot find immediate operand for ASM"); } @@ -3510,7 +3523,19 @@ ErrMsgSrcpos(EC_Invalid_Asm_Constrain, WN_Get_Linenum(asm_wn), ": The value of immediate operand supplied is not within expected range."); } + if (Is_Target_32bit() && (WN_const_val(load) > INT32_MAX || WN_const_val(load) < INT32_MIN)) { + char c[200]; + sprintf(c,"%lld", WN_const_val(load)); + ErrMsgSrcpos(EC_Ill_Int_Oflow, WN_Get_Linenum(asm_wn), + INT32_MIN,c,INT32_MAX); + } } + else if (ST_sym_class(WN_st(load)) == CLASS_VAR) { + ST *base; + INT64 ofst; + Base_Symbol_And_Offset_For_Addressing (WN_st(load), WN_lda_offset(load), &base, &ofst); + ret_tn = Gen_Symbol_TN(base,ofst,0); + } else { // Bug 14390: string constant with an immediate constraint Modified: trunk/osprey/be/com/be_symtab.cxx =================================================================== --- trunk/osprey/be/com/be_symtab.cxx 2011-11-19 14:27:08 UTC (rev 3816) +++ trunk/osprey/be/com/be_symtab.cxx 2011-11-19 14:46:56 UTC (rev 3817) @@ -327,7 +327,7 @@ } -#ifdef TARG_NVISA + // Search tree for a LDA, returning NULL if not found. // Will search through preg homes to find LDA. // Can also return LDID if is LDID of parameter pointer. @@ -348,6 +348,7 @@ if (lda) return lda; return Find_Lda (Preg_Home(WN_offset(tree))); } +#ifdef TARG_NVISA else if (ST_sclass(WN_st(tree)) == SCLASS_FORMAL && ST_in_shared_mem(WN_st(tree))) { @@ -382,6 +383,7 @@ return tree; } } +#endif return NULL; case OPR_ADD: case OPR_SUB: @@ -400,4 +402,4 @@ return NULL; } } -#endif + Modified: trunk/osprey/be/com/be_symtab.h =================================================================== --- trunk/osprey/be/com/be_symtab.h 2011-11-19 14:27:08 UTC (rev 3816) +++ trunk/osprey/be/com/be_symtab.h 2011-11-19 14:46:56 UTC (rev 3817) @@ -504,21 +504,13 @@ class BE_PREG { private: WN *home_location; -#ifdef TARG_NVISA WN *lda; -#endif public: -#ifdef TARG_NVISA BE_PREG(void) : home_location(NULL), lda(NULL) { } -#else - BE_PREG(void) : home_location(NULL) { } -#endif void Set_home_location(WN *wn) { home_location = wn; } WN *Home_location(void) const { return home_location; } -#ifdef TARG_NVISA void Set_lda(WN *wn) { lda = wn; } WN *Lda(void) const { return lda; } -#endif }; typedef RELATED_SEGMENTED_ARRAY<BE_PREG> BE_PREG_TAB; @@ -543,7 +535,7 @@ return (idx < Be_preg_tab.Size()) ? Be_preg_tab[idx].Home_location() : NULL; } -#ifdef TARG_NVISA + static inline WN* Preg_Lda(PREG_NUM preg) { @@ -561,8 +553,8 @@ // Will search through preg homes to find LDA. // Can also return LDID if is LDID of parameter pointer. extern WN* Find_Lda (WN *tree); -#endif + extern void BE_symtab_initialize_be_scopes(void); extern void BE_symtab_free_be_scopes(void); extern void BE_symtab_alloc_scope_level(SYMTAB_IDX); Modified: trunk/osprey/be/com/wn_lower.cxx =================================================================== --- trunk/osprey/be/com/wn_lower.cxx 2011-11-19 14:27:08 UTC (rev 3816) +++ trunk/osprey/be/com/wn_lower.cxx 2011-11-19 14:46:56 UTC (rev 3817) @@ -1439,14 +1439,14 @@ type = TY_mtype(Ty_Table[ty]); pregNo = Create_Preg(type, current_preg_name); -#ifdef TARG_NVISA + // we need to track what memory is being accessed when storing // an lda into a preg. So if tree has an lda, or indirects to lda // through another preg, put that in preg table. WN *lda = Find_Lda (tree); if (lda) Set_Preg_Lda (pregNo, lda); -#endif + { WN *stBlock, *stid; @@ -8041,7 +8041,6 @@ } } -#ifdef TARG_NVISA if ( Action (LOWER_TO_CG) && (WN_class(tree) == CLASS_PREG) && (! Preg_Is_Dedicated (WN_store_offset (tree)))) @@ -8051,8 +8050,8 @@ WN *lda = Find_Lda (WN_kid0(tree)); if (lda) Set_Preg_Lda (WN_store_offset(tree), lda); } -#endif + if (WN_StoreIsUnused(tree)) { WN *eval; ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel