首页 > 其他 > 详细

gcc源代码分析,expand_expr_stmt()函数

时间:2014-01-20 23:03:15      阅读:439      评论:0      收藏:0      [点我收藏+]

终于调用的顺序清楚了,yyparse()函数调用了expand_expr_stmt()函数,expand_expr_stmt()函数调用了expand_expr()函数。

下面的语法规则对应printf("Hello,World!\n");。


stmt:
      compstmt    {}
    | expr ‘;‘
        { emit_line_note (input_filename, lineno);
          /* Do default conversion if safe and possibly important,
             in case within ({...}).  */
          if ((TREE_CODE (TREE_TYPE ($1)) == ARRAY_TYPE
               && lvalue_p ($1))
              || TREE_CODE (TREE_TYPE ($1)) == FUNCTION_TYPE)
            $1 = default_conversion ($1);
          expand_expr_stmt ($1);
          clear_momentary (); }




/* Generate RTL to evaluate the expression EXP

   and remember it in case this is the VALUE in a ({... VALUE; }) constr.  */

void
expand_expr_stmt (exp)
     tree exp;
{
  /* If -W, warn about statements with no side effects,
     except inside a ({...}) where they may be useful.  */
  if (expr_stmts_for_value == 0 && exp != error_mark_node)
    {
      if (! TREE_VOLATILE (exp) && (extra_warnings || warn_unused))
    warning_with_file_and_line (emit_filename, emit_lineno,
                    "statement with no effect");
      else if (warn_unused)
    warn_if_unused_value (exp);
    }
  last_expr_type = TREE_TYPE (exp);
  if (! flag_syntax_only)
    last_expr_value = expand_expr (exp, expr_stmts_for_value ? 0 : const0_rtx,
                   VOIDmode, 0);
  emit_queue ();
}

gcc源代码分析,expand_expr_stmt()函数

原文:http://blog.csdn.net/oldlinux/article/details/18449979

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!