[Prev][Next][Index]

Sage doubts




I have 3 questions regarding sage usage.
Your help will be very much appreciated.

Question 1:
-----------
This is regarding the following member functions of SgStatement.
 int hasSymbol();
 SgSymbol * symbol();

the manual says the following about them:
//returns TRUE if stmt has a symbol.

// returns the symbol field.
// used by loop headers to point to the loop variable symbol; Used by 
// function and subroutine headers to point to function name.

They seem to work fine for function statements. But symbol() returns NULL
for a loop statement and does not return any loop variable symbol. 

Given a for loop statement like " for(i=0; i<10; i++) "
I assume that 'i' is the loop variable symbol.


Question 2:
-----------
While traversing through a program using sage,
I need to know when a given Symbol was assigned its current 
value. (ie. its previous reference when it was probably in the lhs of an
assignment statement). what is the best way to do that using sage.


Question 3:
-----------
this is about the SgBasicBlockStatement.
I need to identify all the basic blocks within { } in the program. My
simple test program segment to print it out is as below:

     SgBasicBlockStmt *sbbs;
          if(sbbs = isSgBasicBlockStmt(s)) 
          {
                printf(" BASIC BLOCK is \n");
                s->unparsestdout();
                printf("\n\n");
          }

this is done while traversing through each statement in the program.
But I do not get anything in the output. Can you clarify exactly what
type of basic blocks it will identify.

please give me your suggestions on these.

Thanks in advance.

Arun

-------------------------------------------------------------------------
Arun P Muthukumar                       phone  :  606-257-4926  (off)
Dept.of Electrical Eng.                 WWW-URL: www.engr.uky.edu/~arunp
Univ.of Kentucky
Lexington.                              E-mail :  arunp@engr.uky.edu
-------------------------------------------------------------------------