Home | History | Annotate | Download | only in analyzer

Lines Matching refs:MODEL

58 #include "analyzer/region-model.h"
65 #include "analyzer/region-model-reachability.h"
249 /* Ctor for region_model: construct an "empty" model. */
334 /* Dump a representation of this model to PP, showing the
389 /* Dump a representation of this model to FILE. */
403 /* Dump a multiline representation of this model to stderr. */
411 /* Dump a multiline representation of this model to stderr. */
894 short-circuited without optimization, using MODEL for the value of A. */
897 within_short_circuited_stmt_p (const region_model *model,
925 /* The first arg of the bitwise stmt must have a known value in MODEL
930 const svalue *other_arg_sval = model->get_rvalue (other_arg, NULL);
1074 /* Update this model for the ASSIGN stmt, using CTXT to report any
1237 the region model's state to stderr. */
1325 /* Update this model for the CALL stmt, using CTXT to report any
1401 in region-model-impl-calls.cc.
1477 of scope for the analyzer: we only want to model the effects
1576 /* Update this model for the CALL stmt, using CTXT to report any
1781 Traverse the regions in this model, determining what regions are
1870 /* Traverse the regions in this model, determining what regions are
1920 /* Update this model for the RETURN_STMT, using CTXT to report any
1938 /* Update this model for a call and return of setjmp/sigsetjmp at CALL within
2346 /* Return true if this model is on a path with "main" as the entrypoint
2355 /* Determine if the oldest stack frame in this model is for "main". */
2916 this model. */
2938 this model, without resorting to the constraint_manager.
3320 this model.
3329 /* For now, make no attempt to model constraints on floating-point
3630 /* Update this model for any phis in SNODE, assuming we came from
3657 /* Attempt to update this model for taking EDGE (where the last statement
3665 model, returning true if they are feasible, or false if they are
3786 /* Extract calling information from the superedge and update the model for the
3797 /* Extract calling information from the return superedge and update the model
4262 const region_model *model;
4274 data.model = this;
4285 if (base_reg->get_parent_region () != cb_data->model->m_current_frame)
4378 pp_string (pp, "model A:");
4383 pp_string (pp, "model B:");
4388 pp_string (pp, "merged model:");
4553 region_model &model,
4557 tristate actual = model.eval_condition (lhs, op, rhs);
4565 region_model &model,
4569 tristate actual = model.eval_condition (lhs, op, rhs, NULL);
4596 const region_model &model,
4604 model.dump_to_pp (&pp, summarize, true);
4608 /* Assert that MODEL.dump_to_pp (SUMMARIZE) is EXPECTED. */
4610 #define ASSERT_DUMP_EQ(MODEL, SUMMARIZE, EXPECTED) \
4612 assert_dump_eq ((SELFTEST_LOCATION), (MODEL), (SUMMARIZE), (EXPECTED)); \
4621 region_model model (&mgr);
4623 ASSERT_DUMP_EQ (model, false,
4629 ASSERT_DUMP_EQ (model, true,
4704 region_model model (&mgr);
4705 model.set_value (c_x, int_17, NULL);
4706 model.set_value (c_y, int_m3, NULL);
4710 const region *c_x_reg = model.get_lvalue (c_x, NULL);
4712 ASSERT_EQ (offset.get_base_region (), model.get_lvalue (c, NULL));
4718 const region *c_y_reg = model.get_lvalue (c_y, NULL);
4720 ASSERT_EQ (offset.get_base_region (), model.get_lvalue (c, NULL));
4736 region_model model (&mgr);
4741 model.set_value (a_0, char_A, NULL);
4779 region_model model (&mgr);
4783 const region *a_3_reg = model.get_lvalue (a_3, &ctxt);
4784 model.set_value (a_3_reg, &test_sval, &ctxt);
4785 tree rep = model.get_representative_tree (&test_sval);
4792 region_model model (&mgr);
4796 const region *a_0_reg = model.get_lvalue (a_0, &ctxt);
4797 model.set_value (a_0_reg, &test_sval, &ctxt);
4798 tree rep = model.get_representative_tree (&test_sval);
4848 region_model model (&mgr);
4849 ASSERT_EQ (model.get_rvalue (int_0, &ctxt), model.get_rvalue (int_0, &ctxt));
4850 ASSERT_EQ (model.get_rvalue (int_42, &ctxt),
4851 model.get_rvalue (int_42, &ctxt));
4852 ASSERT_NE (model.get_rvalue (int_0, &ctxt), model.get_rvalue (int_42, &ctxt));
4861 const svalue *int_42_sval = model.get_rvalue (int_42, &ctxt);
4862 const svalue *const_int_42_sval = model.get_rvalue (const_int_42, &ctxt);
4865 ASSERT_CONDITION_TRUE (model, int_42_sval, EQ_EXPR, const_int_42_sval);
4866 ASSERT_CONDITION_FALSE (model, int_42_sval, NE_EXPR, const_int_42_sval);
4905 region_model model (&mgr);
4906 const svalue *x_init = model.get_rvalue (x, &ctxt);
4907 const svalue *y_init = model.get_rvalue (y, &ctxt);
4909 const region *x_reg = model.get_lvalue (x, &ctxt);
4924 region_model model (&mgr);
4925 const svalue *x_init = model.get_rvalue (x, &ctxt);
4926 const svalue *y_init = model.get_rvalue (y, &ctxt);
4927 const region *x_reg = model.get_lvalue (x, &ctxt);
5007 region_model model (&mgr);
5008 const svalue *x_init = model.get_rvalue (x, &ctxt);
5112 region_model model (&mgr);
5114 const region *c_x_reg = model.get_lvalue (c_x, &ctxt);
5180 region_model model (&mgr);
5181 ADD_SAT_CONSTRAINT (model, x, EQ_EXPR, int_0);
5182 ASSERT_CONDITION_UNKNOWN (model, y, EQ_EXPR, int_0);
5183 model.set_value (model.get_lvalue (y, NULL),
5184 model.get_rvalue (int_0, NULL),
5186 ASSERT_CONDITION_TRUE (model, y, EQ_EXPR, int_0);
5187 ASSERT_CONDITION_TRUE (model, y, EQ_EXPR, x);
5212 region_model model (&mgr);
5213 model.set_value (c_x, int_17, NULL);
5214 model.set_value (c_y, int_m3, NULL);
5217 const svalue *sval = model.get_rvalue (c, NULL);
5218 model.set_value (model.get_lvalue (d, NULL), sval, NULL);
5221 ASSERT_EQ (model.get_rvalue (c_x, NULL), model.get_rvalue (d_x, NULL));
5222 ASSERT_EQ (model.get_rvalue (c_y, NULL), model.get_rvalue (d_y, NULL));
5273 region_model model (&mgr);
5277 = model.push_frame (DECL_STRUCT_FUNCTION (parent_fndecl),
5279 ASSERT_EQ (model.get_current_frame (), parent_frame_reg);
5280 ASSERT_TRUE (model.region_exists_p (parent_frame_reg));
5281 const region *a_in_parent_reg = model.get_lvalue (a, &ctxt);
5282 model.set_value (a_in_parent_reg,
5283 model.get_rvalue (int_42, &ctxt),
5287 model.add_constraint (b, LT_EXPR, int_10, &ctxt);
5288 ASSERT_EQ (model.eval_condition (b, LT_EXPR, int_10, &ctxt),
5293 = model.push_frame (DECL_STRUCT_FUNCTION (child_fndecl), NULL, &ctxt);
5294 ASSERT_EQ (model.get_current_frame (), child_frame_reg);
5295 ASSERT_TRUE (model.region_exists_p (child_frame_reg));
5296 const region *x_in_child_reg = model.get_lvalue (x, &ctxt);
5297 model.set_value (x_in_child_reg,
5298 model.get_rvalue (int_0, &ctxt),
5302 model.add_constraint (y, NE_EXPR, int_5, &ctxt);
5303 ASSERT_EQ (model.eval_condition (y, NE_EXPR, int_5, &ctxt),
5307 const region *p_in_globals_reg = model.get_lvalue (p, &ctxt);
5308 model.set_value (p_in_globals_reg,
5314 const region *q_in_globals_reg = model.get_lvalue (q, &ctxt);
5315 model.set_value (q_in_globals_reg,
5325 model.pop_frame (NULL, NULL, &ctxt);
5326 ASSERT_FALSE (model.region_exists_p (child_frame_reg));
5327 ASSERT_TRUE (model.region_exists_p (parent_frame_reg));
5331 const svalue *new_p_sval = model.get_rvalue (p, NULL);
5338 const svalue *new_q_sval = model.get_rvalue (q, &ctxt);
5341 model.get_lvalue (p, &ctxt));
5344 ASSERT_EQ (model.get_current_frame (), parent_frame_reg);
5348 const svalue *new_a_sval = model.get_rvalue (a, &ctxt);
5353 ASSERT_EQ (model.eval_condition (b, LT_EXPR, int_10, &ctxt),
5378 region_model model (&mgr);
5386 = model.push_frame (DECL_STRUCT_FUNCTION (fndecl), NULL, &ctxt);
5387 const region *parm_n_reg = model.get_lvalue (path_var (n, depth), &ctxt);
5401 ASSERT_EQ (model.get_representative_path_var (parm_regs[depth],
5407 ASSERT_EQ (model.get_lvalue (path_var (n, depth), NULL),
5412 ASSERT_EQ (model.get_representative_path_var (parm_svals[depth],
5446 w/o affecting the original model. */
5515 /* Verify that we can canonicalize a model containing NaN and other real
5525 region_model model (&mgr);
5528 model.get_rvalue (cst, NULL);
5530 model.canonicalize ();
5535 mergable. Write the merged model to *OUT_MERGED_MODEL,
5610 /* TODO: verify that the merged model doesn't have a value for
5743 /* We should get p == &y in the merged model. */
5761 /* We should get x == unknown in the merged model. */
5784 /* The merged model ought to be identical. */
5856 /* Verify that we can merge a model in which a local in an older stack
5889 /* Verify that we can merge a model in which a local points to a global. */
6152 region_model model (&mgr);
6160 const region *reg = model.create_region_for_heap_alloc (size_in_bytes, NULL);
6162 model.set_value (model.get_lvalue (p, NULL), sval, NULL);
6163 model.set_value (q, p, NULL);
6165 ASSERT_CONDITION_UNKNOWN (model, p, NE_EXPR, null_ptr);
6166 ASSERT_CONDITION_UNKNOWN (model, p, EQ_EXPR, null_ptr);
6167 ASSERT_CONDITION_UNKNOWN (model, q, NE_EXPR, null_ptr);
6168 ASSERT_CONDITION_UNKNOWN (model, q, EQ_EXPR, null_ptr);
6170 model.add_constraint (p, NE_EXPR, null_ptr, NULL);
6172 ASSERT_CONDITION_TRUE (model, p, NE_EXPR, null_ptr);
6173 ASSERT_CONDITION_FALSE (model, p, EQ_EXPR, null_ptr);
6174 ASSERT_CONDITION_TRUE (model, q, NE_EXPR, null_ptr);
6175 ASSERT_CONDITION_FALSE (model, q, EQ_EXPR, null_ptr);
6190 region_model model (&mgr);
6192 const region *i_reg = model.get_lvalue (i, NULL);
6196 const svalue *sval_init = model.get_rvalue (i, NULL);
6200 ASSERT_EQ (model.get_rvalue (i, NULL), sval_init);
6203 model.set_value (i, int_17, NULL);
6204 ASSERT_EQ (model.get_rvalue (i, NULL),
6205 model.get_rvalue (int_17, NULL));
6208 model.set_value (i, int_m3, NULL);
6209 ASSERT_EQ (model.get_rvalue (i, NULL),
6210 model.get_rvalue (int_m3, NULL));
6247 region_model model (&mgr);
6249 model.set_value (arr_0, int_17, NULL);
6251 model.set_value (arr_1, int_m3, NULL);
6253 ASSERT_EQ (model.get_rvalue (arr_0, NULL), model.get_rvalue (int_17, NULL));
6254 ASSERT_EQ (model.get_rvalue (arr_1, NULL), model.get_rvalue (int_m3, NULL));
6257 model.set_value (arr_1, int_42, NULL);
6258 ASSERT_EQ (model.get_rvalue (arr_1, NULL), model.get_rvalue (int_42, NULL));
6262 const region *arr_0_reg = model.get_lvalue (arr_0, NULL);
6264 ASSERT_EQ (offset.get_base_region (), model.get_lvalue (arr, NULL));
6270 const region *arr_1_reg = model.get_lvalue (arr_1, NULL);
6272 ASSERT_EQ (offset.get_base_region (), model.get_lvalue (arr, NULL));
6277 model.set_value (arr_i, i, NULL);
6278 ASSERT_EQ (model.get_rvalue (arr_i, NULL), model.get_rvalue (i, NULL));
6279 ASSERT_EQ (model.get_rvalue (arr_0, NULL)->get_kind (), SK_UNKNOWN);
6282 model.set_value (arr_0, int_17, NULL);
6283 ASSERT_EQ (model.get_rvalue (arr_0, NULL), model.get_rvalue (int_17, NULL));
6284 ASSERT_EQ (model.get_rvalue (arr_i, NULL)->get_kind (), SK_UNKNOWN);
6307 region_model model (&mgr);
6310 model.set_value (x, int_17, NULL);
6313 model.set_value (p, addr_of_x, NULL);
6315 const svalue *sval = model.get_rvalue (star_p, NULL);
6327 from data-model-1.c, which looks like this at the gimple level:
6377 region_model model (&mgr);
6380 const svalue *size_sval = model.get_rvalue (n_times_4, &ctxt);
6381 const region *reg = model.create_region_for_heap_alloc (size_sval, &ctxt);
6383 model.set_value (model.get_lvalue (p, &ctxt), ptr, &ctxt);
6384 ASSERT_EQ (model.get_capacity (reg), size_sval);
6407 region_model model (&mgr);
6411 = model.push_frame (DECL_STRUCT_FUNCTION (fndecl),
6414 const svalue *size_sval = model.get_rvalue (n_times_4, &ctxt);
6415 const region *reg = model.create_region_for_alloca (size_sval, &ctxt);
6418 model.set_value (model.get_lvalue (p, &ctxt), ptr, &ctxt);
6419 ASSERT_EQ (model.get_capacity (reg), size_sval);
6423 model.pop_frame (NULL, NULL, &ctxt);
6424 ASSERT_EQ (model.get_rvalue (p, NULL)->get_kind (), SK_POISONED);
6438 region_model model (&mgr);
6439 const svalue *p_init = model.get_rvalue (p, &ctxt);
6440 const svalue *q_init = model.get_rvalue (q, &ctxt);