sagexx_attr (1158315), страница 3
Текст из файла (страница 3)
The attribute isattached to outermost loops statements only.16if (doloop = isSgForStmt(temp)){depg = (depGraph *) doloop->attributeValue(0,DEPGRAPH_ATTRIBUTE);if (depg){// some computation here using the dep graph;}}class depGraph {depNode*current;depNode*first;depNode*last;public:SgFile *file;Set *arrayRef;Set *induc;SgSymbol*tsymb[MAXNESTEDLOOP];intloopnum;SgStatement *func;SgStatement *loop;int perfectNestedLevel;int nbstmt;SgStatement **tabstat;int *tabtag;////////list of dependence (also stored inthe DEPENDENCE_ATTRIBUTE)first depNodelast depNode// the file// same as ACCESS_ATTRIBUTE// same as INDUCTION_ATTRIBUTE// array of the loop nest symbol// (internal use)// internal use// the function the loop belongs to// the outermost loop// number of perfectly nested level// internal use// internal use//internal usedepGraph(SgFile *fi, SgStatement *f,SgStatement *l);~depGraph();void addAnEdge(SgStatement *sin,SgStatement *sout,SgExpression *vin,SgExpression *vout,int tdep, int kdep,int *dist, int *kdist,int le);depNode *firstNode();// set current on the first depNodenextEdge();// set current on next depNode;void display();// display the data dependence;void scalarRefAnalysis(SgStatement *loop);// do the scalar analysisvoid redoScalarRefAnalysis(SgStatement *loop); // redo the scalar analysis for a// an enclosed loop// useful to parallelize innermost// loops for instance// more there for internal purpose;};17USEDLIST ATTRIBUTE : for each statement, contains the list of used variables.
Theseattributes are attached to executable statements only. Here is an example of how toaccess the attribute :SgStatement *stmt;// a statementSgExpression *use, *varaccess; // this is an expression list node;for (use = (SgExpression *) stmt->attributeValue(0,USEDLIST_ATTRIBUTE);use; use = use->rhs()){varaccess =use->lhs();......if (isSgArrayRefExp(varaccess)) // for instance{......}}DEFINEDLIST ATTRIBUTE : for each statement, contains the list of dened variables. These attributes are attached to executable statements only.SgStatement *stmt; // a statementSgExpression *def; // this is an expression list node;def = (SgExpression *) stmt->attributeValue(0,DEFINEDLIST_ATTRIBUTE);4.3 Limitations and Bugs1. The data dependence graph attributes cannot yet be saved to a le.18.