Author: shihui
Date: 2011-04-13 06:26:44 -0400 (Wed, 13 Apr 2011)
New Revision: 3550
Modified:
trunk/osprey/be/com/constraint_graph.cxx
trunk/osprey/be/com/constraint_graph.h
Log:
Fix bug750:
In ConstraintGraph::processExpr
If expr is adding pointer with an unknown offset, the added pointer may points
to ohter unknown offset.
The processing for this case is, conservatively adjust pointer's CG Node ST's
modulus according to pointer's type.
AdjustPointsToForKCycle is used for this purpose, kcycle value got from pointed
type's size.
Current implementation get pointed type from CGNODE's ST, which is incorrect
when it's different with WN node's Type.
In this bug, cgnode's ST's type is derived class type, WN node's type is base
class type.
So node's modulus need change from derived calss's size to base class's size.
Fix is in ConstraintGraph::processExpr, when setting kcycle, if Wn has pecified
TY, use WN node's type.
Code Review: Jian-Xin
Modified: trunk/osprey/be/com/constraint_graph.cxx
===================================================================
--- trunk/osprey/be/com/constraint_graph.cxx 2011-04-13 09:59:03 UTC (rev
3549)
+++ trunk/osprey/be/com/constraint_graph.cxx 2011-04-13 10:26:44 UTC (rev
3550)
@@ -996,6 +996,20 @@
return false;
}
+// get WN node's TY, used for determin kcycle
+TY&
+ConstraintGraph::getTY(const WN* wn, const ConstraintGraphNode* node)
+{
+ if (OPERATOR_has_1ty(WN_operator(wn))) {
+ TY_IDX ty_idx = WN_ty(wn);
+ return Ty_Table[ty_idx];
+ }
+ else {
+ ST *st = &St_Table[SYM_ST_IDX(node->cg_st_idx())];
+ return Ty_Table[ST_type(st)];
+ }
+}
+
// This just recursively processes all initvs starting from initv_idx
// and adds any nodes that correspond to symbols to pts
void
@@ -1878,8 +1892,7 @@
// size of the pointed-to type.
if (!kid0CGNode->checkFlags(CG_NODE_FLAGS_NOT_POINTER) &&
kid1CGNode->checkFlags(CG_NODE_FLAGS_NOT_POINTER)) {
- ST *st = &St_Table[SYM_ST_IDX(kid0CGNode->cg_st_idx())];
- TY &ty = Ty_Table[ST_type(st)];
+ TY &ty = getTY(WN_kid0(expr), kid0CGNode);
INT32 size = 1;
if (TY_kind(ty) == KIND_POINTER)
size = TY_size(Ty_Table[TY_pointed(ty)]);
@@ -1893,8 +1906,7 @@
// Check the other kid
if (!kid1CGNode->checkFlags(CG_NODE_FLAGS_NOT_POINTER) &&
kid0CGNode->checkFlags(CG_NODE_FLAGS_NOT_POINTER)) {
- ST *st = &St_Table[SYM_ST_IDX(kid1CGNode->cg_st_idx())];
- TY &ty = Ty_Table[ST_type(st)];
+ TY &ty = getTY(WN_kid1(expr), kid1CGNode);
INT32 size = 1;
if (TY_kind(ty) == KIND_POINTER)
size = TY_size(Ty_Table[TY_pointed(ty)]);
@@ -1913,14 +1925,12 @@
// is of a pointer type, set it to the size of the pointed-to type.
// Compute size from first kid
INT32 size0 = 1;
- ST *kid0st = &St_Table[SYM_ST_IDX(kid0CGNode->cg_st_idx())];
- TY &kid0ty = Ty_Table[ST_type(kid0st)];
+ TY &kid0ty = getTY(WN_kid0(expr), kid0CGNode);
if (TY_kind(kid0ty) == KIND_POINTER)
size0 = TY_size(Ty_Table[TY_pointed(kid0ty)]);
// Compute size from other kid
INT32 size1 = 1;
- ST *kid1st = &St_Table[SYM_ST_IDX(kid1CGNode->cg_st_idx())];
- TY &kid1ty = Ty_Table[ST_type(kid1st)];
+ TY &kid1ty = getTY(WN_kid1(expr), kid1CGNode);
if (TY_kind(kid1ty) == KIND_POINTER)
size1 = TY_size(Ty_Table[TY_pointed(kid1ty)]);
Modified: trunk/osprey/be/com/constraint_graph.h
===================================================================
--- trunk/osprey/be/com/constraint_graph.h 2011-04-13 09:59:03 UTC (rev
3549)
+++ trunk/osprey/be/com/constraint_graph.h 2011-04-13 10:26:44 UTC (rev
3550)
@@ -1624,6 +1624,8 @@
ConstraintGraphNode *genTempCGNode();
+ TY& getTY(const WN* wn, const ConstraintGraphNode* node);
+
UINT32 findMaxTypeSize();
void buildCGFromSummary();
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel