Advertisement

このページを編集する際は,編集に関する方針に従ってください.

概要

引数

実装

2713 tree
2714 build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
2715 {
2716   int length = sizeof (struct tree_exp);
2717 #ifdef GATHER_STATISTICS
2718   tree_node_kind kind;
2719 #endif
2720   tree t;
2721 

~

2722 #ifdef GATHER_STATISTICS
2723   switch (TREE_CODE_CLASS (code))
2724     {
2725     case [[tcc_statement>enum tree_code_class]]:  /* an expression with side effects */
2726       kind = [[s_kind>tree_node_kind]];
2727       break;
2728     case [[tcc_reference>enum tree_code_class]]:  /* a reference */
2729       kind = [[r_kind>tree_node_kind]];
2730       break;
2731     default:
2732       kind = [[e_kind>tree_node_kind]];
2733       break;
2734     }
2735 
2736   tree_node_counts[(int) kind]++;
2737   tree_node_sizes[(int) kind] += length;
2738 #endif

~
*領域を確保して0で埋める

2739 
2740   gcc_assert (TREE_CODE_LENGTH (code) == 1);
2741 
2742   t = ggc_alloc_zone_pass_stat (length, &tree_zone);
2743 
2744   memset (t, 0, sizeof (struct tree_common));
2745 

~
*初期化

2746   TREE_SET_CODE (t, code);
2747 
2748   TREE_TYPE (t) = type;
2749 #ifdef USE_MAPPED_LOCATION
2750   SET_EXPR_LOCATION (t, UNKNOWN_LOCATION);
2751 #else
2752   SET_EXPR_LOCUS (t, NULL);
2753 #endif
2754   TREE_COMPLEXITY (t) = 0;
2755   TREE_OPERAND (t, 0) = node;
2756   TREE_BLOCK (t) = NULL_TREE;
2757   if (node && !TYPE_P (node))
2758     {
2759       TREE_SIDE_EFFECTS (t) = TREE_SIDE_EFFECTS (node);
2760       TREE_READONLY (t) = TREE_READONLY (node);
2761     }
2762 
2763   if (TREE_CODE_CLASS (code) == [[tcc_statement>enum tree_code_class]])
2764     TREE_SIDE_EFFECTS (t) = 1;
2765   else switch (code)
2766     {
2767     case [[VA_ARG_EXPR>enum tree_code]]:
 2768       /* All of these have side-effects, no matter what their
 2769          operands are.  */
2770       TREE_SIDE_EFFECTS (t) = 1;
2771       TREE_READONLY (t) = 0;
2772       break;
2773 
2774     case [[MISALIGNED_INDIRECT_REF>enum tree_code]]:
2775     case [[ALIGN_INDIRECT_REF>enum tree_code]]:
2776     case [[INDIRECT_REF>enum tree_code]]:
 2777       /* Whether a dereference is readonly has nothing to do with whether
 2778          its operand is readonly.  */
2779       TREE_READONLY (t) = 0;
2780       break;
2781 
2782     case [[ADDR_EXPR>enum tree_code]]:
2783       if (node)
2784         recompute_tree_invarant_for_addr_expr (t);
2785       break;
2786 
2787     default:
2788       if (TREE_CODE_CLASS (code) == [[tcc_unary>enum tree_code_class]]
2789           && node && !TYPE_P (node)
2790           && TREE_CONSTANT (node))
2791         TREE_CONSTANT (t) = 1;
2792       if (TREE_CODE_CLASS (code) == [[tcc_unary>enum tree_code_class]]
2793           && node && TREE_INVARIANT (node))
2794         TREE_INVARIANT (t) = 1;
2795       if (TREE_CODE_CLASS (code) == [[tcc_reference>enum tree_code_class]]
2796           && node && TREE_THIS_VOLATILE (node))
2797         TREE_THIS_VOLATILE (t) = 1;
2798       break;
2799     }
2800 
2801   return t;
2802 }


リンク元

特に記載のない限り、コミュニティのコンテンツはCC-BY-SAライセンスの下で利用可能です。