libFirm
be.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5 
11 #ifndef FIRM_BE_H
12 #define FIRM_BE_H
13 
14 #include <stdio.h>
15 #include "irarch.h"
16 #include "iroptimize.h"
17 #include "irmode.h"
18 #include "begin.h"
19 
30 typedef enum asm_constraint_flags_t {
54 ENUM_BITSET(asm_constraint_flags_t)
55 
56 
57 typedef enum {
58  DW_LANG_C89 = 0x0001,
59  DW_LANG_C = 0x0002,
60  DW_LANG_Ada83 = 0x0003,
62  DW_LANG_Cobol74 = 0x0005,
63  DW_LANG_Cobol85 = 0x0006,
66  DW_LANG_Pascal83 = 0x0009,
67  DW_LANG_Modula2 = 0x000a,
68  DW_LANG_Java = 0x000b,
69  DW_LANG_C99 = 0x000c,
70  DW_LANG_Ada95 = 0x000d,
72  DW_LANG_PLI = 0x000f,
73  DW_LANG_ObjC = 0x0010,
75  DW_LANG_UPC = 0x0012,
76  DW_LANG_D = 0x0013,
77  DW_LANG_Python = 0x0014,
78  DW_LANG_Go = 0x0016,
80 
81 typedef void(*lower_func)(ir_node*);
82 
87 typedef struct vararg_params {
94 
99 typedef struct backend_params {
100  /* Info whether this backend is unfinished. */
101  char const *experimental;
102 
104  unsigned byte_order_big_endian:1;
106  unsigned pic_supported:1;
109  unsigned unaligned_memaccess_supported:1;
111  unsigned thread_local_storage_supported:1;
112 
119  unsigned modulo_shift;
120 
123 
126 
129  unsigned machine_size;
130 
136 
141 
144 
147 
151 
158 FIRM_API int be_parse_arg(const char *arg);
159 
164 FIRM_API int be_is_big_endian(void);
165 
170 FIRM_API unsigned be_get_machine_size(void);
171 
178 FIRM_API ir_mode *be_get_mode_float_arithmetic(void);
179 
181 FIRM_API ir_type *be_get_type_long_double(void);
182 
185 
190 FIRM_API void be_initialize(void);
191 
198 FIRM_API const backend_params *be_get_backend_param(void);
199 
209 FIRM_API void be_lower_for_target(void);
210 
211 typedef void (*after_transform_func)(ir_graph *irg, const char *name);
212 
219 
223 FIRM_API void be_main(FILE *output, const char *compilation_unit_name);
224 
229 FIRM_API asm_constraint_flags_t be_parse_asm_constraints(const char *constraints);
230 
234 FIRM_API int be_is_valid_clobber(const char *clobber);
235 
240 
245 FIRM_API void be_dwarf_set_compilation_directory(const char *directory);
246 
249 #include "end.h"
250 
251 #endif
float_int_conversion_overflow_style_t float_int_overflow
Semantic on float->int conversion overflow.
Definition: be.h:146
unsigned machine_size
size of machine word in bits.
Definition: be.h:129
asm_constraint_flags_t
flags categorizing assembler constraint specifications
Definition: be.h:30
void be_lower_for_target(void)
Lowers current program for the target architecture.
void(* after_transform_func)(ir_graph *irg, const char *name)
Definition: be.h:211
unsigned be_get_machine_size(void)
Returns size of machine words.
Definition: be.h:59
int be_is_valid_clobber(const char *clobber)
tests whether a string is a valid clobber in an ASM instruction
ir_type * va_list_type
Which type is to be used for va_list.
Definition: be.h:90
void be_dwarf_set_source_language(dwarf_source_language language)
Sets source language for dwarf debug information.
void be_dwarf_set_compilation_directory(const char *directory)
Sets working directory of the compiler (or directory where the compiler searched for sources) for dwa...
Definition: be.h:69
ir_type * type_long_double
type used for long double or NULL if none available.
Definition: be.h:140
invalid constraint (due to parse error)
Definition: be.h:52
ir_mode * mode_float_arithmetic
some backends like x87 can only do arithmetic in a specific float mode (load/store are still done in ...
Definition: be.h:135
const ir_settings_arch_dep_t * dep_param
Settings for architecture dependent optimizations.
Definition: be.h:122
Definition: be.h:72
input can be encoded as an immediate number
Definition: be.h:37
dwarf_source_language
Dwarf source language codes.
Definition: be.h:57
ir_type * be_get_type_long_double(void)
Returns type used for long double or NULL if none available.
input/output can be read/written to/from a memory address
Definition: be.h:35
struct ir_type ir_type
Type.
Definition: firm_types.h:71
Definition: be.h:75
const backend_params * be_get_backend_param(void)
Returns the backend configuration parameter.
ir_mode * be_get_mode_float_arithmetic(void)
Returns supported float arithmetic mode or NULL if mode_D and mode_F are supported natively...
void(* lower_func)(ir_node *)
Definition: be.h:81
The input is also written to.
Definition: be.h:43
unsigned modulo_shift
Shifts on this architecture only read some bits of the shift value.
Definition: be.h:119
arch_allow_ifconv_func allow_ifconv
Backend settings for if-conversion.
Definition: be.h:125
asm_constraint_flags_t be_parse_asm_constraints(const char *constraints)
parse assembler constraint strings and returns flags (so the frontend knows which operands are inputs...
float_int_conversion_overflow_style_t be_get_float_int_overflow(void)
Returns the backend behaviour on float to integer conversion overflow.
void be_main(FILE *output, const char *compilation_unit_name)
Main interface to the frontend.
no constraints
Definition: be.h:31
input/output can be in a register, in memory or an immediate
Definition: be.h:39
float_int_conversion_overflow_style_t
Specifies what happens when a float value is converted to an integer and overflow happens...
Definition: irmode.h:53
vararg_params vararg
How this backend implements variadic functions.
Definition: be.h:149
the input is read
Definition: be.h:45
input/output can be in a register
Definition: be.h:33
unsigned stack_param_align
Alignment of stack parameters.
Definition: be.h:143
int(* arch_allow_ifconv_func)(ir_node *sel, ir_node *mux_false, ir_node *mux_true)
This function is called to evaluate, if a mux(sel, mux_false, mux_true) should be built for the curre...
Definition: iroptimize.h:108
This structure holds the information on how the backend implements variadic functions.
Definition: be.h:87
This structure contains parameters that should be propagated to the libFirm parameter set...
Definition: be.h:99
Definition: be.h:76
This operand and the following operand are commutative.
Definition: be.h:50
void be_initialize(void)
Initialize the backend for the selected isa.
char const * experimental
Definition: be.h:101
struct ir_mode ir_mode
SSA Value mode.
Definition: firm_types.h:59
the value is modified before all inputs to the asm block are handled.
Definition: be.h:48
int be_parse_arg(const char *arg)
Parse one backend argument.
int be_is_big_endian(void)
Returns 1 if the backend uses big-endian byte ordering and 0 for little-endian.
void be_set_after_transform_func(after_transform_func func)
Sets a callback that is called after each transformation step in be_lower_for_target().
lower_func lower_va_arg
The function to lower a call to the va_arg macro.
Definition: be.h:92
struct ir_node ir_node
Procedure Graph Node.
Definition: firm_types.h:53
struct ir_graph ir_graph
Procedure Graph.
Definition: firm_types.h:74
Definition: be.h:78
struct ir_settings_arch_dep_t ir_settings_arch_dep_t
Definition: irarch.h:34
the constraint is not supported yet by libFirm (but valid in gcc)
Definition: be.h:41
Definition: be.h:58