PIPS

type of statement More...

+ Collaboration diagram for Direct test of the instruction:

Functions

bool statement_sequence_p (statement s)
 Statement classes induced from instruction type. More...
 
bool statement_test_p (statement s)
 
bool statement_loop_p (statement s)
 
bool statement_whileloop_p (statement s)
 
bool statement_goto_p (statement s)
 
bool statement_call_p (statement s)
 
bool statement_unstructured_p (statement s)
 
bool statement_forloop_p (statement s)
 
bool statement_multitest_p (statement s)
 
bool statement_expression_p (statement s)
 
bool empty_statement_p (statement st)
 Test if a statement is empty. More...
 
bool unlabelled_statement_p (statement st)
 
bool nop_statement_p (statement s)
 
bool empty_statement_or_labelless_continue_p (statement st)
 Return true if the statement is an empty instruction block without label or a continue without label or a recursive combination of above. More...
 
bool empty_statement_or_continue_p (statement st)
 Return true if the statement is an empty instruction block or a continue or a recursive combination of above. More...
 
bool empty_statement_or_continue_without_comment_p (statement st)
 Return true if the statement is an empty instruction block or a continue without comments or without LABEL or without declarations or a recursive combination of above. More...
 
bool check_io_statement_p (statement s)
 

Detailed Description

type of statement

With these methods you can directly test the type of the instruction inside a statement

Function Documentation

◆ check_io_statement_p()

bool check_io_statement_p ( statement  s)

Definition at line 528 of file statement.c.

529 {
530  bool check_io = false;
532 
533  if(instruction_test_p(i)) {
535 
536  if(syntax_reference_p(c)) {
538  }
539  }
540 
541  return check_io;
542 }
bool io_entity_p(entity e)
Several implicit entities are declared to define the implicit effects of IO statements.
Definition: entity.c:1139
#define syntax_reference_p(x)
Definition: ri.h:2728
#define syntax_reference(x)
Definition: ri.h:2730
#define reference_variable(x)
Definition: ri.h:2326
#define test_condition(x)
Definition: ri.h:2833
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_test_p(x)
Definition: ri.h:1515
#define instruction_test(x)
Definition: ri.h:1517
#define expression_syntax(x)
Definition: ri.h:1247

References expression_syntax, instruction_test, instruction_test_p, io_entity_p(), reference_variable, statement_instruction, syntax_reference, syntax_reference_p, and test_condition.

Referenced by build_trail(), c_unstructured(), decorate_trail(), and text_trail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty_statement_or_continue_p()

bool empty_statement_or_continue_p ( statement  st)

Return true if the statement is an empty instruction block or a continue or a recursive combination of above.

Well there is at least one possibly usefull thing...

Parameters
stt

Definition at line 474 of file statement.c.

475 {
476  instruction i;
477 
478  if (continue_statement_p(st))
479  return true;
480  i = statement_instruction(st);
481  if (instruction_block_p(i)) {
483  {
485  /* Well there is at least one possibly usefull thing... */
486  return false;
487  }
488  return true;
489  }
490  return false;
491 }
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
bool empty_statement_or_continue_p(statement st)
Return true if the statement is an empty instruction block or a continue or a recursive combination o...
Definition: statement.c:474
bool continue_statement_p(statement s)
Test if a statement is a CONTINUE, that is the FORTRAN nop, the ";" in C or the "pass" in Python....
Definition: statement.c:203
#define instruction_block_p(i)
#define instruction_block(i)
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413

References continue_statement_p(), empty_statement_or_continue_p(), FOREACH, instruction_block, instruction_block_p, STATEMENT, and statement_instruction.

Referenced by add_omp_guard(), clean_up_exit_node(), empty_statement_or_continue_p(), fuse_sequences_in_unstructured(), gpu_promote_sequential_on_sequence(), look_for_inner_loops(), look_for_nested_loop_statements(), sequence_working_false(), take_out_the_exit_node_if_not_a_continue(), and taskify_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty_statement_or_continue_without_comment_p()

bool empty_statement_or_continue_without_comment_p ( statement  st)

Return true if the statement is an empty instruction block or a continue without comments or without LABEL or without declarations or a recursive combination of above.

The very last condition should be sufficient

Everything in the block are commentless continue or empty statements:

Everything else useful:

Parameters
stt

Definition at line 497 of file statement.c.

498 {
499  instruction i;
500  string the_comments = statement_comments(st);
501 
502  /* The very last condition should be sufficient */
503  if (!empty_comments_p(the_comments))
504  return false;
505 
506  if (!unlabelled_statement_p(st))
507  return false;
509  return true;
510 
511  i = statement_instruction(st);
512  if (instruction_block_p(i)) {
513  MAP(STATEMENT, s,
514  {
516  return false;
517  },
518  instruction_block(i));
519  /* Everything in the block are commentless continue or empty
520  statements: */
521  return true;
522  }
523  /* Everything else useful: */
524  return false;
525 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
bool unlabelled_statement_p(statement st)
Definition: statement.c:402
bool empty_statement_or_continue_without_comment_p(statement st)
Return true if the statement is an empty instruction block or a continue without comments or without ...
Definition: statement.c:497
bool empty_comments_p(const char *s)
Definition: statement.c:107
#define statement_declarations(x)
Definition: ri.h:2460
#define statement_comments(x)
Definition: ri.h:2456

References continue_statement_p(), empty_comments_p(), empty_statement_or_continue_without_comment_p(), ENDP, instruction_block, instruction_block_p, MAP, STATEMENT, statement_comments, statement_declarations, statement_instruction, and unlabelled_statement_p().

Referenced by copy_from_statement(), copy_to_statement(), empty_statement_or_continue_without_comment_p(), fuse_sequences_in_unstructured(), and remove_useless_continue_or_empty_code_in_unstructured().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty_statement_or_labelless_continue_p()

bool empty_statement_or_labelless_continue_p ( statement  st)

Return true if the statement is an empty instruction block without label or a continue without label or a recursive combination of above.

FI: I add a check on declarations. With their initializations, they have side effects. See C_syntax/block01.c.

FI: same issue with CONTINUE.

If there is an extension on it (such as a pragma) return false since this statement may be useful/

Well there is at least one possibly usefull thing...

Parameters
stt

Definition at line 446 of file statement.c.

447 {
448  instruction i;
449 
450  if (!unlabelled_statement_p(st)
452  return false;
453 
454  if (continue_statement_p(st))
455  return ENDP(statement_declarations(st));
456 
457  i = statement_instruction(st);
459  MAP(STATEMENT, s,
460  {
462  /* Well there is at least one possibly usefull thing... */
463  return false;
464  },
465  instruction_block(i));
466  return true;
467  }
468  return false;
469 }
bool empty_statement_or_labelless_continue_p(statement st)
Return true if the statement is an empty instruction block without label or a continue without label ...
Definition: statement.c:446
bool empty_extensions_p(extensions es)
Definition: extension.c:50
#define statement_extensions(x)
Definition: ri.h:2464

References continue_statement_p(), empty_extensions_p(), empty_statement_or_labelless_continue_p(), ENDP, instruction_block, instruction_block_p, MAP, STATEMENT, statement_declarations, statement_extensions, statement_instruction, and unlabelled_statement_p().

Referenced by clean_up_sequences_rewrite(), control_test_p(), down_counter(), empty_statement_or_labelless_continue_p(), and end_omp_construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ empty_statement_p()

bool empty_statement_p ( statement  st)

Test if a statement is empty.

Parameters
stt

Definition at line 391 of file statement.c.

392 {
393  instruction i;
394 
395  return(unlabelled_statement_p(st) &&
397  ENDP(instruction_block(i)) &&
399 }

References ENDP, instruction_block, instruction_block_p, statement_declarations, statement_instruction, and unlabelled_statement_p().

Referenced by c_test(), clean_up_sequences_rewrite(), compile_body(), gcc_if_block_braces_required_p(), html_print_test(), st_test(), test_to_postcondition(), test_with_no_else_clause_p(), text_block_else(), and text_io_block_if().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nop_statement_p()

bool nop_statement_p ( statement  s)

NOP statements are useful to fill in empty test branches. The definition of NOP in PIPS has changed over the years. A NOP statement is an empty block. Like blocks, it cannot be labelled nor commented. It has no statement number because it is invisible to users.

Dangling comments, like labels, are attached to CONTINUE statements.

Note 1: blocks are now called "sequences" Note 2: see also empty_statement_p()

Definition at line 407 of file statement.c.

408 {
409  /* NOP statements are useful to fill in empty test branches.
410  * The definition of NOP in PIPS has changed over the years.
411  * A NOP statement is an empty block. Like blocks, it cannot be
412  * labelled nor commented. It has no statement number because it
413  * is invisible to users.
414  *
415  * Dangling comments, like labels, are attached to CONTINUE statements.
416  *
417  * Note 1: blocks are now called "sequences"
418  * Note 2: see also empty_statement_p()
419  */
420  bool nop = false;
422 
424  pips_assert("No label!", unlabelled_statement_p(s));
425  pips_assert("No comments", empty_comments_p(statement_comments(s)));
426  pips_assert("No statement number",
428  nop = true;
429  }
430 
431  return nop;
432 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define STATEMENT_NUMBER_UNDEFINED
default values
#define statement_number(x)
Definition: ri.h:2452

References empty_comments_p(), ENDP, instruction_block, instruction_block_p, pips_assert, statement_comments, statement_instruction, statement_number, STATEMENT_NUMBER_UNDEFINED, and unlabelled_statement_p().

Referenced by take_out_the_exit_node_if_not_a_continue(), test_with_dangling_else_p(), and text_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ statement_call_p()

bool statement_call_p ( statement  s)

Definition at line 364 of file statement.c.

365 {
367 }
#define instruction_call_p(x)
Definition: ri.h:1527

References instruction_call_p, and statement_instruction.

Referenced by alias_check_array_and_scalar_variable_in_caller_flt(), alias_check_array_and_scalar_variable_in_module_flt(), alias_check_array_variable_in_caller_flt(), alias_check_array_variable_in_module_flt(), alias_check_scalar_variable_in_caller_flt(), alias_check_scalar_variable_in_module_flt(), alias_check_two_variables(), BDSC(), change_basic_if_needed(), compute_SENDRECV_regions(), contexts_mapping_of_nest(), do_reduction_atomization(), do_redundant_load_store_elimination(), dynamic_alias_check_flt(), ensure_comment_consistency(), fcs_count(), find_implicit_goto(), freia_cmp_statement(), freia_is_transpose_call(), freia_shuffle_move_forward(), freia_substitute_by_helper_call(), fsi_seq_flt(), generate_c1_alpha(), generate_c1_beta(), generate_code_seq(), get_assigned_variable(), get_complement_expression(), impact_check_two_variables(), kernel_load_store_generator(), last_statement(), list_of_calls_p(), match_statement(), maybe_unroll_while_rwt(), perform_substitution_in_assign(), prepare_context(), process_static_initializations(), remove_unread_variable(), replace_reductions_in_statement(), seq_rwt(), sequence_call(), simd_load_stat_p(), simd_store_stat_p(), simd_work_stat_p(), simdize_simple_statements(), statement_call(), step_translate_and_map_step_regions(), terapixify_loop_purge(), text_complexity(), text_test(), top_down_abc_not_exact_case(), two_addresses_code_generator(), and variable_is_written_by_statement_flt().

◆ statement_expression_p()

bool statement_expression_p ( statement  s)

Definition at line 384 of file statement.c.

385 {
387 }
#define instruction_expression_p(x)
Definition: ri.h:1539

References instruction_expression_p, and statement_instruction.

Referenced by last_statement(), and statement_expression().

+ Here is the caller graph for this function:

◆ statement_forloop_p()

◆ statement_goto_p()

bool statement_goto_p ( statement  s)

Definition at line 359 of file statement.c.

360 {
362 }
#define instruction_goto_p(x)
Definition: ri.h:1524

References instruction_goto_p, and statement_instruction.

Referenced by last_statement(), and statement_goto().

+ Here is the caller graph for this function:

◆ statement_loop_p()

bool statement_loop_p ( statement  s)

Definition at line 349 of file statement.c.

350 {
352 }
#define instruction_loop_p(x)
Definition: ri.h:1518

References instruction_loop_p, and statement_instruction.

Referenced by add_toggle_inc_statements(), begin_omp_construct(), com_statement_p(), comEngine_opt_loop_interchange(), complete_loop_transformer(), complete_loop_transformer_list(), condition_body_contains_loop_p(), contexts_mapping_of_nest(), delay_communications_anyloop(), depth_of_perfect_loop_nest(), distributable_loop(), do_computation_intensity(), do_kernelize(), do_loop_nest_unswitching(), do_loop_to_for_loop(), do_loop_to_while_loop(), do_terapix_warmup(), end_omp_construct(), find_pragma(), find_statements_with_label_walker(), get_loop_locals_and_remove_walker(), get_variables_to_remove(), guard_expanded_statement_if_needed(), hpf_compile_loop(), inlining_regenerate_labels(), is_SCOP_rich(), keep_loop_indices(), last_statement(), LinkInstToCurrentBlock(), loop_variant_list(), make_seqStat(), mark_loop_to_outline(), module_loops_walker(), move_statements_stat(), old_complete_whileloop_transformer(), outline(), parallel_loop_statement_p(), parallelize_annotated_loop_nest(), perfectly_nested_loop_to_body_at_depth(), phrase_remove_dependences_rwt(), prepare_icm(), process_reductions_in_loop(), process_reductions_in_openmp_loop(), process_true_stat(), quick_privatize_graph(), quick_privatize_statement_pair(), range_flt(), range_rwt(), reduction_rewrite_filter(), region_of_loop(), rice_loop(), rice_statement(), rice_update_dependence_graph(), rw_loop(), selected_loop_p(), sequence_loop(), statement_loop(), statement_to_loop_statement_list(), statement_to_postcondition(), statements_conflict_p(), step_directive_basic_workchunk(), step_directive_basic_workchunk_index(), symbolic_tiling_valid_p(), taskify_statement(), terapix_loop_handler(), terapix_loop_optimizer(), terapixify_loops(), test_dependence_using_regions(), and unroll_loops_in_statement().

◆ statement_multitest_p()

bool statement_multitest_p ( statement  s)

Definition at line 379 of file statement.c.

380 {
382 }
#define instruction_multitest_p(x)
Definition: ri.h:1533

References instruction_multitest_p, and statement_instruction.

Referenced by statement_multitest().

+ Here is the caller graph for this function:

◆ statement_sequence_p()

◆ statement_test_p()

◆ statement_unstructured_p()

◆ statement_whileloop_p()

bool statement_whileloop_p ( statement  s)

Definition at line 354 of file statement.c.

355 {
357 }
#define instruction_whileloop_p(x)
Definition: ri.h:1521

References instruction_whileloop_p, and statement_instruction.

Referenced by delay_communications_anyloop(), last_statement(), old_complete_whileloop_transformer(), statement_may_have_control_effects_p(), and statement_whileloop().

+ Here is the caller graph for this function:

◆ unlabelled_statement_p()

bool unlabelled_statement_p ( statement  st)
Parameters
stt

Definition at line 402 of file statement.c.

403 {
405 }
bool entity_empty_label_p(entity e)
Definition: entity.c:666
#define statement_label(x)
Definition: ri.h:2450

References entity_empty_label_p(), and statement_label.

Referenced by add_label_to_statement(), clean_up_sequences_rewrite(), controlize_sequence(), empty_statement_or_continue_without_comment_p(), empty_statement_or_labelless_continue_p(), empty_statement_p(), fix_sequence_statement_attributes(), MakeLabeledStatement(), nop_statement_p(), take_out_the_entry_node_of_the_unstructured(), and update_statement_instruction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: