#include "ctrump/analyzer/cfg.h"
#include "ctrump/common/bitmap.h"
#include "ctrump/common/varray.h"
#include "ctrump/common/uthash.h"
#include "ctrump/common/intmap.h"
#include "ctrump/common/abort.h"
#include "ctrump/ast/ast.h"
#include "ctrump/analyzer/peel.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
Go to the source code of this file.
Data Structures | |
struct | partial_bb_expr |
partial_bb が保持するexpr More... | |
struct | pending_chain |
あとで更新するポインタのリスト More... | |
struct | ordered_load_store_node |
順序付けられたロードストア More... | |
struct | partial_bb |
解析途中のBB More... | |
struct | partial_var_info |
解析途中の変数 More... | |
struct | label_table |
検索用ラベルテーブル More... | |
struct | build_cfg_env |
build_cfgするのに必要な情報 More... | |
struct | flow_env |
フローの状態 More... | |
Defines | |
#define | zero_bmp ctrump_bmp_zero |
#define | HASH_FIND_SYM(head, findptr, out) HASH_FIND(hh,head,findptr,sizeof(struct ctrump_symbol*),out) |
#define | REDUC_CASE_LHS(ecode, rcode, r) |
#define | CHECK_ERROR(e) {int r = (e); if (r < 0) return r;} |
#define | ALLOC_BB_VEC(aname, numname, vaname) |
#define | COPY_VEC(aname, numname, vaname) |
Enumerations | |
enum | partial_bb_expr_code { BB_EXPR } |
enum | load_store_t { INIT, LOAD, STORE } |
Functions | |
static struct partial_bb * | new_bb (struct build_cfg_env *env, struct ctrump_loop_cfg_info *loop) |
新しくpartial_bbを作る | |
static void | append_succs_maybe (struct partial_bb *bb,struct partial_bb *next, struct build_cfg_env *env) |
bb の後続ブロックにnextを追加する uhrechableなBB(NULL)に対しては何もしない | |
static void | append_succs (struct partial_bb *bb, struct partial_bb *next, struct build_cfg_env *env) |
bb の後続ブロックにnextを追加する nextの先行ブロックにbbを追加する | |
static void | build_cfg_expr_maybe (struct ctrump_expr *e, struct ctrump_stmt *at, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
式のCFGを作る | |
static void | build_cfg_expr (struct ctrump_expr *e, struct ctrump_stmt *at, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
式のCFGを作る | |
static void | build_cfg_initializer (struct ctrump_initializer *init, struct ctrump_stmt *stmt, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
初期化子のCFGを作る | |
static void | build_cfg_initializer_list (struct ctrump_initializer_list *list, struct ctrump_stmt *stmt, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
初期化子リストのCFGを作る | |
static void | delete_table (struct label_table *table) |
ラベルテーブルを削除 | |
static int | build_label_table (struct label_table **table, const struct ctrump_compound_stmt *stmts, struct build_cfg_env *env) |
ラベルテーブルをつくる | |
static int | build_label_ref (struct label_table *table, const struct ctrump_compound_stmt *stmt, struct build_cfg_env *env) |
参照されてるラベルを調べる | |
static int | check_label_use (struct build_cfg_env *env, const struct ctrump_compound_stmt *stmts) |
ラベルテーブルを作る | |
static void | build_cfg_logical_expr (struct ctrump_expr *lhs, struct ctrump_expr *rhs, struct ctrump_stmt *at, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
論理式に対してCFGを作る これ以後もAST式の構造は変化しないが、 論理式の中身は別のBBに保持される点に注意 | |
static void | build_cfg_trinary_cond_expr (struct ctrump_expr *cond, struct ctrump_expr *then_, struct ctrump_expr *else_, struct ctrump_stmt *at, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
条件式に対してCFGを作る | |
static void | build_cfg_cond_expr (struct ctrump_expr *e, struct ctrump_stmt *at, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
式に含まれる論理式に対するCFGを作る 論理式以外は何もしない | |
static void | append_pending (struct build_cfg_env *env, struct partial_bb *bb, struct ctrump_bb **resolve_ptr) |
あとで更新するctrump_bbへのポインタを追加する | |
static struct partial_bb * | get_id_bb (struct build_cfg_env *env, struct ctrump_stmt *stmt, struct ctrump_loop_cfg_info *cur_loop) |
idで示す文を先頭に持つBBを取得 無ければ作る | |
static struct partial_bb * | get_id_bb_maybe (struct build_cfg_env *env, struct ctrump_stmt *stmt, struct ctrump_loop_cfg_info *loop, struct partial_bb *return_to_bb) |
idで示す文を先頭に持つBBを取得 無ければ作る stmt が NULL なら次の文は存在しない(return_toへ飛ぶ) | |
static int | build_cfg_stmt (struct ctrump_stmt *stmt, struct ctrump_stmt *next_stmt,struct build_cfg_env *env, const struct flow_env *flow_env, struct partial_bb **current_bb_ptr) |
文のCFGを作る | |
static int | build_cfg_compound (const struct ctrump_compound_stmt *stmts, struct build_cfg_env *env, const struct flow_env *flow_env, struct partial_bb **current_bb_ptr, struct ctrump_stmt *next_block_stmt) |
複合文に対するCFGを作る | |
static int | dfs_order (struct partial_bb *start, struct build_cfg_env *env, int num_bb, ctrump_bitmap_t bb_bitmap) |
CFGを深さ優先探索で辿った順の配列をつくり、 bb->dfs_order を設定する. | |
static struct partial_bb * | nca (struct partial_bb *x, struct partial_bb *y) |
最近共通祖先(Nearest Common Ancestor)を求める | |
static void | build_dom (struct build_cfg_env *env, int num_bb) |
支配木を作る | |
static void | find_df (struct build_cfg_env *env, int num_bb) |
支配辺境を求める domtree -> dominance frontier | |
static int | insert_phi (struct partial_bb **bbs, int num_bb, struct partial_var_info *var_info, int num_var_info, int id, ctrump_bitmap_t tmp_bitmap, struct ctrump_mempool *cfg_alloc) |
φを挿入する. | |
static struct ctrump_pdg_node * | alloc_pdg_node (struct ctrump_varray *pdg_node_list, struct ctrump_mempool *alloc, struct ctrump_stmt *at, int *id, enum ctrump_pdg_node_code code) |
PDGノードを割り当てる. | |
static int | recog_reductive (struct ctrump_expr *e, struct ctrump_var *v, int is_float, enum ctrump_reductive_expr_code *ret_code, struct ctrump_expr **ret_expr) |
縮約演算を識別する | |
static struct ctrump_pdg_node * | ssa_node_store_expr (enum ctrump_expr_code op_code, struct ctrump_var *var, struct ctrump_expr *store_val, struct ctrump_varray *pdg_node_list, struct ctrump_pdg_node *old_val, struct ctrump_stmt *at, struct ctrump_mempool *alloc, int *id) |
ストア演算の処理 | |
static int | assign_pdg_node_bb (struct ctrump_varray *pdg_node_list, struct partial_bb *bb, struct partial_var_info *var_info, int num_var_info, int id, struct ctrump_mempool *cfg_alloc) |
各式にPDGを割り当てる | |
static int | assign_pdg_node (struct ctrump_varray *pdg_node_list, struct partial_bb *entry, struct partial_var_info *var_info, int num_var_info, int id, struct ctrump_mempool *cfg_alloc) |
各式にPDGを割り当てる | |
static int | extract_load_store_expr_rval (struct ctrump_expr *e, struct ctrump_stmt *at, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
右辺値からロードストアを抜き出す | |
static struct ctrump_subscript * | append_nd_subscript (struct ctrump_varray *subscripts, struct ctrump_varray *nd_subscripts, struct ctrump_subscript *s, struct ctrump_texpr *load_data_texpr, struct ctrump_expr *subscript, struct ctrump_mempool *cfg_alloc) |
配列アクセスの解析 | |
static struct ctrump_subscript * | append_record_member_ref (struct ctrump_varray *subscripts, struct ctrump_varray *nd_subscripts, struct ctrump_subscript *s, struct ctrump_member_ref *ref, struct ctrump_texpr *load_data_type, int is_pointer, struct ctrump_mempool *cfg_alloc) |
メンバアクセスの解析 | |
static int | recog_array_access (struct ctrump_expr **ret_array, struct ctrump_subscript **ret_vec, int *num_ret, struct ctrump_expr *access_expr, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_stmt *at, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
配列アクセスの解析 | |
static void | append_ordered_memop (struct ctrump_varray *memop, enum ctrump_load_store_t load_store, int idx, struct ctrump_mempool *tmp_alloc) |
順序付きメモリ操作の追加 | |
static int | append_memory_store (struct ctrump_varray *store, struct ctrump_varray *ordered, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_stmt *at_stmt, enum ctrump_expr_code store_op, struct ctrump_expr *dest_expr, struct ctrump_expr *val, int flags, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
メモリへのストアを追加 | |
static void | add_var_loadstore (struct partial_bb *bb, enum load_store_t code, int op_idx, int var_idx, struct ctrump_mempool *tmp_alloc) |
メモリへのロードストアを追加 | |
static void | add_var_store (struct partial_bb *bb, struct partial_var_info *vi, struct ctrump_varray *stores, struct ctrump_stmt *at, struct ctrump_var *var, struct ctrump_expr *var_ref_expr, struct ctrump_expr *val_expr, struct ctrump_pdg_node *pdg, enum ctrump_expr_code store_op, int flags, struct ctrump_mempool *tmp_alloc, enum load_store_t store_code) |
メモリへのストアを追加 | |
static int | extract_load_store_assign (enum ctrump_expr_code store_op, struct ctrump_expr *lhs, struct ctrump_expr *val_expr, struct ctrump_stmt *at, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
代入式からロードストアを抜き出す | |
static int | append_memory_load (struct ctrump_varray *aload, struct ctrump_varray *ordered, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_stmt *at_stmt, struct ctrump_expr *load_expr, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
メモリロードを追加 | |
static int | extract_load_store_initializer (struct ctrump_initializer *initializer, struct ctrump_stmt *at, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
初期化子からロードストアを抜き出す | |
static int | extract_load_store_initializer_list (struct ctrump_initializer_list *init_list, struct ctrump_stmt *at, struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
初期化リストからロードストアを抜き出す | |
static int | extract_load_store (struct partial_bb *bb, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, struct ctrump_mempool *cfg_alloc, struct ctrump_mempool *tmp_alloc) |
BBからロードストアを抜き出す. | |
static void | assign_var_info_expr (struct ctrump_varray *info, struct ctrump_intmap *info_map, struct ctrump_expr *e, int num_bb, struct ctrump_mempool *tmp_alloc) |
変数アクセスを抜き出して変数情報を割り当てる | |
static void | assign_var_info_initializer (struct ctrump_varray *var_info_vec, struct ctrump_intmap *var_info_map, struct ctrump_initializer *initializer, int num_bb, struct ctrump_mempool *tmp_alloc) |
初期化子から変数アクセスを抜き出す | |
static void | assign_var_info_initializer_list (struct ctrump_varray *var_info_vec, struct ctrump_intmap *var_info_map, struct ctrump_initializer_list *inits, int num_bb, struct ctrump_mempool *tmp_alloc) |
初期化子リストから変数アクセスを抜き出す | |
static int | assign_var_info (struct partial_bb **bb_vec, int num_bb, struct ctrump_varray *var_info_vec, struct ctrump_intmap *var_info_map, struct ctrump_mempool *tmp_alloc) |
プログラムから変数アクセスを探して必要な情報を割り当てる | |
static void | calc_df (struct partial_bb **dfs_order, int num_bb, struct ctrump_intmap *varinfo_map, int num_var_info, ctrump_bitmap_t tmp_bitmap) |
支配辺境を計算する | |
static void | resolve_bb_vec (struct ctrump_bb **bb_vec, struct ctrump_varray *partial_vec, struct ctrump_bb **basic_blocks) |
partial_bbへのポインタをctrump_bbへのポインタに変換する | |
static int | build_cfg (struct ctrump_cfg *ret, struct ctrump_intmap *var_info_map, struct ctrump_mempool *cfg_pool, struct ctrump_mempool *varmap_pool, const struct ctrump_compound_stmt *stmts, struct build_cfg_env *env) |
CFGを作る. | |
static int | build_cfg_loop (struct ctrump_stmt *body, struct ctrump_expr *exit_cond, struct partial_bb *cond_bb_enter, struct partial_bb *cond_bb_exit, struct partial_bb *return_bb, struct partial_bb *continue_bb_enter, struct partial_bb *continue_bb_exit, struct ctrump_stmt *next_stmt, struct ctrump_loop_cfg_info *loop, struct build_cfg_env *env, struct ctrump_loop_cfg_info *outer_loop, struct partial_bb **current_bb_ptr) |
body ループのCFGを作る | |
static int | build_cfg_for (struct ctrump_loop_cfg_info **loop_ret, struct ctrump_expr *cond, struct ctrump_expr *iter, struct ctrump_stmt *body, struct ctrump_stmt *next_stmt, struct build_cfg_env *env, const struct flow_env *flow_env, struct partial_bb **current_bb_ptr) |
for ループのCFGを作る | |
static int | build_cfg_while (struct ctrump_loop_cfg_info **loop_ret, struct ctrump_expr *cond, struct ctrump_stmt *body, struct ctrump_stmt *next_stmt, struct build_cfg_env *env, const struct flow_env *flow_env, struct partial_bb **current_bb_ptr) |
whileループのCFGを作る | |
static int | build_cfg_do_while (struct ctrump_expr *cond, struct ctrump_stmt *body, struct ctrump_stmt *next_stmt, struct build_cfg_env *env, const struct flow_env *flow_env, struct partial_bb **current_bb_ptr) |
do-whileループのCFGを作る | |
static void | build_cfg_decl (struct ctrump_stmt *stmt, struct ctrump_decl *decl, struct build_cfg_env *env, struct ctrump_loop_cfg_info *cur_loop, struct partial_bb **current_bb_ptr) |
宣言のCFGを作る | |
int | ctrump_build_cfg (struct ctrump_cfg *ret, struct ctrump_intmap *var_info_map, struct ctrump_build_cfg_error *error, const struct ctrump_fundef *def, struct ctrump_mempool *cfg_pool, struct ctrump_mempool *varmap_pool, int num_ast, int id_begin) |
CFGを作る. |
Definition in file cfg.c.
#define ALLOC_BB_VEC | ( | aname, | |||
numname, | |||||
vaname | ) |
Value:
b->aname = ctrump_mempool_alloc(env->cfg_pool, sizeof(struct ctrump_bb*)*pb->vaname.nelem); \ b->numname = pb->vaname.nelem;
Referenced by build_cfg().
#define CHECK_ERROR | ( | e | ) | {int r = (e); if (r < 0) return r;} |
Definition at line 1372 of file cfg.c.
Referenced by append_memory_load(), append_memory_store(), calc_union_size(), ctrump_texpr_size(), extract_load_store(), extract_load_store_assign(), extract_load_store_expr_rval(), extract_load_store_initializer(), extract_load_store_initializer_list(), recog_array_access(), and record_field_offset().
#define COPY_VEC | ( | aname, | |||
numname, | |||||
vaname | ) |
Value:
b->aname = ctrump_varray_copy(&pb->vaname, env->cfg_pool); \ b->numname = pb->vaname.nelem;
Referenced by build_cfg().
#define HASH_FIND_SYM | ( | head, | |||
findptr, | |||||
out | ) | HASH_FIND(hh,head,findptr,sizeof(struct ctrump_symbol*),out) |
Definition at line 191 of file cfg.c.
Referenced by build_cfg_stmt(), build_label_ref(), and build_label_table().
#define REDUC_CASE_LHS | ( | ecode, | |||
rcode, | |||||
r | ) |
Value:
case ecode: \ *ret_code = rcode; \ *ret_expr = r; \ return 1;
Referenced by recog_reductive().
#define zero_bmp ctrump_bmp_zero |
Definition at line 189 of file cfg.c.
Referenced by assign_var_info_expr(), build_cfg(), classify_memop(), ctrump_build_cfg(), ctrump_find_iv_node(), and init_analyze_loop_node_info().
enum load_store_t |
enum partial_bb_expr_code |
static void add_var_loadstore | ( | struct partial_bb * | bb, | |
enum load_store_t | code, | |||
int | op_idx, | |||
int | var_idx, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
メモリへのロードストアを追加
Definition at line 1640 of file cfg.c.
References ordered_load_store_node::code, ordered_load_store_node::op_idx, partial_bb::ordered_load_store, VA_LAST_PTR, VA_NEWELEM_P, and ordered_load_store_node::var_idx.
Referenced by add_var_store(), and extract_load_store_expr_rval().
static void add_var_store | ( | struct partial_bb * | bb, | |
struct partial_var_info * | vi, | |||
struct ctrump_varray * | stores, | |||
struct ctrump_stmt * | at, | |||
struct ctrump_var * | var, | |||
struct ctrump_expr * | var_ref_expr, | |||
struct ctrump_expr * | val_expr, | |||
struct ctrump_pdg_node * | pdg, | |||
enum ctrump_expr_code | store_op, | |||
int | flags, | |||
struct ctrump_mempool * | tmp_alloc, | |||
enum load_store_t | store_code | |||
) | [static] |
メモリへのストアを追加
Definition at line 1658 of file cfg.c.
References add_var_loadstore(), ctrump_var_store::at, ctrump_bitmap_set(), ctrump_var_store::flags, ctrump_cfg_var_info::index, partial_bb::kill, partial_var_info::modified_at, ctrump_varray::nelem, partial_bb::order, partial_var_info::result, ctrump_var_store::store_op, VA_LAST_PTR, VA_NEWELEM_P, ctrump_var_store::val, ctrump_var_store::var, and ctrump_var_store::var_ref.
Referenced by extract_load_store_assign().
static struct ctrump_pdg_node* alloc_pdg_node | ( | struct ctrump_varray * | pdg_node_list, | |
struct ctrump_mempool * | alloc, | |||
struct ctrump_stmt * | at, | |||
int * | id, | |||
enum ctrump_pdg_node_code | code | |||
) | [static, read] |
PDGノードを割り当てる.
Definition at line 915 of file cfg.c.
References ctrump_pdg_node::at, ctrump_pdg_node::code, ctrump_mempool_alloc, ctrump_pdg_node::id, and VA_PUSH.
Referenced by assign_pdg_node(), assign_pdg_node_bb(), and ssa_node_store_expr().
static int append_memory_load | ( | struct ctrump_varray * | aload, | |
struct ctrump_varray * | ordered, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_stmt * | at_stmt, | |||
struct ctrump_expr * | load_expr, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
メモリロードを追加
Definition at line 1760 of file cfg.c.
References append_ordered_memop(), ctrump_memory_access::array, ctrump_memory_access::at_expr, ctrump_memory_access::at_stmt, CHECK_ERROR, CTRUMP_MEMORY_LOAD, extract_load_store_expr_rval(), ctrump_memory_access::flags, ctrump_memory_load::mem_access, ctrump_varray::nelem, ctrump_memory_access::num_subscript, recog_array_access(), ctrump_memory_access::subscripts, VA_LAST_PTR, and VA_NEWELEM_P.
Referenced by extract_load_store_expr_rval().
static int append_memory_store | ( | struct ctrump_varray * | store, | |
struct ctrump_varray * | ordered, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_stmt * | at_stmt, | |||
enum ctrump_expr_code | store_op, | |||
struct ctrump_expr * | dest_expr, | |||
struct ctrump_expr * | val, | |||
int | flags, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
メモリへのストアを追加
Definition at line 1590 of file cfg.c.
References append_ordered_memop(), ctrump_memory_access::array, ctrump_memory_access::at_expr, ctrump_memory_access::at_stmt, CHECK_ERROR, CTRUMP_MEMORY_STORE, extract_load_store_expr_rval(), ctrump_memory_access::flags, ctrump_memory_store::mem_access, ctrump_varray::nelem, ctrump_memory_access::num_subscript, recog_array_access(), ctrump_memory_store::store_op, ctrump_memory_access::subscripts, VA_LAST_PTR, VA_NEWELEM_P, and ctrump_memory_store::val.
Referenced by extract_load_store_assign().
static struct ctrump_subscript* append_nd_subscript | ( | struct ctrump_varray * | subscripts, | |
struct ctrump_varray * | nd_subscripts, | |||
struct ctrump_subscript * | s, | |||
struct ctrump_texpr * | load_data_texpr, | |||
struct ctrump_expr * | subscript, | |||
struct ctrump_mempool * | cfg_alloc | |||
) | [static, read] |
配列アクセスの解析
Definition at line 1378 of file cfg.c.
References ctrump_texpr::array, ctrump_subscript_nd::array_coef, ctrump_texpr::code, ctrump_subscript_nd::code, ctrump_subscript_coef_array::coef, ctrump_is_scalar_type(), CTRUMP_SUBSCRIPT_COEF_ARRAY, CTRUMP_SUBSCRIPT_LOAD_RECORD, CTRUMP_SUBSCRIPT_TERMINAL, CTRUMP_TYPE_STRUCT, CTRUMP_TYPE_UNION, ctrump_varray_copy(), ctrump_subscript_coef_array::expr, ctrump_subscript_coef_load_record::expr, ctrump_subscript_terminal::expr, ctrump_subscript_nd::load_record, ctrump_subscript_coef_load_record::load_type, ctrump_subscript_terminal::load_type, ctrump_subscript::nd_subscripts, ctrump_varray::nelem, ctrump_subscript::num_nd_subscript, ctrump_array_type::size, ctrump_subscript_nd::terminal, ctrump_texpr::u, ctrump_subscript_nd::u, VA_LAST_PTR, and VA_NEWELEM.
Referenced by recog_array_access().
static void append_ordered_memop | ( | struct ctrump_varray * | memop, | |
enum ctrump_load_store_t | load_store, | |||
int | idx, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
順序付きメモリ操作の追加
Definition at line 1575 of file cfg.c.
References ctrump_ordered_memory_load_store_node::code, ctrump_ordered_memory_load_store_node::op_index, VA_LAST_PTR, and VA_NEWELEM_P.
Referenced by append_memory_load(), and append_memory_store().
static void append_pending | ( | struct build_cfg_env * | env, | |
struct partial_bb * | bb, | |||
struct ctrump_bb ** | resolve_ptr | |||
) | [static] |
あとで更新するctrump_bbへのポインタを追加する
partial_bb はあとでctrump_bbに変換されるが、 解析途中は、ctrump_bbが存在していない。
解析途中にctrump_bbへのポインタを設定することが必要になった場合(ループなど) その時点では、ctrump_bbが存在しないため、あとで設定する必要がでてくる。
そういう時は、partial_bb の resolve_pending に設定したいポインタのポインタ を繋いでおくと、partial_bb → ctrump_bbへの変換時に、 resolve_pending へ繋いでおいたポインタは、変換後のctrump_bbを指すように 更新される
Definition at line 515 of file cfg.c.
References pending_chain::chain, ctrump_mempool_alloc, partial_bb::resolve_pending, pending_chain::resolve_ptr, and build_cfg_env::tmp_alloc.
Referenced by build_cfg_loop().
static struct ctrump_subscript* append_record_member_ref | ( | struct ctrump_varray * | subscripts, | |
struct ctrump_varray * | nd_subscripts, | |||
struct ctrump_subscript * | s, | |||
struct ctrump_member_ref * | ref, | |||
struct ctrump_texpr * | load_data_type, | |||
int | is_pointer, | |||
struct ctrump_mempool * | cfg_alloc | |||
) | [static, read] |
メンバアクセスの解析
Definition at line 1429 of file cfg.c.
References ctrump_subscript_nd::code, ctrump_is_scalar_type(), ctrump_retrieve_pointer_type(), CTRUMP_SUBSCRIPT_RECORD_MEMBER, CTRUMP_SUBSCRIPT_RECORD_MEMBER_TERMINAL, ctrump_subscript_record_member_terminal::load_type, ctrump_subscript_record_member::member_name, ctrump_member_ref::member_name, ctrump_subscript_record_member_terminal::member_name, ctrump_member_ref::obj_expr, ctrump_subscript_nd::record_member, ctrump_subscript_nd::record_member_terminal, ctrump_subscript_record_member::record_type, ctrump_subscript_record_member_terminal::record_type, ctrump_expr::type, ctrump_subscript_nd::u, VA_LAST_PTR, and VA_NEWELEM.
Referenced by recog_array_access().
static void append_succs | ( | struct partial_bb * | bb, | |
struct partial_bb * | next, | |||
struct build_cfg_env * | env | |||
) | [static] |
bb の後続ブロックにnextを追加する nextの先行ブロックにbbを追加する
Definition at line 549 of file cfg.c.
References build_cfg_env::tmp_alloc, and VA_PUSH_P.
Referenced by append_succs_maybe(), build_cfg_for(), build_cfg_logical_expr(), build_cfg_loop(), build_cfg_stmt(), and build_cfg_trinary_cond_expr().
static void append_succs_maybe | ( | struct partial_bb * | bb, | |
struct partial_bb * | next, | |||
struct build_cfg_env * | env | |||
) | [static] |
bb の後続ブロックにnextを追加する uhrechableなBB(NULL)に対しては何もしない
Definition at line 563 of file cfg.c.
References append_succs().
Referenced by build_cfg(), build_cfg_do_while(), build_cfg_loop(), and build_cfg_stmt().
static int assign_pdg_node | ( | struct ctrump_varray * | pdg_node_list, | |
struct partial_bb * | entry, | |||
struct partial_var_info * | var_info, | |||
int | num_var_info, | |||
int | id, | |||
struct ctrump_mempool * | cfg_alloc | |||
) | [static] |
各式にPDGを割り当てる
Definition at line 1317 of file cfg.c.
References alloc_pdg_node(), assign_pdg_node_bb(), ctrump_pdg_node::code, CTRUMP_PDG_VALUE_ARG, CTRUMP_PDG_VALUE_GLOBAL, CTRUMP_PDG_VALUE_UNINITIALIZED, CTRUMP_STOR_CLASS_ARGMENT, CTRUMP_STOR_CLASS_EXTDEF, CTRUMP_STOR_CLASS_EXTERN, CTRUMP_STOR_CLASS_STATIC, ctrump_varray_discard(), ctrump_varray_init(), and VA_PUSH.
Referenced by build_cfg().
static int assign_pdg_node_bb | ( | struct ctrump_varray * | pdg_node_list, | |
struct partial_bb * | bb, | |||
struct partial_var_info * | var_info, | |||
int | num_var_info, | |||
int | id, | |||
struct ctrump_mempool * | cfg_alloc | |||
) | [static] |
各式にPDGを割り当てる
Definition at line 1210 of file cfg.c.
References alloc_pdg_node(), ctrump_var_store::at, partial_bb::children, ordered_load_store_node::code, ctrump_fixme, CTRUMP_PDG_VALUE_PHI, ctrump_varray::elements, INIT, LOAD, ctrump_varray::nelem, ctrump_var_store::new_val, ctrump_phi_node::nodes, partial_bb::num_phi, ordered_load_store_node::op_idx, partial_bb::ordered_load_store, ctrump_varref_expr::pdg, ctrump_pdg_node::phi, partial_bb::phi_nodes, ctrump_var_ref::ref_expr, ssa_node_store_expr(), partial_var_info::ssa_var_stack, STORE, ctrump_var_store::store_op, partial_bb::stores, ctrump_expr::u, ctrump_pdg_node::u, VA_POP, VA_PUSH, VA_TOP, ctrump_var_store::val, ctrump_var_store::var, ordered_load_store_node::var_idx, ctrump_phi_node::var_index, and ctrump_expr::varref.
Referenced by assign_pdg_node().
static int assign_var_info | ( | struct partial_bb ** | bb_vec, | |
int | num_bb, | |||
struct ctrump_varray * | var_info_vec, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
プログラムから変数アクセスを探して必要な情報を割り当てる
Definition at line 2291 of file cfg.c.
References assign_var_info_expr(), partial_bb::bb, BB_EXPR, partial_bb_expr::code, ctrump_varray::nelem, and partial_bb_expr::u.
Referenced by build_cfg().
static void assign_var_info_expr | ( | struct ctrump_varray * | info, | |
struct ctrump_intmap * | info_map, | |||
struct ctrump_expr * | e, | |||
int | num_bb, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
変数アクセスを抜き出して変数情報を割り当てる
Definition at line 2114 of file cfg.c.
References ctrump_call_expr::args, ctrump_expr::arr_ref, ctrump_arr_ref_expr::array, ctrump_expr::binary, ctrump_expr::call, ctrump_expr::cast, ctrump_expr::code, ctrump_cond_expr::cond, ctrump_expr::cond, CTRUMP_CASE_BIN_ARITH_EXPR, CTRUMP_CASE_BIN_EQ_EXPR, CTRUMP_CASE_BIN_LOG_EXPR, CTRUMP_CASE_BIN_OP_ASSIGN_EXPR, CTRUMP_CASE_CONSTANT_TERM, CTRUMP_EXPR_ARRREF, CTRUMP_EXPR_BIN_ASSIGN, CTRUMP_EXPR_BIN_COMMA, CTRUMP_EXPR_CALL, CTRUMP_EXPR_CAST, CTRUMP_EXPR_CONDITIONAL, CTRUMP_EXPR_EMPTY, CTRUMP_EXPR_IMPLICIT_CAST, CTRUMP_EXPR_INITIALIZER, CTRUMP_EXPR_IVTMP, CTRUMP_EXPR_MACRO_EXPAND, CTRUMP_EXPR_MEMBER_REF, CTRUMP_EXPR_PAREN, CTRUMP_EXPR_PTR_MEMBER_REF, CTRUMP_EXPR_TEXT, CTRUMP_EXPR_UNA_ADDR, CTRUMP_EXPR_UNA_BCMPL, CTRUMP_EXPR_UNA_LNEG, CTRUMP_EXPR_UNA_NEG, CTRUMP_EXPR_UNA_POS, CTRUMP_EXPR_UNA_POST_DEC, CTRUMP_EXPR_UNA_POST_INC, CTRUMP_EXPR_UNA_PRE_DEC, CTRUMP_EXPR_UNA_PRE_INC, CTRUMP_EXPR_UNA_PTRREF, CTRUMP_EXPR_VARREF, ctrump_fixme, ctrump_intmap_lookup_add(), ctrump_unreachable, ctrump_paren_expr::expr, ctrump_unary_expr::expr, ctrump_implicit_cast_expr::expr, ctrump_cast_expr::expr, ctrump_call_expr::func_expr, ctrump_var::id, ctrump_expr::implicit_cast, ctrump_cfg_var_info::index, ctrump_binary_expr::lhs, ctrump_expr::member_ref, partial_var_info::modified_at, ctrump_varray::nelem, ctrump_call_expr::num_args, ctrump_member_ref::obj_expr, ctrump_expr::paren, partial_var_info::result, ctrump_binary_expr::rhs, ctrump_arr_ref_expr::subscript, ctrump_expr::u, ctrump_expr::unary, VA_LAST_PTR, VA_NEWELEM_P, ctrump_intmap_bucket::val, ctrump_cfg_var_info::var, ctrump_varref_expr::var, ctrump_expr::varref, and zero_bmp.
Referenced by assign_var_info(), assign_var_info_initializer(), and assign_var_info_initializer_list().
static void assign_var_info_initializer | ( | struct ctrump_varray * | var_info_vec, | |
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_initializer * | initializer, | |||
int | num_bb, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
初期化子から変数アクセスを抜き出す
Definition at line 2264 of file cfg.c.
References assign_var_info_expr(), assign_var_info_initializer_list(), ctrump_initializer::code, CTRUMP_INITIALIZER_EMPTY, CTRUMP_INITIALIZER_EXPR, CTRUMP_INITIALIZER_NESTED, ctrump_initializer::expr, ctrump_initializer::nest, and ctrump_initializer::u.
Referenced by assign_var_info_initializer_list().
static void assign_var_info_initializer_list | ( | struct ctrump_varray * | var_info_vec, | |
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_initializer_list * | inits, | |||
int | num_bb, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
初期化子リストから変数アクセスを抜き出す
Definition at line 2234 of file cfg.c.
References assign_var_info_expr(), assign_var_info_initializer(), ctrump_designator::code, CTRUMP_DESIGNATOR_INDEX, ctrump_initializer_list_elem::designators_list, ctrump_initializer_list::elems, ctrump_designator_index::index, ctrump_designator::index, ctrump_initializer_list_elem::initializer, ctrump_initializer_list_elem::num_designator, ctrump_initializer_list::num_elem, and ctrump_designator::u.
Referenced by assign_var_info_initializer().
static int build_cfg | ( | struct ctrump_cfg * | ret, | |
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_mempool * | cfg_pool, | |||
struct ctrump_mempool * | varmap_pool, | |||
const struct ctrump_compound_stmt * | stmts, | |||
struct build_cfg_env * | env | |||
) | [static] |
CFGを作る.
Definition at line 2379 of file cfg.c.
References ctrump_cfg::addressed, ALLOC_BB_VEC, append_succs_maybe(), assign_pdg_node(), assign_var_info(), ctrump_cfg::basic_blocks, build_cfg_env::basic_blocks, partial_bb::bb, BB_EXPR, build_cfg_env::bb_id, flow_env::break_to, build_cfg_compound(), build_dom(), calc_df(), build_cfg_env::cfg_pool, pending_chain::chain, partial_bb::children, partial_bb_expr::code, flow_env::continue_to, COPY_VEC, ctrump_bitmap_set(), ctrump_intmap_init_pool(), ctrump_intmap_iterator_begin(), ctrump_intmap_iterator_next(), ctrump_intmap_resize_pool(), ctrump_mempool_alloc, CTRUMP_STOR_CLASS_ARGMENT, CTRUMP_STOR_CLASS_AUTO, CTRUMP_STOR_CLASS_AUTO_UNSPECIFIED, ctrump_varray_discard(), ctrump_varray_init(), ctrump_varray_init_pool(), ctrump_bb::dfs, build_cfg_env::dfs_order, dfs_order(), ctrump_bb::dom_children, ctrump_varray::elements, build_cfg_env::error, partial_bb_expr::expr, ctrump_bb::exprs, extract_load_store(), find_df(), partial_bb::flags, ctrump_bb::flags, ctrump_cfg::global, ctrump_cfg::head, partial_bb::id, ctrump_bb::id, ctrump_bb::id_in_cfg, insert_phi(), ctrump_bb::kill, partial_bb::kill, ctrump_bb::live, partial_bb::live, ctrump_bb::loop_belong_to, partial_bb::loop_cfg, flow_env::loop_cfg, partial_var_info::map_val, ctrump_phi_node::merge_at, ctrump_varray::nelem, new_bb(), build_cfg_env::next_id, ctrump_cfg::num_bb, ctrump_bb::num_exprs, partial_bb::num_phi, ctrump_bb::num_phi, ctrump_bb::num_var, ctrump_cfg::num_var, partial_bb::phi_inserted, partial_bb::phi_nodes, ctrump_bb::phi_nodes, ctrump_bb::preds, resolve_bb_vec(), partial_bb::resolve_pending, pending_chain::resolve_ptr, partial_var_info::result, flow_env::return_to, ctrump_var::stor_class, ctrump_bb::succs, ctrump_cfg::tail, build_cfg_env::tmp_alloc, partial_bb_expr::u, ctrump_bb::use, partial_bb::use, VA_ELEM, ctrump_intmap_bucket::val, ctrump_cfg_var_info::var, OffloadSpe::var, ctrump_cfg::var_info, and zero_bmp.
Referenced by ctrump_build_cfg().
static int build_cfg_compound | ( | const struct ctrump_compound_stmt * | stmts, | |
struct build_cfg_env * | env, | |||
const struct flow_env * | flow_env, | |||
struct partial_bb ** | current_bb_ptr, | |||
struct ctrump_stmt * | next_block_stmt | |||
) | [static] |
複合文に対するCFGを作る
Definition at line 663 of file cfg.c.
References build_cfg_stmt(), ctrump_compound_stmt::items, and ctrump_compound_stmt::num_item.
Referenced by build_cfg(), and build_cfg_stmt().
static void build_cfg_cond_expr | ( | struct ctrump_expr * | e, | |
struct ctrump_stmt * | at, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | cur_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
式に含まれる論理式に対するCFGを作る 論理式以外は何もしない
Definition at line 395 of file cfg.c.
References ctrump_call_expr::args, ctrump_expr::arr_ref, ctrump_arr_ref_expr::array, ctrump_expr::binary, build_cfg_initializer_list(), build_cfg_logical_expr(), build_cfg_trinary_cond_expr(), ctrump_expr::call, ctrump_expr::cast, ctrump_expr::code, ctrump_cond_expr::cond, ctrump_expr::cond, CTRUMP_CASE_ALL_UNARY_EXPR, CTRUMP_CASE_BIN_ARITH_EXPR, CTRUMP_CASE_BIN_EQ_EXPR, CTRUMP_CASE_BIN_LOG_EXPR, CTRUMP_CASE_BIN_OP_ASSIGN_EXPR, CTRUMP_CASE_CONSTANT_TERM, CTRUMP_EXPR_ARRREF, CTRUMP_EXPR_BIN_ASSIGN, CTRUMP_EXPR_BIN_COMMA, CTRUMP_EXPR_CALL, CTRUMP_EXPR_CAST, CTRUMP_EXPR_CONDITIONAL, CTRUMP_EXPR_EMPTY, CTRUMP_EXPR_IMPLICIT_CAST, CTRUMP_EXPR_INITIALIZER, CTRUMP_EXPR_IVTMP, CTRUMP_EXPR_MACRO_EXPAND, CTRUMP_EXPR_MEMBER_REF, CTRUMP_EXPR_PAREN, CTRUMP_EXPR_PTR_MEMBER_REF, CTRUMP_EXPR_TEXT, CTRUMP_EXPR_VARREF, ctrump_unreachable, ctrump_cond_expr::else_, ctrump_macro_expand_expr::expanded, ctrump_implicit_cast_expr::expr, ctrump_cast_expr::expr, ctrump_paren_expr::expr, ctrump_unary_expr::expr, ctrump_call_expr::func_expr, ctrump_expr::implicit_cast, ctrump_initializer_expr::initializer, ctrump_expr::initializer, ctrump_binary_expr::lhs, ctrump_expr::macro_expand, ctrump_expr::member_ref, ctrump_call_expr::num_args, ctrump_member_ref::obj_expr, ctrump_expr::paren, ctrump_binary_expr::rhs, ctrump_arr_ref_expr::subscript, ctrump_cond_expr::then_, ctrump_expr::u, and ctrump_expr::unary.
Referenced by build_cfg_expr().
static void build_cfg_decl | ( | struct ctrump_stmt * | stmt, | |
struct ctrump_decl * | decl, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | cur_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
宣言のCFGを作る
Definition at line 2863 of file cfg.c.
References build_cfg_initializer(), ctrump_decl::decls, ctrump_decl_with_init::initializer, and ctrump_decl::num_decls.
Referenced by build_cfg_stmt().
static int build_cfg_do_while | ( | struct ctrump_expr * | cond, | |
struct ctrump_stmt * | body, | |||
struct ctrump_stmt * | next_stmt, | |||
struct build_cfg_env * | env, | |||
const struct flow_env * | flow_env, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
do-whileループのCFGを作る
Definition at line 2760 of file cfg.c.
References append_succs_maybe(), flow_env::break_to, build_cfg_expr_maybe(), build_cfg_stmt(), flow_env::continue_to, get_id_bb(), get_id_bb_maybe(), flow_env::loop_cfg, and flow_env::return_to.
Referenced by build_cfg_stmt().
static void build_cfg_expr | ( | struct ctrump_expr * | e, | |
struct ctrump_stmt * | at, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | cur_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
式のCFGを作る
Definition at line 482 of file cfg.c.
References partial_bb_expr::at, partial_bb::bb, BB_EXPR, build_cfg_cond_expr(), partial_bb_expr::code, partial_bb_expr::expr, build_cfg_env::tmp_alloc, partial_bb_expr::u, VA_LAST_PTR, and VA_NEWELEM_P.
Referenced by build_cfg_expr_maybe(), build_cfg_for(), build_cfg_logical_expr(), build_cfg_trinary_cond_expr(), and build_cfg_while().
static void build_cfg_expr_maybe | ( | struct ctrump_expr * | e, | |
struct ctrump_stmt * | at, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | cur_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
式のCFGを作る
Definition at line 532 of file cfg.c.
References build_cfg_expr().
Referenced by build_cfg_do_while(), build_cfg_initializer(), build_cfg_initializer_list(), and build_cfg_stmt().
static int build_cfg_for | ( | struct ctrump_loop_cfg_info ** | loop_ret, | |
struct ctrump_expr * | cond, | |||
struct ctrump_expr * | iter, | |||
struct ctrump_stmt * | body, | |||
struct ctrump_stmt * | next_stmt, | |||
struct build_cfg_env * | env, | |||
const struct flow_env * | flow_env, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
for ループのCFGを作る
Definition at line 2688 of file cfg.c.
References append_succs(), build_cfg_expr(), build_cfg_loop(), build_cfg_env::cfg_pool, ctrump_mempool_alloc, flow_env::loop_cfg, new_bb(), and flow_env::return_to.
Referenced by build_cfg_stmt().
static void build_cfg_initializer | ( | struct ctrump_initializer * | init, | |
struct ctrump_stmt * | stmt, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
初期化子のCFGを作る
Definition at line 2839 of file cfg.c.
References build_cfg_expr_maybe(), build_cfg_initializer_list(), ctrump_initializer::code, CTRUMP_INITIALIZER_EMPTY, CTRUMP_INITIALIZER_EXPR, CTRUMP_INITIALIZER_NESTED, ctrump_initializer::expr, ctrump_initializer::nest, and ctrump_initializer::u.
Referenced by build_cfg_decl(), and build_cfg_initializer_list().
static void build_cfg_initializer_list | ( | struct ctrump_initializer_list * | list, | |
struct ctrump_stmt * | stmt, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
初期化子リストのCFGを作る
Definition at line 2803 of file cfg.c.
References build_cfg_expr_maybe(), build_cfg_initializer(), ctrump_designator::code, CTRUMP_DESIGNATOR_IDENT, CTRUMP_DESIGNATOR_INDEX, ctrump_initializer_list_elem::designators_list, ctrump_initializer_list::elems, ctrump_designator_index::index, ctrump_designator::index, ctrump_initializer_list_elem::initializer, ctrump_initializer_list_elem::num_designator, ctrump_initializer_list::num_elem, and ctrump_designator::u.
Referenced by build_cfg_cond_expr(), and build_cfg_initializer().
static void build_cfg_logical_expr | ( | struct ctrump_expr * | lhs, | |
struct ctrump_expr * | rhs, | |||
struct ctrump_stmt * | at, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | cur_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
論理式に対してCFGを作る これ以後もAST式の構造は変化しないが、 論理式の中身は別のBBに保持される点に注意
a + (b && c); xxyy は、式としては構文解析後から変わらず↓こういう形になるが、 (+ a (&& b c)) xxyy
BBとしては、
bb0 : (+ a (&& b bb1 : c)) bb2 : xxyy
となる
Definition at line 332 of file cfg.c.
References append_succs(), build_cfg_expr(), and new_bb().
Referenced by build_cfg_cond_expr().
static int build_cfg_loop | ( | struct ctrump_stmt * | body, | |
struct ctrump_expr * | exit_cond, | |||
struct partial_bb * | cond_bb_enter, | |||
struct partial_bb * | cond_bb_exit, | |||
struct partial_bb * | return_bb, | |||
struct partial_bb * | continue_bb_enter, | |||
struct partial_bb * | continue_bb_exit, | |||
struct ctrump_stmt * | next_stmt, | |||
struct ctrump_loop_cfg_info * | loop, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | outer_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
body ループのCFGを作る
exit_cond | ループのbody(条件式除く) | |
cond_bb_enter | 条件式の入り口 | |
cond_bb_exit | 条件式の出口 | |
return_bb | returnで抜ける先 | |
continue_bb_enter | continueした先の式の入り口 | |
continue_bb_exit | continueした先の式の出口 | |
next_stmt | 次の文 | |
loop | 今のループの情報 | |
env | ||
outer_loop | 外側のループ | |
current_bb_ptr | 今いるbasic blockへのポインタのポインタ |
Definition at line 2615 of file cfg.c.
References append_pending(), append_succs(), append_succs_maybe(), ctrump_loop_cfg_info::body_start_bb, ctrump_loop_cfg_info::break_bb, flow_env::break_to, build_cfg_stmt(), ctrump_loop_cfg_info::cond_bb, flow_env::continue_to, CTRUMP_BB_LOOP_ENTRY, ctrump_loop_cfg_info::exit_cond, partial_bb::flags, get_id_bb_maybe(), ctrump_loop_cfg_info::id, flow_env::loop_cfg, ctrump_loop_cfg_info::loop_pred, new_bb(), build_cfg_env::next_id, and flow_env::return_to.
Referenced by build_cfg_for(), and build_cfg_while().
static int build_cfg_stmt | ( | struct ctrump_stmt * | stmt, | |
struct ctrump_stmt * | next_stmt, | |||
struct build_cfg_env * | env, | |||
const struct flow_env * | flow_env, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
文のCFGを作る
Definition at line 2880 of file cfg.c.
References append_succs(), append_succs_maybe(), BMP_P, ctrump_for_decl_stmt::body, ctrump_do_while_stmt::body, ctrump_while_stmt::body, ctrump_for_stmt::body, ctrump_if_stmt::body, flow_env::break_to, build_cfg_compound(), build_cfg_decl(), build_cfg_do_while(), build_cfg_expr_maybe(), build_cfg_for(), build_cfg_while(), ctrump_build_cfg_error::code, ctrump_stmt::code, ctrump_stmt::compound, ctrump_for_decl_stmt::cond, ctrump_do_while_stmt::cond, ctrump_while_stmt::cond, ctrump_for_stmt::cond, ctrump_if_else_stmt::cond, ctrump_if_stmt::cond, flow_env::continue_to, CTRUMP_BUILD_CFG_ERROR_BREAK_IN_NOT_LOOP, CTRUMP_BUILD_CFG_ERROR_CONTINUE_IN_NOT_LOOP, ctrump_fixme, CTRUMP_STMT_ASM, CTRUMP_STMT_BREAK, CTRUMP_STMT_CASE, CTRUMP_STMT_COMPOUND, CTRUMP_STMT_CONTINUE, CTRUMP_STMT_DECL, CTRUMP_STMT_DEFAULT, CTRUMP_STMT_DEFINE, CTRUMP_STMT_DO_WHILE, CTRUMP_STMT_EMPTY, CTRUMP_STMT_EXPR, CTRUMP_STMT_FOR, CTRUMP_STMT_FOR_DECL, CTRUMP_STMT_GOTO, CTRUMP_STMT_IF, CTRUMP_STMT_IF_ELSE, CTRUMP_STMT_IFDEF, CTRUMP_STMT_LABELED, CTRUMP_STMT_LIST, CTRUMP_STMT_NEWLINE, CTRUMP_STMT_PRAGMA, CTRUMP_STMT_RETURN, CTRUMP_STMT_RETURN_EXPR, CTRUMP_STMT_SLAAST_COMMENT, CTRUMP_STMT_SLASLA_COMMENT, CTRUMP_STMT_SWITCH, CTRUMP_STMT_UNDEF, CTRUMP_STMT_WHILE, ctrump_unreachable, ctrump_stmt::decl, ctrump_stmt::do_while, ctrump_if_else_stmt::else_body, build_cfg_env::error, ctrump_expr_stmt::expr, ctrump_stmt::expr, ctrump_stmt::for_, ctrump_stmt::for_decl, get_id_bb(), get_id_bb_maybe(), ctrump_stmt::goto_, HASH_FIND_SYM, ctrump_stmt::id, ctrump_stmt::if_, ctrump_stmt::if_else, ctrump_for_decl_stmt::init, ctrump_for_stmt::init, ctrump_for_decl_stmt::iter, ctrump_for_stmt::iter, ctrump_goto_stmt::label, build_cfg_env::label_ref_bmp, build_cfg_env::label_table, ctrump_stmt::labeled, ctrump_for_decl_stmt::loop_cfg, ctrump_while_stmt::loop_cfg, ctrump_for_stmt::loop_cfg, flow_env::loop_cfg, ctrump_loop_cfg_info::loop_stmt, ctrump_stmt::ret_expr, flow_env::return_to, ctrump_return_expr_stmt::retval, ctrump_labeled_stmt::stmt, ctrump_build_cfg_error::stmt, label_table::stmt, ctrump_if_else_stmt::then_body, ctrump_stmt::u, and ctrump_stmt::while_.
Referenced by build_cfg_compound(), build_cfg_do_while(), and build_cfg_loop().
static void build_cfg_trinary_cond_expr | ( | struct ctrump_expr * | cond, | |
struct ctrump_expr * | then_, | |||
struct ctrump_expr * | else_, | |||
struct ctrump_stmt * | at, | |||
struct build_cfg_env * | env, | |||
struct ctrump_loop_cfg_info * | cur_loop, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
条件式に対してCFGを作る
Definition at line 356 of file cfg.c.
References append_succs(), build_cfg_expr(), and new_bb().
Referenced by build_cfg_cond_expr().
static int build_cfg_while | ( | struct ctrump_loop_cfg_info ** | loop_ret, | |
struct ctrump_expr * | cond, | |||
struct ctrump_stmt * | body, | |||
struct ctrump_stmt * | next_stmt, | |||
struct build_cfg_env * | env, | |||
const struct flow_env * | flow_env, | |||
struct partial_bb ** | current_bb_ptr | |||
) | [static] |
whileループのCFGを作る
Definition at line 2726 of file cfg.c.
References build_cfg_expr(), build_cfg_loop(), build_cfg_env::cfg_pool, ctrump_mempool_alloc, flow_env::loop_cfg, new_bb(), and flow_env::return_to.
Referenced by build_cfg_stmt().
static void build_dom | ( | struct build_cfg_env * | env, | |
int | num_bb | |||
) | [static] |
支配木を作る
Definition at line 773 of file cfg.c.
References partial_bb::bb, partial_bb::children, build_cfg_env::dfs_order, partial_bb::idom, nca(), build_cfg_env::tmp_alloc, VA_ELEM, and VA_PUSH_P.
Referenced by build_cfg().
static int build_label_ref | ( | struct label_table * | table, | |
const struct ctrump_compound_stmt * | stmt, | |||
struct build_cfg_env * | env | |||
) | [static] |
参照されてるラベルを調べる
Definition at line 254 of file cfg.c.
References ctrump_build_cfg_error::code, ctrump_stmt::code, ctrump_stmt::compound, ctrump_bitmap_set(), CTRUMP_BUILD_CFG_ERROR_UNDEFINED_LABEL, CTRUMP_STMT_COMPOUND, CTRUMP_STMT_GOTO, build_cfg_env::error, ctrump_stmt::goto_, HASH_FIND_SYM, ctrump_stmt::id, ctrump_compound_stmt::items, ctrump_goto_stmt::label, build_cfg_env::label_ref_bmp, ctrump_compound_stmt::num_item, ctrump_build_cfg_error::stmt, and ctrump_stmt::u.
Referenced by check_label_use().
static int build_label_table | ( | struct label_table ** | table, | |
const struct ctrump_compound_stmt * | stmts, | |||
struct build_cfg_env * | env | |||
) | [static] |
ラベルテーブルをつくる
Definition at line 212 of file cfg.c.
References ctrump_build_cfg_error::code, ctrump_stmt::code, ctrump_stmt::compound, CTRUMP_BUILD_CFG_ERROR_REDEFINE_LABEL, ctrump_mempool_alloc, CTRUMP_STMT_COMPOUND, CTRUMP_STMT_LABELED, delete_table(), build_cfg_env::error, HASH_ADD, HASH_FIND_SYM, ctrump_compound_stmt::items, label_table::label_symbol, ctrump_labeled_stmt::label_symbol, ctrump_stmt::labeled, ctrump_compound_stmt::num_item, label_table::stmt, ctrump_build_cfg_error::stmt, build_cfg_env::tmp_alloc, and ctrump_stmt::u.
Referenced by check_label_use().
static void calc_df | ( | struct partial_bb ** | dfs_order, | |
int | num_bb, | |||
struct ctrump_intmap * | varinfo_map, | |||
int | num_var_info, | |||
ctrump_bitmap_t | tmp_bitmap | |||
) | [static] |
支配辺境を計算する
Definition at line 2320 of file cfg.c.
References partial_bb::bb, ctrump_bitmap_copy(), ctrump_bitmap_eq(), ctrump_bitmap_nand_or(), ctrump_bitmap_or(), partial_bb::kill, partial_bb::live, and partial_bb::use.
Referenced by build_cfg().
static int check_label_use | ( | struct build_cfg_env * | env, | |
const struct ctrump_compound_stmt * | stmts | |||
) | [static] |
ラベルテーブルを作る
Definition at line 289 of file cfg.c.
References build_label_ref(), build_label_table(), delete_table(), and build_cfg_env::label_table.
Referenced by ctrump_build_cfg().
int ctrump_build_cfg | ( | struct ctrump_cfg * | ret, | |
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
const struct ctrump_fundef * | def, | |||
struct ctrump_mempool * | cfg_pool, | |||
struct ctrump_mempool * | varmap_pool, | |||
int | num_ast, | |||
int | id_begin | |||
) |
CFGを作る.
Definition at line 3091 of file cfg.c.
References build_cfg_env::basic_blocks, build_cfg_env::bb_id, ctrump_fundef::body, build_cfg(), build_cfg_env::cfg_pool, check_label_use(), ctrump_mempool_alloc, ctrump_mempool_destroy(), ctrump_mempool_init(), ctrump_varray_init_pool(), delete_table(), build_cfg_env::error, build_cfg_env::label_ref_bmp, build_cfg_env::label_table, build_cfg_env::next_id, build_cfg_env::stmt_bb_table, build_cfg_env::tmp_alloc, and zero_bmp.
Referenced by ctrump_analyze().
static void delete_table | ( | struct label_table * | table | ) | [static] |
ラベルテーブルを削除
Definition at line 198 of file cfg.c.
References HASH_DEL.
Referenced by build_label_table(), check_label_use(), and ctrump_build_cfg().
static int dfs_order | ( | struct partial_bb * | start, | |
struct build_cfg_env * | env, | |||
int | num_bb, | |||
ctrump_bitmap_t | bb_bitmap | |||
) | [static] |
CFGを深さ優先探索で辿った順の配列をつくり、 bb->dfs_order を設定する.
Definition at line 697 of file cfg.c.
References BMP_P, BMP_SET, ctrump_mempool_alloc, build_cfg_env::dfs_order, partial_bb::id, partial_bb::idom, partial_bb::order, build_cfg_env::tmp_alloc, and VA_ELEM.
Referenced by build_cfg(), and ctrump_analyze_loop().
static int extract_load_store | ( | struct partial_bb * | bb, | |
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
BBからロードストアを抜き出す.
Definition at line 2081 of file cfg.c.
References partial_bb_expr::at, BB_EXPR, CHECK_ERROR, partial_bb_expr::code, extract_load_store_expr_rval(), and partial_bb_expr::u.
Referenced by build_cfg().
static int extract_load_store_assign | ( | enum ctrump_expr_code | store_op, | |
struct ctrump_expr * | lhs, | |||
struct ctrump_expr * | val_expr, | |||
struct ctrump_stmt * | at, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
代入式からロードストアを抜き出す
Definition at line 1693 of file cfg.c.
References add_var_store(), append_memory_store(), partial_bb::arr_stores, CHECK_ERROR, ctrump_build_cfg_error::code, ctrump_expr::code, ctrump_bitmap_set(), CTRUMP_BUILD_CFG_ERROR_INVALID_LVALUE, CTRUMP_EXPR_ARRREF, CTRUMP_EXPR_MEMBER_REF, CTRUMP_EXPR_PTR_MEMBER_REF, CTRUMP_EXPR_UNA_PTRREF, CTRUMP_EXPR_VARREF, ctrump_intmap_lookup(), CTRUMP_MEMORY_ACCESS_PARTIAL, ctrump_peel_paren(), ctrump_var_store::flags, ctrump_var::id, ctrump_cfg_var_info::index, partial_bb::ordered_mem_load_store, ctrump_varref_expr::pdg, partial_var_info::result, ctrump_build_cfg_error::stmt, STORE, partial_bb::stores, ctrump_expr::u, partial_bb::use, ctrump_varref_expr::var, and ctrump_expr::varref.
Referenced by extract_load_store_expr_rval().
static int extract_load_store_expr_rval | ( | struct ctrump_expr * | e, | |
struct ctrump_stmt * | at, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
右辺値からロードストアを抜き出す
Definition at line 1888 of file cfg.c.
References add_var_loadstore(), ctrump_var::addressed, append_memory_load(), ctrump_call_expr::args, ctrump_expr::arr_ref, ctrump_arr_ref_expr::array, ctrump_var_ref::at, ctrump_expr::binary, ctrump_expr::call, ctrump_expr::cast, CHECK_ERROR, ctrump_build_cfg_error::code, ctrump_expr::code, ctrump_cond_expr::cond, ctrump_expr::cond, ctrump_bitmap_p(), ctrump_bitmap_set(), CTRUMP_BUILD_CFG_ERROR_INVALID_ADDRESSOP, CTRUMP_CASE_BIN_LOG_EXPR, CTRUMP_CASE_BIN_OP_ASSIGN_EXPR, CTRUMP_CASE_CONSTANT_TERM, CTRUMP_EXPR_ARRREF, CTRUMP_EXPR_BIN_ADD, CTRUMP_EXPR_BIN_ASSIGN, CTRUMP_EXPR_BIN_BAND, CTRUMP_EXPR_BIN_BOR, CTRUMP_EXPR_BIN_BXOR, CTRUMP_EXPR_BIN_COMMA, CTRUMP_EXPR_BIN_DIV, CTRUMP_EXPR_BIN_EQ, CTRUMP_EXPR_BIN_GE, CTRUMP_EXPR_BIN_GT, CTRUMP_EXPR_BIN_LE, CTRUMP_EXPR_BIN_LSHIFT, CTRUMP_EXPR_BIN_LT, CTRUMP_EXPR_BIN_MOD, CTRUMP_EXPR_BIN_MUL, CTRUMP_EXPR_BIN_NE, CTRUMP_EXPR_BIN_RSHIFT, CTRUMP_EXPR_BIN_SUB, CTRUMP_EXPR_CALL, CTRUMP_EXPR_CAST, CTRUMP_EXPR_CONDITIONAL, CTRUMP_EXPR_EMPTY, CTRUMP_EXPR_IMPLICIT_CAST, CTRUMP_EXPR_INITIALIZER, CTRUMP_EXPR_IVTMP, CTRUMP_EXPR_MACRO_EXPAND, CTRUMP_EXPR_MEMBER_REF, CTRUMP_EXPR_PAREN, CTRUMP_EXPR_PTR_MEMBER_REF, CTRUMP_EXPR_TEXT, CTRUMP_EXPR_UNA_ADDR, CTRUMP_EXPR_UNA_BCMPL, CTRUMP_EXPR_UNA_LNEG, CTRUMP_EXPR_UNA_NEG, CTRUMP_EXPR_UNA_POS, CTRUMP_EXPR_UNA_POST_DEC, CTRUMP_EXPR_UNA_POST_INC, CTRUMP_EXPR_UNA_PRE_DEC, CTRUMP_EXPR_UNA_PRE_INC, CTRUMP_EXPR_UNA_PTRREF, CTRUMP_EXPR_VARREF, ctrump_fixme, ctrump_intmap_lookup(), ctrump_unreachable, ctrump_paren_expr::expr, ctrump_unary_expr::expr, ctrump_implicit_cast_expr::expr, ctrump_cast_expr::expr, extract_load_store_assign(), extract_load_store_initializer_list(), ctrump_call_expr::func_expr, ctrump_var::id, ctrump_expr::implicit_cast, ctrump_cfg_var_info::index, ctrump_initializer_expr::initializer, ctrump_expr::initializer, partial_bb::kill, ctrump_binary_expr::lhs, LOAD, ctrump_varray::nelem, ctrump_call_expr::num_args, partial_bb::ordered_mem_load_store, ctrump_expr::paren, ctrump_varref_expr::pdg, ctrump_var_ref::ref_expr, partial_var_info::result, ctrump_binary_expr::rhs, ctrump_build_cfg_error::stmt, ctrump_arr_ref_expr::subscript, ctrump_expr::u, ctrump_expr::unary, partial_bb::use, VA_LAST_PTR, VA_NEWELEM_P, ctrump_varref_expr::var, and ctrump_expr::varref.
Referenced by append_memory_load(), append_memory_store(), extract_load_store(), extract_load_store_initializer(), extract_load_store_initializer_list(), and recog_array_access().
static int extract_load_store_initializer | ( | struct ctrump_initializer * | initializer, | |
struct ctrump_stmt * | at, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
初期化子からロードストアを抜き出す
Definition at line 1854 of file cfg.c.
References CHECK_ERROR, ctrump_initializer::code, CTRUMP_INITIALIZER_EMPTY, CTRUMP_INITIALIZER_EXPR, CTRUMP_INITIALIZER_NESTED, ctrump_initializer::expr, extract_load_store_expr_rval(), extract_load_store_initializer_list(), ctrump_initializer::nest, and ctrump_initializer::u.
Referenced by extract_load_store_initializer_list().
static int extract_load_store_initializer_list | ( | struct ctrump_initializer_list * | init_list, | |
struct ctrump_stmt * | at, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
初期化リストからロードストアを抜き出す
Definition at line 1810 of file cfg.c.
References CHECK_ERROR, ctrump_designator::code, CTRUMP_DESIGNATOR_IDENT, CTRUMP_DESIGNATOR_INDEX, ctrump_initializer_list_elem::designators_list, ctrump_initializer_list::elems, extract_load_store_expr_rval(), extract_load_store_initializer(), ctrump_designator_index::index, ctrump_designator::index, ctrump_initializer_list_elem::initializer, ctrump_initializer_list_elem::num_designator, ctrump_initializer_list::num_elem, and ctrump_designator::u.
Referenced by extract_load_store_expr_rval(), and extract_load_store_initializer().
static void find_df | ( | struct build_cfg_env * | env, | |
int | num_bb | |||
) | [static] |
支配辺境を求める domtree -> dominance frontier
Definition at line 811 of file cfg.c.
References partial_bb::bb, partial_bb::children, build_cfg_env::dfs_order, partial_bb::idom, ctrump_varray::nelem, build_cfg_env::tmp_alloc, VA_ELEM, and VA_PUSH_P.
Referenced by build_cfg().
static struct partial_bb* get_id_bb | ( | struct build_cfg_env * | env, | |
struct ctrump_stmt * | stmt, | |||
struct ctrump_loop_cfg_info * | cur_loop | |||
) | [static, read] |
idで示す文を先頭に持つBBを取得 無ければ作る
Definition at line 613 of file cfg.c.
References ctrump_stmt::id, new_bb(), and build_cfg_env::stmt_bb_table.
Referenced by build_cfg_do_while(), build_cfg_stmt(), and get_id_bb_maybe().
static struct partial_bb* get_id_bb_maybe | ( | struct build_cfg_env * | env, | |
struct ctrump_stmt * | stmt, | |||
struct ctrump_loop_cfg_info * | loop, | |||
struct partial_bb * | return_to_bb | |||
) | [static, read] |
idで示す文を先頭に持つBBを取得 無ければ作る stmt が NULL なら次の文は存在しない(return_toへ飛ぶ)
Definition at line 638 of file cfg.c.
References get_id_bb().
Referenced by build_cfg_do_while(), build_cfg_loop(), and build_cfg_stmt().
static int insert_phi | ( | struct partial_bb ** | bbs, | |
int | num_bb, | |||
struct partial_var_info * | var_info, | |||
int | num_var_info, | |||
int | id, | |||
ctrump_bitmap_t | tmp_bitmap, | |||
struct ctrump_mempool * | cfg_alloc | |||
) | [static] |
φを挿入する.
Definition at line 848 of file cfg.c.
References partial_bb::bb, ctrump_bitmap_clear(), ctrump_bitmap_copy(), ctrump_bitmap_ffs(), ctrump_bitmap_p(), ctrump_bitmap_popcnt(), ctrump_bitmap_set(), ctrump_mempool_alloc, ctrump_phi_node::id, partial_bb::live, partial_var_info::modified_at, ctrump_phi_node::nodes, ctrump_phi_node::num_merge, partial_bb::num_phi, partial_bb::order, partial_bb::phi_inserted, partial_bb::phi_nodes, and ctrump_phi_node::var_index.
Referenced by build_cfg().
static struct partial_bb* nca | ( | struct partial_bb * | x, | |
struct partial_bb * | y | |||
) | [static, read] |
最近共通祖先(Nearest Common Ancestor)を求める
Definition at line 749 of file cfg.c.
References partial_bb::idom, and partial_bb::order.
Referenced by build_dom().
static struct partial_bb * new_bb | ( | struct build_cfg_env * | env, | |
struct ctrump_loop_cfg_info * | cfg | |||
) | [static, read] |
新しくpartial_bbを作る
Definition at line 577 of file cfg.c.
References partial_bb::arr_stores, build_cfg_env::basic_blocks, build_cfg_env::bb_id, partial_bb::children, ctrump_mempool_alloc, ctrump_varray_init_pool(), partial_bb::flags, partial_bb::id, partial_bb::loop_cfg, build_cfg_env::next_id, partial_bb::ordered_load_store, partial_bb::ordered_mem_load_store, partial_bb::phi_inserted, partial_bb::resolve_pending, partial_bb::stores, build_cfg_env::tmp_alloc, and VA_PUSH_P.
Referenced by build_cfg(), build_cfg_for(), build_cfg_logical_expr(), build_cfg_loop(), build_cfg_trinary_cond_expr(), build_cfg_while(), and get_id_bb().
static int recog_array_access | ( | struct ctrump_expr ** | ret_array, | |
struct ctrump_subscript ** | ret_vec, | |||
int * | num_ret, | |||
struct ctrump_expr * | access_expr, | |||
struct partial_bb * | bb, | |||
struct ctrump_intmap * | var_info_map, | |||
struct ctrump_build_cfg_error * | error, | |||
struct ctrump_stmt * | at, | |||
struct ctrump_mempool * | cfg_alloc, | |||
struct ctrump_mempool * | tmp_alloc | |||
) | [static] |
配列アクセスの解析
Definition at line 1466 of file cfg.c.
References append_nd_subscript(), append_record_member_ref(), ctrump_expr::arr_ref, ctrump_arr_ref_expr::array, CHECK_ERROR, ctrump_expr::code, CTRUMP_EXPR_ARRREF, CTRUMP_EXPR_MEMBER_REF, CTRUMP_EXPR_PTR_MEMBER_REF, CTRUMP_EXPR_UNA_PTRREF, ctrump_get_unqualified_type(), ctrump_mempool_alloc, ctrump_peel_cast_to_pointer_from_array(), ctrump_varray_close(), ctrump_varray_discard(), ctrump_varray_init(), ctrump_varray::elements, ctrump_unary_expr::expr, extract_load_store_expr_rval(), ctrump_expr::member_ref, ctrump_subscript::nd_subscripts, ctrump_varray::nelem, ctrump_subscript::num_nd_subscript, ctrump_member_ref::obj_expr, ctrump_arr_ref_expr::subscript, ctrump_expr::type, ctrump_expr::u, ctrump_expr::unary, VA_LAST_PTR, and VA_NEWELEM.
Referenced by append_memory_load(), and append_memory_store().
static int recog_reductive | ( | struct ctrump_expr * | e, | |
struct ctrump_var * | v, | |||
int | is_float, | |||
enum ctrump_reductive_expr_code * | ret_code, | |||
struct ctrump_expr ** | ret_expr | |||
) | [static] |
縮約演算を識別する
Definition at line 933 of file cfg.c.
References ctrump_expr::binary, ctrump_expr::code, CTRUMP_CASE_BIN_ARITH_EXPR, CTRUMP_CASE_BIN_EQ_EXPR, CTRUMP_CASE_BIN_LOG_EXPR, CTRUMP_CASE_BIN_OP_ASSIGN_EXPR, CTRUMP_CASE_CONSTANT_TERM, CTRUMP_EXPR_ARRREF, CTRUMP_EXPR_BIN_ADD, CTRUMP_EXPR_BIN_ASSIGN, CTRUMP_EXPR_BIN_BAND, CTRUMP_EXPR_BIN_BOR, CTRUMP_EXPR_BIN_BXOR, CTRUMP_EXPR_BIN_COMMA, CTRUMP_EXPR_BIN_LAND, CTRUMP_EXPR_BIN_LOR, CTRUMP_EXPR_BIN_MUL, CTRUMP_EXPR_BIN_SUB, CTRUMP_EXPR_CALL, CTRUMP_EXPR_CAST, CTRUMP_EXPR_CONDITIONAL, CTRUMP_EXPR_EMPTY, CTRUMP_EXPR_IMPLICIT_CAST, CTRUMP_EXPR_INITIALIZER, CTRUMP_EXPR_IVTMP, CTRUMP_EXPR_MACRO_EXPAND, CTRUMP_EXPR_MEMBER_REF, ctrump_expr_occur_var(), CTRUMP_EXPR_PAREN, CTRUMP_EXPR_PTR_MEMBER_REF, CTRUMP_EXPR_TEXT, CTRUMP_EXPR_UNA_ADDR, CTRUMP_EXPR_UNA_BCMPL, CTRUMP_EXPR_UNA_LNEG, CTRUMP_EXPR_UNA_NEG, CTRUMP_EXPR_UNA_POS, CTRUMP_EXPR_UNA_POST_DEC, CTRUMP_EXPR_UNA_POST_INC, CTRUMP_EXPR_UNA_PRE_DEC, CTRUMP_EXPR_UNA_PRE_INC, CTRUMP_EXPR_UNA_PTRREF, CTRUMP_EXPR_VARREF, CTRUMP_REDUCTIVE_ADD, CTRUMP_REDUCTIVE_BAND, CTRUMP_REDUCTIVE_BOR, CTRUMP_REDUCTIVE_BXOR, CTRUMP_REDUCTIVE_FADD, CTRUMP_REDUCTIVE_FMUL, CTRUMP_REDUCTIVE_FSUB, CTRUMP_REDUCTIVE_LAND, CTRUMP_REDUCTIVE_LOR, CTRUMP_REDUCTIVE_MUL, CTRUMP_REDUCTIVE_SUB, ctrump_unreachable, ctrump_macro_expand_expr::expanded, ctrump_paren_expr::expr, ctrump_binary_expr::lhs, ctrump_expr::macro_expand, ctrump_expr::paren, REDUC_CASE_LHS, ctrump_binary_expr::rhs, ctrump_expr::u, ctrump_varref_expr::var, and ctrump_expr::varref.
Referenced by ssa_node_store_expr().
static void resolve_bb_vec | ( | struct ctrump_bb ** | bb_vec, | |
struct ctrump_varray * | partial_vec, | |||
struct ctrump_bb ** | basic_blocks | |||
) | [static] |
partial_bbへのポインタをctrump_bbへのポインタに変換する
Definition at line 2362 of file cfg.c.
References partial_bb::id, ctrump_varray::nelem, and VA_ELEM.
Referenced by build_cfg().
static struct ctrump_pdg_node* ssa_node_store_expr | ( | enum ctrump_expr_code | op_code, | |
struct ctrump_var * | var, | |||
struct ctrump_expr * | store_val, | |||
struct ctrump_varray * | pdg_node_list, | |||
struct ctrump_pdg_node * | old_val, | |||
struct ctrump_stmt * | at, | |||
struct ctrump_mempool * | alloc, | |||
int * | id | |||
) | [static, read] |
ストア演算の処理
Definition at line 1085 of file cfg.c.
References alloc_pdg_node(), CTRUMP_EXPR_BIN_ADD_ASSIGN, CTRUMP_EXPR_BIN_MUL_ASSIGN, CTRUMP_EXPR_BIN_SUB_ASSIGN, CTRUMP_EXPR_UNA_POST_DEC, CTRUMP_EXPR_UNA_POST_INC, CTRUMP_EXPR_UNA_PRE_DEC, CTRUMP_EXPR_UNA_PRE_INC, CTRUMP_PDG_DEC, CTRUMP_PDG_FDEC, CTRUMP_PDG_FINC, CTRUMP_PDG_INC, CTRUMP_PDG_VALUE_EXPR, CTRUMP_PDG_VALUE_INCREMENTAL, CTRUMP_PDG_VALUE_REDUCTION, CTRUMP_REDUCTIVE_ADD, CTRUMP_REDUCTIVE_FADD, CTRUMP_REDUCTIVE_FMUL, CTRUMP_REDUCTIVE_FSUB, CTRUMP_REDUCTIVE_MUL, CTRUMP_REDUCTIVE_SUB, ctrump_type_is_float(), ctrump_unreachable, ctrump_pdg_node::expr, ctrump_pdg_node::incr, ctrump_pdg_reductive_expr::op, ctrump_pdg_incremental_expr::op, ctrump_pdg_reductive_expr::prev_val, ctrump_pdg_incremental_expr::prev_val, recog_reductive(), ctrump_pdg_node::reduction, ctrump_pdg_store_expr::store_op, ctrump_expr::type, ctrump_pdg_node::u, ctrump_pdg_store_expr::val, and ctrump_pdg_reductive_expr::value.
Referenced by assign_pdg_node_bb().