Difference: CS255Spring08Discussions (22 vs. 23)

Revision 232008-02-21 - KonstantinosMenychtas

Line: 1 to 1
 
META TOPICPARENT name="CS255Spring08"

CS255/455 Spring 2008 Questions and Answers

Line: 6 to 6
 
Changed:
<
<
Q: For the scanf function, are the temporary variable statements that we need to move those that have the variables on the right hand side (instead of the left hand side as in the printf)?
>
>
Q: How much of tree-vn.c can we use ? For project 3, we need VEC and hash from data structs I guess, but there 's a whole lot of functionality there that might not be considered ssa stuff.

A:


Q: For the scanf function, are the temporary variable statements that we need to move those that have the variables on the right hand side (instead of the left hand side as in the printf)?
  A: Since scanf reads values to variables directly, there is no need to move any temporary variable assignment with scanf. The project description has been adjusted. Thanks for the question. (ChenDing)
Line: 26 to 31
  I am not familiar with NEXT CHAIN (the name seems a macro) but I wonder whether its problem has something to do with the NULL stmt. In addition, if you can print mylist through some function, then I would check how that function iterates through the list in spite of the problem with NEXT CHAIN. Please post what you find. (ChenDing)
Added:
>
>
A NEXT CHAIN is a very useful macro which is used to build an easy to handle list from any tree. However, I have not been able to build such a list of my own, rather I did manage to manipulate, for example, the number of arguments of a var-arg function like printf with its iternal wacky representation. This is what Xiaoming suggests, I hadn't noticed and I found it on my own. I guess your suggestion about the problem explains what I experienced, but I cannot remember. The statement list carries some more information used in some certain occasions (I remember so), but at least I did manage to use it to build a list:

tree lemon_tree = alloc_stmt_list();
tree_stmt_iterator lemon_counter;
tree fools, garden; /* quiz */

append_to_statement_list(fools, &lemon_tree);
append_to_statement_list(garden, &lemon_tree);

for (lemon_counter = tsi_last(lemon_tree); !tsi_end_p (lemon_counter); tsi_prev(&lemon_counter))
{
      tree lemon= tsi_stmt (lemon_counter);
      squeeze(lemon); /* this function just says make use of it */
}

At c-semantics they have some push/pop functions, I didn't use it though. In all, I highly doubt it might be of any use to me again, NEXT CHAIN is important, if somebody can make a concrete build/use-list example with it please post it.

 
Q: Given a tree node, i.e. call expr, how do you extract the function name from the node?
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding URCS? Send feedback