libFirm
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
lowering.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
11 #ifndef FIRM_LOWERING_H
12 #define FIRM_LOWERING_H
13 
14 #include <stddef.h>
15 
16 #include "firm_types.h"
17 
18 #include "begin.h"
19 
78 FIRM_API void lower_CopyB(ir_graph *irg, unsigned max_small_size,
79  unsigned min_large_size, int allow_misalignments);
80 
91 FIRM_API void lower_switch(ir_graph *irg, unsigned small_switch,
92  unsigned spare_size, ir_mode *selector_mode);
93 
104 FIRM_API void lower_highlevel_graph(ir_graph *irg);
105 
115 FIRM_API void lower_highlevel(void);
116 
120 FIRM_API void lower_const_code(void);
121 
130 typedef int lower_mux_callback(ir_node* mux);
131 
140 FIRM_API void lower_mux(ir_graph *irg, lower_mux_callback *cb_func);
141 
148 typedef int (i_mapper_func)(ir_node *node);
149 
152 enum ikind {
155 };
156 
160 typedef struct i_call_record {
161  enum ikind kind;
164 } i_call_record;
165 
169 typedef struct i_instr_record {
170  enum ikind kind;
174 
178 typedef union i_record {
179  enum ikind kind;
182 } i_record;
183 
185 
195  size_t length,
196  int part_block_used);
197 
202 FIRM_API void ir_free_intrinsics_map(ir_intrinsics_map *map);
203 
210 FIRM_API void ir_lower_intrinsics(ir_graph *irg, ir_intrinsics_map *map);
211 
218 FIRM_API int i_mapper_abs(ir_node *call);
219 
225 FIRM_API int i_mapper_sqrt(ir_node *call);
226 
232 FIRM_API int i_mapper_cbrt(ir_node *call);
233 
239 FIRM_API int i_mapper_pow(ir_node *call);
240 
246 FIRM_API int i_mapper_exp(ir_node *call);
247 
253 FIRM_API int i_mapper_exp2(ir_node *call);
254 
260 FIRM_API int i_mapper_exp10(ir_node *call);
261 
267 FIRM_API int i_mapper_log(ir_node *call);
268 
274 FIRM_API int i_mapper_log2(ir_node *call);
275 
281 FIRM_API int i_mapper_log10(ir_node *call);
282 
288 FIRM_API int i_mapper_sin(ir_node *call);
289 
295 FIRM_API int i_mapper_cos(ir_node *call);
296 
302 FIRM_API int i_mapper_tan(ir_node *call);
303 
309 FIRM_API int i_mapper_asin(ir_node *call);
310 
316 FIRM_API int i_mapper_acos(ir_node *call);
317 
323 FIRM_API int i_mapper_atan(ir_node *call);
324 
330 FIRM_API int i_mapper_sinh(ir_node *call);
331 
337 FIRM_API int i_mapper_cosh(ir_node *call);
338 
344 FIRM_API int i_mapper_tanh(ir_node *call);
345 
351 FIRM_API int i_mapper_strcmp(ir_node *call);
352 
358 FIRM_API int i_mapper_strncmp(ir_node *call);
359 
365 FIRM_API int i_mapper_strcpy(ir_node *call);
366 
372 FIRM_API int i_mapper_strlen(ir_node *call);
373 
379 FIRM_API int i_mapper_memcpy(ir_node *call);
380 
386 FIRM_API int i_mapper_memmove(ir_node *call);
387 
393 FIRM_API int i_mapper_memset(ir_node *call);
394 
400 FIRM_API int i_mapper_memcmp(ir_node *call);
401 
404 #include "end.h"
405 
406 #endif
int i_mapper_acos(ir_node *call)
A mapper for the floating point acos(a): floattype acos(floattype a);.
void lower_highlevel_graph(ir_graph *irg)
Replaces Offsets and TypeConsts by a real constant if possible.
enum ikind kind
must be INTRINSIC_INSTR
Definition: lowering.h:170
int i_mapper_log(ir_node *call)
A mapper for the floating point log(a): floattype log(floattype a);.
int i_mapper_memmove(ir_node *call)
A mapper for the memmove-Function: void pointer memmove(void pointer d, void pointer s...
int i_mapper_cbrt(ir_node *call)
A mapper for the floating point cbrt(v): floattype sqrt(floattype v);.
the record represents an intrinsic instruction
Definition: lowering.h:154
i_mapper_func * i_mapper
the mapper function to call
Definition: lowering.h:172
void lower_highlevel(void)
Replaces Offsets and TypeConsts by a real constant if possible.
ir_intrinsics_map * ir_create_intrinsics_map(i_record *list, size_t length, int part_block_used)
Create a new intrinsic lowering map which can be used by ir_lower_intrinsics.
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
int i_mapper_sqrt(ir_node *call)
A mapper for the floating point sqrt(v): floattype sqrt(floattype v);.
int i_mapper_asin(ir_node *call)
A mapper for the floating point asin(a): floattype asin(floattype a);.
int i_mapper_log2(ir_node *call)
A mapper for the floating point log(a): floattype log(floattype a);.
i_mapper_func * i_mapper
the mapper function to call
Definition: lowering.h:163
the record represents an intrinsic call
Definition: lowering.h:153
int i_mapper_abs(ir_node *call)
A mapper for the integer/float absolute value: type abs(type v).
int i_mapper_memcpy(ir_node *call)
A mapper for the memcpy-Function: void pointer memcpy(void pointer d, void pointer s...
int i_mapper_memcmp(ir_node *call)
A mapper for the strncmp-Function: inttype memcmp(void pointer a, void pointer b, inttype len);...
int i_mapper_log10(ir_node *call)
A mapper for the floating point log(a): floattype log(floattype a);.
int i_mapper_strlen(ir_node *call)
A mapper for the strlen-Function: inttype strlen(char pointer a);.
i_call_record i_call
used for call records
Definition: lowering.h:180
ir_op * op
the opcode that must be mapped.
Definition: lowering.h:171
int i_mapper_exp(ir_node *call)
A mapper for the floating point exp(a): floattype exp(floattype a);.
int i_mapper_sin(ir_node *call)
A mapper for the floating point sin(a): floattype sin(floattype a);.
void lower_switch(ir_graph *irg, unsigned small_switch, unsigned spare_size, ir_mode *selector_mode)
Lowers all Switches (Cond nodes with non-boolean mode) depending on spare_size.
int( i_mapper_func)(ir_node *node)
An intrinsic mapper function.
Definition: lowering.h:148
int i_mapper_exp2(ir_node *call)
A mapper for the floating point exp2(a): floattype exp2(floattype a);.
int i_mapper_tan(ir_node *call)
A mapper for the floating point tan(a): floattype tan(floattype a);.
An intrinsic call record.
Definition: lowering.h:160
An intrinsic instruction record.
Definition: lowering.h:169
An intrinsic record.
Definition: lowering.h:178
void ir_lower_intrinsics(ir_graph *irg, ir_intrinsics_map *map)
Go through all graphs and map calls to intrinsic functions and instructions.
struct ir_op ir_op
Node Opcode.
Definition: firm_types.h:56
int i_mapper_strncmp(ir_node *call)
A mapper for the strncmp-Function: inttype strncmp(char pointer a, char pointer b, inttype len);.
struct ir_intrinsics_map ir_intrinsics_map
Definition: lowering.h:184
struct ir_entity ir_entity
Entity.
Definition: firm_types.h:83
ikind
kind of an instruction record
Definition: lowering.h:152
void lower_const_code(void)
does the same as lower_highlevel for all nodes on the const code irg
ir_entity * i_ent
the entity representing an intrinsic call
Definition: lowering.h:162
int i_mapper_cos(ir_node *call)
A mapper for the floating point sin(a): floattype cos(floattype a);.
void lower_mux(ir_graph *irg, lower_mux_callback *cb_func)
Lowers all mux nodes in the given graph.
int lower_mux_callback(ir_node *mux)
Used as callback, whenever a lowerable mux is found.
Definition: lowering.h:130
void ir_free_intrinsics_map(ir_intrinsics_map *map)
Frees resources occupied by an intrisics_map created by ir_create_intrinsics_map().
int i_mapper_pow(ir_node *call)
A mapper for the floating point pow(a, b): floattype pow(floattype a, floattype b);.
enum ikind kind
must be INTRINSIC_CALL
Definition: lowering.h:161
i_instr_record i_instr
used for isnstruction records
Definition: lowering.h:181
int i_mapper_tanh(ir_node *call)
A mapper for the floating point tanh(a): floattype tanh(floattype a);.
int i_mapper_memset(ir_node *call)
A mapper for the memset-Function: void pointer memset(void pointer d, inttype C, inttype len);...
struct ir_mode ir_mode
SSA Value mode.
Definition: firm_types.h:59
struct ir_node ir_node
Procedure Graph Node.
Definition: firm_types.h:53
enum ikind kind
kind of record
Definition: lowering.h:179
int i_mapper_cosh(ir_node *call)
A mapper for the floating point cosh(a): floattype cosh(floattype a);.
int i_mapper_atan(ir_node *call)
A mapper for the floating point atan(a): floattype atan(floattype a);.
int i_mapper_exp10(ir_node *call)
A mapper for the floating point exp10(a): floattype exp10(floattype a);.
void lower_CopyB(ir_graph *irg, unsigned max_small_size, unsigned min_large_size, int allow_misalignments)
Lower small CopyB nodes to Load/Store nodes, preserve medium-sized CopyB nodes and replace large Copy...
int i_mapper_strcmp(ir_node *call)
A mapper for the strcmp-Function: inttype strcmp(char pointer a, char pointer b);.
int i_mapper_sinh(ir_node *call)
A mapper for the floating point sinh(a): floattype sinh(floattype a);.
int i_mapper_strcpy(ir_node *call)
A mapper for the strcpy-Function: char pointer strcpy(char pointer a, char pointer b);...