X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=include%2Flibfirm%2Flowering.h;h=12ff0565f203486df6c14ef938ee55595a2fa0e5;hb=6bc15eba58c5d8c33b010fdb85cbf384b758283e;hp=44ea887fd8bde28dd4e9c99ced8c1988b7c362af;hpb=b3b65d5e83b23c0d6c748c6caa4863803c58cc87;p=libfirm diff --git a/include/libfirm/lowering.h b/include/libfirm/lowering.h index 44ea887fd..12ff0565f 100644 --- a/include/libfirm/lowering.h +++ b/include/libfirm/lowering.h @@ -21,7 +21,6 @@ * @file * @brief Lowering of high level constructs. * @author Michael Beck - * @version $Id$ */ #ifndef FIRM_LOWERING_H #define FIRM_LOWERING_H @@ -33,10 +32,35 @@ #include "begin.h" /** - * Lower CopyB nodes of size smaller that max_size into Loads/Stores + * @defgroup ir_lowering Lowering + * + * Lowering is the process of transforming a highlevel representation + * (a representation closer to the sourcecode) into a lower-level representation + * (something closer to the target machine). + * + * @{ */ -FIRM_API void lower_CopyB(ir_graph *irg, unsigned max_size, - unsigned native_mode_bytes); + +/** + * Lower small CopyB nodes to Load/Store nodes, preserve medium-sized CopyB + * nodes and replace large CopyBs by a call to memcpy, depending on the given + * parameters. + * + * Small CopyB nodes (size <= max_small_size) are turned into a series of + * loads and stores. + * Medium-sized CopyB nodes (max_small_size < size < min_large_size) are + * left untouched. + * Large CopyB nodes (size >= min_large_size) are turned into a memcpy call. + * + * @param irg The graph to be lowered. + * @param max_small_size The maximum number of bytes for a CopyB node so + * that it is still considered 'small'. + * @param min_large_size The minimum number of bytes for a CopyB node so + * that it is regarded as 'large'. + * @param allow_misalignments Backend can handle misaligned loads and stores. + */ +FIRM_API void lower_CopyB(ir_graph *irg, unsigned max_small_size, + unsigned min_large_size, int allow_misalignments); /** * Lowers all Switches (Cond nodes with non-boolean mode) depending on spare_size. @@ -59,25 +83,20 @@ FIRM_API void lower_switch(ir_graph *irg, unsigned small_switch, * Handle bit fields by added And/Or calculations. * * @param irg the graph to lower - * @param lower_bitfields the graph contains old-style bitfield - * constructs * * @note: There is NO lowering ob objects oriented types. This is highly compiler * and ABI specific and should be placed directly in the compiler. */ -FIRM_API void lower_highlevel_graph(ir_graph *irg, int lower_bitfields); +FIRM_API void lower_highlevel_graph(ir_graph *irg); /** * Creates an ir_graph pass for lower_highlevel_graph(). * * @param name the name of this pass or NULL - * @param lower_bitfields the graph contains old-style bitfield - * constructs * * @return the newly created ir_graph pass */ -FIRM_API ir_graph_pass_t *lower_highlevel_graph_pass(const char *name, - int lower_bitfields); +FIRM_API ir_graph_pass_t *lower_highlevel_graph_pass(const char *name); /** * Replaces SymConsts by a real constant if possible. @@ -88,7 +107,7 @@ FIRM_API ir_graph_pass_t *lower_highlevel_graph_pass(const char *name, * @note There is NO lowering of objects oriented types. This is highly compiler * and ABI specific and should be placed directly in the compiler. */ -FIRM_API void lower_highlevel(int lower_bitfields); +FIRM_API void lower_highlevel(void); /** * does the same as lower_highlevel for all nodes on the const code irg @@ -104,48 +123,6 @@ FIRM_API void lower_const_code(void); */ FIRM_API ir_prog_pass_t *lower_const_code_pass(const char *name); -/** - * Function which creates a "set" instraction. A "set" instruction takes a - * condition value (a value with mode_b) as input and produces a value in a - * general purpose integer mode. - * Most architectures have special intrinsics for this. But if all else fails - * you can just produces the an if-like construct. - */ -typedef ir_node* (*create_set_func)(ir_node *cond); - -/** - * implementation of create_set_func which produces a Mux node with 0/1 input - */ -FIRM_API ir_node *ir_create_mux_set(ir_node *cond, ir_mode *dest_mode); - -/** - * implementation of create_set_func which produces a cond with control - * flow - */ -FIRM_API ir_node *ir_create_cond_set(ir_node *cond, ir_mode *dest_mode); - -typedef struct lower_mode_b_config_t { - /* mode that is used to transport 0/1 values */ - ir_mode *lowered_mode; - /* callback for creating set-like instructions */ - create_set_func create_set; - /* whether direct Cond(Cmp) should also be lowered */ - int lower_direct_cmp; -} lower_mode_b_config_t; - -/** - * Lowers mode_b operations to integer arithmetic. After the lowering the only - * operations with mode_b are the Projs of Cmps; the only nodes with mode_b - * inputs are Cond and Psi nodes. - * - * Example: Psi(a < 0, 1, 0) => a >> 31 - * - * @param irg the firm graph to lower - * @param config configuration for mode_b lowerer - */ -FIRM_API void ir_lower_mode_b(ir_graph *irg, - const lower_mode_b_config_t *config); - /** * Used as callback, whenever a lowerable mux is found. The return value * indicates, whether the mux should be lowered. This may be used, to lower @@ -295,8 +272,19 @@ FIRM_API int i_mapper_pow(ir_node *call, void *ctx); */ FIRM_API int i_mapper_exp(ir_node *call, void *ctx); -#define i_mapper_exp2 i_mapper_exp -#define i_mapper_exp10 i_mapper_exp +/** + * A mapper for the floating point exp2(a): floattype exp2(floattype a); + * + * @return 1 if the exp call was removed, 0 else. + */ +FIRM_API int i_mapper_exp2(ir_node *call, void *ctx); + +/** + * A mapper for the floating point exp10(a): floattype exp10(floattype a); + * + * @return 1 if the exp call was removed, 0 else. + */ +FIRM_API int i_mapper_exp10(ir_node *call, void *ctx); /** * A mapper for the floating point log(a): floattype log(floattype a); @@ -305,8 +293,19 @@ FIRM_API int i_mapper_exp(ir_node *call, void *ctx); */ FIRM_API int i_mapper_log(ir_node *call, void *ctx); -#define i_mapper_log2 i_mapper_log -#define i_mapper_log10 i_mapper_log +/** + * A mapper for the floating point log(a): floattype log(floattype a); + * + * @return 1 if the log call was removed, 0 else. + */ +FIRM_API int i_mapper_log2(ir_node *call, void *ctx); + +/** + * A mapper for the floating point log(a): floattype log(floattype a); + * + * @return 1 if the log call was removed, 0 else. + */ +FIRM_API int i_mapper_log10(ir_node *call, void *ctx); /** * A mapper for the floating point sin(a): floattype sin(floattype a); @@ -516,6 +515,8 @@ typedef struct runtime_rt { */ FIRM_API int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt); +/** @} */ + #include "end.h" #endif