libFirm 1.20
|
00001 /* 00002 * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. 00003 * 00004 * This file is part of libFirm. 00005 * 00006 * This file may be distributed and/or modified under the terms of the 00007 * GNU General Public License version 2 as published by the Free Software 00008 * Foundation and appearing in the file LICENSE.GPL included in the 00009 * packaging of this file. 00010 * 00011 * Licensees holding valid libFirm Professional Edition licenses may use 00012 * this file in accordance with the libFirm Commercial License. 00013 * Agreement provided with the Software. 00014 * 00015 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00017 * PURPOSE. 00018 */ 00019 00025 #ifndef FIRM_LOWERING_H 00026 #define FIRM_LOWERING_H 00027 00028 #include <stddef.h> 00029 00030 #include "firm_types.h" 00031 00032 #include "begin.h" 00033 00062 FIRM_API void lower_CopyB(ir_graph *irg, unsigned max_small_size, 00063 unsigned min_large_size, int allow_misalignments); 00064 00077 FIRM_API void lower_switch(ir_graph *irg, unsigned small_switch, 00078 unsigned spare_size, int allow_out_of_bounds); 00079 00090 FIRM_API void lower_highlevel_graph(ir_graph *irg); 00091 00099 FIRM_API ir_graph_pass_t *lower_highlevel_graph_pass(const char *name); 00100 00110 FIRM_API void lower_highlevel(void); 00111 00115 FIRM_API void lower_const_code(void); 00116 00124 FIRM_API ir_prog_pass_t *lower_const_code_pass(const char *name); 00125 00134 typedef int lower_mux_callback(ir_node* mux); 00135 00144 FIRM_API void lower_mux(ir_graph *irg, lower_mux_callback *cb_func); 00145 00155 FIRM_API ir_graph_pass_t *lower_mux_pass(const char *name, 00156 lower_mux_callback *cb_func); 00157 00166 typedef int (*i_mapper_func)(ir_node *node, void *ctx); 00167 00170 enum ikind { 00171 INTRINSIC_CALL = 0, 00172 INTRINSIC_INSTR 00173 }; 00174 00178 typedef struct i_call_record { 00179 enum ikind kind; 00180 ir_entity *i_ent; 00181 i_mapper_func i_mapper; 00182 void *ctx; 00183 void *link; 00184 } i_call_record; 00185 00189 typedef struct i_instr_record { 00190 enum ikind kind; 00191 ir_op *op; 00192 i_mapper_func i_mapper; 00193 void *ctx; 00194 void *link; 00195 } i_instr_record; 00196 00200 typedef union i_record { 00201 enum ikind kind; 00202 i_call_record i_call; 00203 i_instr_record i_instr; 00204 } i_record; 00205 00220 FIRM_API size_t lower_intrinsics(i_record *list, size_t length, 00221 int part_block_used); 00222 00231 FIRM_API ir_prog_pass_t *lower_intrinsics_pass(const char *name, i_record *list, 00232 size_t length, int part_block_used); 00233 00240 FIRM_API int i_mapper_abs(ir_node *call, void *ctx); 00241 00248 FIRM_API int i_mapper_bswap(ir_node *call, void *ctx); 00249 00255 FIRM_API int i_mapper_sqrt(ir_node *call, void *ctx); 00256 00262 FIRM_API int i_mapper_cbrt(ir_node *call, void *ctx); 00263 00269 FIRM_API int i_mapper_pow(ir_node *call, void *ctx); 00270 00276 FIRM_API int i_mapper_exp(ir_node *call, void *ctx); 00277 00283 FIRM_API int i_mapper_exp2(ir_node *call, void *ctx); 00284 00290 FIRM_API int i_mapper_exp10(ir_node *call, void *ctx); 00291 00297 FIRM_API int i_mapper_log(ir_node *call, void *ctx); 00298 00304 FIRM_API int i_mapper_log2(ir_node *call, void *ctx); 00305 00311 FIRM_API int i_mapper_log10(ir_node *call, void *ctx); 00312 00318 FIRM_API int i_mapper_sin(ir_node *call, void *ctx); 00319 00325 FIRM_API int i_mapper_cos(ir_node *call, void *ctx); 00326 00332 FIRM_API int i_mapper_tan(ir_node *call, void *ctx); 00333 00339 FIRM_API int i_mapper_asin(ir_node *call, void *ctx); 00340 00346 FIRM_API int i_mapper_acos(ir_node *call, void *ctx); 00347 00353 FIRM_API int i_mapper_atan(ir_node *call, void *ctx); 00354 00360 FIRM_API int i_mapper_sinh(ir_node *call, void *ctx); 00361 00367 FIRM_API int i_mapper_cosh(ir_node *call, void *ctx); 00368 00374 FIRM_API int i_mapper_tanh(ir_node *call, void *ctx); 00375 00381 FIRM_API int i_mapper_strcmp(ir_node *call, void *ctx); 00382 00388 FIRM_API int i_mapper_strncmp(ir_node *call, void *ctx); 00389 00395 FIRM_API int i_mapper_strcpy(ir_node *call, void *ctx); 00396 00402 FIRM_API int i_mapper_strlen(ir_node *call, void *ctx); 00403 00409 FIRM_API int i_mapper_memcpy(ir_node *call, void *ctx); 00410 00416 FIRM_API int i_mapper_mempcpy(ir_node *call, void *ctx); 00417 00423 FIRM_API int i_mapper_memmove(ir_node *call, void *ctx); 00424 00430 FIRM_API int i_mapper_memset(ir_node *call, void *ctx); 00431 00437 FIRM_API int i_mapper_memcmp(ir_node *call, void *ctx); 00438 00445 FIRM_API int i_mapper_alloca(ir_node *call, void *ctx); 00446 00450 typedef struct runtime_rt { 00451 ir_entity *ent; 00452 ir_mode *mode; 00453 ir_mode *res_mode; 00454 long mem_proj_nr; 00455 long regular_proj_nr; 00456 long exc_proj_nr; 00457 long res_proj_nr; 00458 } runtime_rt; 00459 00519 FIRM_API int i_mapper_RuntimeCall(ir_node *node, runtime_rt *rt); 00520 00523 #include "end.h" 00524 00525 #endif