このページを編集する際は,編集に関する方針に従ってください.[]
概要[]
- gcc-4.1.0/gcc/tree.cにて定義
- オペランドが2つの木の構築
引数[]
- enum tree_code code
- tree tt
- データタイプ(ポインタであるなど)をあらわす
- tree arg0
- tree arg1
- MEM_STAT_DECL
実装[]
- arg0とarg1の処理をするためのマクロ
2804 #define PROCESS_ARG(N) \
2805 do { \
- オペランドに登録する
2806 TREE_OPERAND (t, N) = arg##N; \
- argによりフラグが変わってくる
2807 if (arg##N &&!TYPE_P (arg##N)) \
2808 { \
2809 if (TREE_SIDE_EFFECTS (arg##N)) \
2810 side_effects = 1; \
2811 if (!TREE_READONLY (arg##N)) \
2812 read_only = 0; \
2813 if (!TREE_CONSTANT (arg##N)) \
2814 constant = 0; \
2815 if (!TREE_INVARIANT (arg##N)) \
2816 invariant = 0; \
2817 } \
2818 } while (0)
2819
2820 tree
2821 build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
2822 {
2823 bool constant, read_only, side_effects, invariant;
2824 tree t;
2825
- オペランドの数が2であるはず
2826 gcc_assert (TREE_CODE_LENGTH (code) == 2);
2827
- codeに対応する木の作成
2828 t = make_node_stat (code PASS_MEM_STAT);
2829 TREE_TYPE (t) = tt;
2830
2831 /* Below, we automatically set TREE_SIDE_EFFECTS and TREE_READONLY for the
2832 result based on those same flags for the arguments. But if the
2833 arguments aren't really even `tree' expressions, we shouldn't be trying
2834 to do this. */
2835
2836 /* Expressions without side effects may be constant if their
2837 arguments are as well. */
2838 constant = (TREE_CODE_CLASS (code) == tcc_comparison
2839 || TREE_CODE_CLASS (code) == tcc_binary);
2840 read_only = 1;
2841 side_effects = TREE_SIDE_EFFECTS (t);
2842 invariant = constant;
2843
2844 PROCESS_ARG(0);
2845 PROCESS_ARG(1);
2846
- 2838-2845行で決定したフラグの代入
2847 TREE_READONLY (t) = read_only;
2848 TREE_CONSTANT (t) = constant;
2849 TREE_INVARIANT (t) = invariant;
2850 TREE_SIDE_EFFECTS (t) = side_effects;
2851 TREE_THIS_VOLATILE (t)
2852 = (TREE_CODE_CLASS (code) == tcc_reference
2853 && arg0 && TREE_THIS_VOLATILE (arg0));
2854
2855 return t;
2856 }