libFirm 1.20
libfirm/irarch.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 1995-2008 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 
00026 #ifndef FIRM_IR_IRARCH_H
00027 #define FIRM_IR_IRARCH_H
00028 
00029 #include "firm_types.h"
00030 #include "begin.h"
00031 
00035 typedef enum instr {
00036     LEA,   
00037     SHIFT, 
00038     SUB,   
00039     ADD,   
00040     ZERO,  
00041     MUL,   
00042     ROOT   
00043 } insn_kind;
00044 
00054 typedef int (*evaluate_costs_func)(insn_kind kind, const ir_mode *mode, ir_tarval *tv);
00055 
00060 typedef struct ir_settings_arch_dep_t {
00061     /* Mul optimization */
00062     unsigned also_use_subs : 1;    
00063     unsigned maximum_shifts;       
00064     unsigned highest_shift_amount; 
00067     evaluate_costs_func evaluate;  
00069     /* Div/Mod optimization */
00070     unsigned allow_mulhs   : 1;    
00071     unsigned allow_mulhu   : 1;    
00072     unsigned max_bits_for_mulh;    
00074 } ir_settings_arch_dep_t;
00075 
00080 typedef const ir_settings_arch_dep_t *(*arch_dep_params_factory_t)(void);
00081 
00085 typedef enum {
00086     arch_dep_none         = 0,
00087     arch_dep_mul_to_shift = 1,  
00088     arch_dep_div_by_const = 2,  
00089     arch_dep_mod_by_const = 4   
00090 } arch_dep_opts_t;
00091 ENUM_BITSET(arch_dep_opts_t)
00092 
00093 
00097 FIRM_API void arch_dep_set_opts(arch_dep_opts_t opts);
00098 
00106 FIRM_API ir_node *arch_dep_replace_mul_with_shifts(ir_node *irn);
00107 
00123 FIRM_API ir_node *arch_dep_replace_div_by_const(ir_node *irn);
00124 
00140 FIRM_API ir_node *arch_dep_replace_mod_by_const(ir_node *irn);
00141 
00142 #include "end.h"
00143 
00144 #endif