Author: shihui Date: 2011-04-11 03:23:21 -0400 (Mon, 11 Apr 2011) New Revision: 3544
Modified: trunk/osprey/be/com/constraint_graph.cxx Log: Fix bug760: ConstraintGraph::processFlatInitvals is invoked when INITO isFlatArrayOrStruct, this includes INITVKIND_VAL, INITVKIND_PAD and INITV_BLKIsFlat. However in ConstraintGraph::processFlatInitvals it only allow formal be INITVKIND_VAL or INITVKIND_PAD. Fix 1. allow INITV_BLKIsFlat INITV as ConstraintGraph::processFlatInitvals input, extract the block content. 2. Move static bool INITV_BLKIsFlat(INITV_IDX initv_idx) ahead ConstraintGraph::processFlatInitvals for visibility. Code Review: Jian-Xin Modified: trunk/osprey/be/com/constraint_graph.cxx =================================================================== --- trunk/osprey/be/com/constraint_graph.cxx 2011-04-11 07:19:32 UTC (rev 3543) +++ trunk/osprey/be/com/constraint_graph.cxx 2011-04-11 07:23:21 UTC (rev 3544) @@ -981,6 +981,21 @@ return tmpCGNode; } +static bool INITV_BLKIsFlat(INITV_IDX initv_idx) +{ + const INITV &initv = Initv_Table[initv_idx]; + if (INITV_kind(initv) == INITVKIND_BLOCK) { + // only has one child is val or pad + INITV_IDX child_initv_idx = INITV_blk(initv); + if ((INITV_kind(child_initv_idx) == INITVKIND_VAL || + INITV_kind(child_initv_idx) == INITVKIND_PAD) && + INITV_next(child_initv_idx) == 0) { + return true; + } + } + return false; +} + // This just recursively processes all initvs starting from initv_idx // and adds any nodes that correspond to symbols to pts void @@ -1038,9 +1053,13 @@ FmtAssert(TY_kind(ty) == KIND_ARRAY || TY_kind(ty) == KIND_STRUCT, ("Expecting KIND_ARRAY or KIND_STRUCT")); FmtAssert(INITV_kind(Initv_Table[initv_idx]) == INITVKIND_VAL || - INITV_kind(Initv_Table[initv_idx]) == INITVKIND_PAD, - ("Expecting INITVKIND_VAL or INITVKIND_PAD")); + INITV_kind(Initv_Table[initv_idx]) == INITVKIND_PAD || + INITV_BLKIsFlat(initv_idx), + ("Expecting INITVKIND_VAL, INITVKIND_PAD or flat BLK")); UINT32 size = 0; + if(INITV_BLKIsFlat(initv_idx)) { + initv_idx = INITV_blk(initv_idx); + } // Iterate over all INITVKIND_VALs/PADs until size of ty while (size < TY_size(ty) && initv_idx != 0) { used_repeat++; @@ -1090,22 +1109,7 @@ return valList; } -static bool INITV_BLKIsFlat(INITV_IDX initv_idx) -{ - const INITV &initv = Initv_Table[initv_idx]; - if(INITV_kind(initv) == INITVKIND_BLOCK) { - // only has one child is val or pad - INITV_IDX child_initv_idx = INITV_blk(initv); - if((INITV_kind(child_initv_idx) == INITVKIND_VAL || - INITV_kind(child_initv_idx) == INITVKIND_PAD) && - INITV_next(child_initv_idx) == 0) { - return true; - } - } - return false; -} - static bool isFlatArrayOrStruct(TY &ty, INITV_IDX initv_idx) { ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel