X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fcommon%2Ffirmwalk.h;h=6fce4eb74f39108624a21885c878897ab21a59af;hb=002120b9325bd7e1da3ebb9dd258350011ad863c;hp=76b31faef9fcccc22b6709716397ecc8d051ac12;hpb=02aeb1d1145b379c4e82e0a9f055ee3ca66fa5ef;p=libfirm diff --git a/ir/common/firmwalk.h b/ir/common/firmwalk.h index 76b31faef..6fce4eb74 100644 --- a/ir/common/firmwalk.h +++ b/ir/common/firmwalk.h @@ -1,3 +1,15 @@ +/* + * Project: libFIRM + * File name: ir/common/firmwalk.h + * Purpose: Walker that touches all Firm data structures + * Author: Sebastian Felis + * Modified by: + * Created: 7.2003 + * CVS-ID: $Id$ + * Copyright: (c) 2003 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ + /** * @file firmwalk.h * @@ -20,9 +32,12 @@ #ifndef _FIRM_WALK_H_ #define _FIRM_WALK_H_ -#include "type.h" -#include "irgraph.h" -#include "typewalk.h" +#include "firm_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + /** Returns the link of a firm node. * Possible firm structures are: entity, type, ir_graph, ir_node and @@ -33,7 +48,7 @@ * by this firm walker to collect walking data. * * @param thing Pointer to a firm structure - * @retrun Link pointer + * @return Link pointer * * @note After calling firm_walk_finalize() the stored link * information may be invalid. */ @@ -47,7 +62,7 @@ void *get_firm_walk_link(void *thing); * to a firm structure. The real link field of firm structure is used * by this firm walker to collect walking data. * - * @param thing firm structur + * @param thing firm structure * @param link Pointer to link field * * @note After calling firm_walk_finalize() the stored link @@ -62,17 +77,17 @@ typedef void firm_walk_finalize_func(void *env); /** Mode callback function definition */ typedef void firm_walk_mode_func(ir_mode *mode, void *env); /** Type callback function definition */ -typedef void firm_walk_type_func(type *tp, void *env); +typedef void firm_walk_type_func(ir_type *tp, void *env); /** Entity callback function definition */ typedef void firm_walk_entity_func(entity *ent, void *env); /** Graph callback function definition */ typedef void firm_walk_graph_func(ir_graph *irg, void *env); -//@{ +/* @{ */ /** Block callback function definition */ typedef void firm_walk_block_init_func(ir_graph *irg, void *env); typedef void firm_walk_block_func(ir_node *block, void *env); typedef void firm_walk_block_finalize_func(ir_graph *irg, void *env); -//@} +/* @} */ /** Node callback function definition */ typedef void firm_walk_node_func (ir_node *irn, void *env); @@ -82,17 +97,17 @@ typedef void firm_walk_node_func (ir_node *irn, void *env); */ typedef enum { - FGD_WITH_ALL_TYPES = 1<<0, /**< Collect and dump all types, especially + FW_WITH_ALL_TYPES = 1<<0, /**< Collect and dump all types, especially unused types. @note This flag could be set in firm_dumper_init() and is unused in firm_dump() */ - FGD_WITH_DOMINATOR = 1<<1, /**< nyi */ - FGD_WITH_OUTEDGES = 1<<2, /**< nyi */ - FGD_WITH_LOOPS = 1<<3, /**< nyi */ - FGD_DUMP_BLOCK_AS_IRN = 1<<4, /**< Dump all block nodes as irn nodes + FW_WITH_DOMINATOR = 1<<1, /**< nyi */ + FW_WITH_OUTEDGES = 1<<2, /**< nyi */ + FW_WITH_LOOPS = 1<<3, /**< nyi */ + FW_DUMP_BLOCK_AS_IRN = 1<<4, /**< Dump all block nodes as irn nodes additionally */ - FGD_DUMP_IRN_IN_PREFIX = 1<<5, /**< Dumps all ir nodes in prefix order + FW_DUMP_IRN_IN_PREFIX = 1<<5 /**< Dumps all ir nodes in prefix order according to the internal firm graph structure */ } firm_walk_flags; @@ -100,37 +115,38 @@ typedef enum /** Interface of the firm walker */ typedef struct { - //@{ + /* @{ */ /** Interface function to dump all used and internal modes. Internal modes are: BB, X, M and T */ firm_walk_init_func *do_mode_init; firm_walk_mode_func *do_mode; firm_walk_finalize_func *do_mode_finalize; - //@} + /* @} */ - //@{ + /* @{ */ /** Interface to dump all collected types. * - * @node To dump all (not only used types by default) a special walk + * @note To dump all (not only used types by default) a special walk * flag must be set for the walker initializer */ firm_walk_init_func *do_type_init; firm_walk_type_func *do_type; firm_walk_finalize_func *do_type_finalize; - //@} + /* @} */ - //@{ + /* @{ */ /** Dumping interface for entities */ firm_walk_init_func *do_entity_init; firm_walk_entity_func *do_entity; firm_walk_finalize_func *do_entity_finalize; - //@} + /* @} */ /** Dumps all graphs and subnodes. * * The firm walker dump a graph with its blocks and nodes nested. * Fist do_graph_init will be called (if defined). For each graph - * do_graph will be call in a loop. After dumped all graphs, - * do_graph_finalize will be called. + * do_graph will be call in a loop. + * After all blocks in a graph are dumped, do_graph_post() is called. + * After dumped all graphs, do_graph_finalize will be called. * * Within do_graph each block will be dumped. First do_block_init, * for each block do_block and after all dumped blocks @@ -142,16 +158,18 @@ typedef struct * walking flag, a prefix order is also possible. */ firm_walk_init_func *do_graph_init; firm_walk_graph_func *do_graph; + firm_walk_graph_func *do_graph_post; firm_walk_finalize_func *do_graph_finalize; - //@{ + /* @{ */ /** Dumping interface for blocks. If blocks should be handled like * like a normal ir node, a special walker flag could be set. * @see do_graph */ firm_walk_block_init_func *do_block_init; firm_walk_block_func *do_block; + firm_walk_block_func *do_block_post; firm_walk_block_finalize_func *do_block_finalize; - //@} + /* @} */ /** Dumping interface for ir nodes * @see do_graph */ @@ -193,4 +211,9 @@ void firm_walk(firm_walk_interface *wif); /** Finalize the walker and frees all stored data for dumping */ void firm_walk_finalize(void); +#ifdef __cplusplus +} +#endif + + #endif /* _FIRM_WALK_H_ */