summaryrefslogtreecommitdiff
path: root/gcc/ipa-structure-reorg.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ipa-structure-reorg.c')
-rw-r--r--gcc/ipa-structure-reorg.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ipa-structure-reorg.c b/gcc/ipa-structure-reorg.c
index c8a6d742c3a..b58264c6d09 100644
--- a/gcc/ipa-structure-reorg.c
+++ b/gcc/ipa-structure-reorg.c
@@ -1542,6 +1542,32 @@ find_struct_type_ptr_to_struct ( tree type, Info *info)
return NULL;
}
+// The applied function func can be used to search because it forces
+// a return if it returns true;
+void
+apply_to_all_gimple ( bool (*function)(gimple *, void *), void *data )
+{
+ struct cgraph_node *node;
+ FOR_EACH_FUNCTION_WITH_GIMPLE_BODY ( node)
+ {
+ struct function *func = DECL_STRUCT_FUNCTION ( node->decl);
+ push_cfun ( func);
+ basic_block bb;
+ FOR_EACH_BB_FN ( bb, func)
+ {
+ gimple_stmt_iterator gsi;
+ for ( gsi = gsi_start_bb ( bb); !gsi_end_p ( gsi); gsi_next ( &gsi) )
+ {
+ gimple *stmt = gsi_stmt ( gsi);
+ // If we are searching for something then return here because
+ // it's found.
+ if ( (*function) ( stmt, data )) return;
+ }
+ }
+ pop_cfun ();
+ }
+}
+
// TBD Garbage just so it will compile
// What's dicey about this is it may sort of work but then I
// can see places where it wouldn't... The language has a say