標籤:gcc 原始碼 分析
gcc原始碼分析,debug_rtx()函數,利器啊
print-tree.c
#include "config.h"
#include "tree.h"
#include <stdio.h>
/* Names of tree components.
Used for printing out the tree and error messages. */
#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
char *tree_code_name[] = {
#include "tree.def"
};
#undef DEFTREECODE
同樣的debug_tree()函數放在哪裡才有用是個重要而有用的問題,
只有看完相關的代碼才能知道。
我認為放到expr.c檔案中比較好。
if (mode != Pmode && modifier == EXPAND_SUM)
modifier = EXPAND_NORMAL;
fprintf(stderr ,"expand_expr code = %x\n",code);
debug_tree (exp);
/* Ensure we reference a volatile object even if value is ignored. */
if (ignore && TREE_THIS_VOLATILE (exp)
&& mode != VOIDmode && mode != BLKmode)
{
target = gen_reg_rtx (mode);
temp = expand_expr (exp, target, VOIDmode, modifier);
if (temp != target)
emit_move_insn (target, temp);
return target;
}
switch (code) /*再這個關鍵的分支處,之前列印出文法樹是個明智的選擇*/
{
case PARM_DECL:
if (DECL_RTL (exp) == 0)
{
error_with_decl (exp, "prior parameter‘s size depends on `%s‘");
return const0_rtx;
}
case FUNCTION_DECL:
case VAR_DECL:
gcc原始碼分析,debug_tree()函數,又一利器啊