libFirm 1.20
libfirm/irmode.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_IRMODE_H
00027 #define FIRM_IR_IRMODE_H
00028 
00029 #include "firm_types.h"
00030 #include "begin.h"
00031 
00032 #include <stddef.h>
00033 
00050 typedef enum ir_mode_arithmetic {
00051     irma_uninitialized = 0,
00052     irma_none = 1,            
00055     irma_twos_complement = 2, 
00058     irma_ieee754 = 256,       
00061     irma_x86_extended_float,  
00062     irma_last = irma_x86_extended_float,
00063 } ir_mode_arithmetic;
00064 
00081 FIRM_API ir_mode *new_int_mode(const char *name,
00082                                ir_mode_arithmetic arithmetic,
00083                                unsigned bit_size, int sign,
00084                                unsigned modulo_shift);
00085 
00091 FIRM_API ir_mode *new_reference_mode(const char *name,
00092                                      ir_mode_arithmetic arithmetic,
00093                                      unsigned bit_size,
00094                                      unsigned modulo_shift);
00095 
00105 FIRM_API ir_mode *new_float_mode(const char *name,
00106                                  ir_mode_arithmetic arithmetic,
00107                                  unsigned exponent_size,
00108                                  unsigned mantissa_size);
00109 
00118 FIRM_API int is_mode(const void *thing);
00119 
00121 FIRM_API ident *get_mode_ident(const ir_mode *mode);
00122 
00124 FIRM_API const char *get_mode_name(const ir_mode *mode);
00125 
00127 FIRM_API unsigned get_mode_size_bits(const ir_mode *mode);
00128 
00131 FIRM_API unsigned get_mode_size_bytes(const ir_mode *mode);
00132 
00136 FIRM_API int get_mode_sign(const ir_mode *mode);
00137 
00139 FIRM_API ir_mode_arithmetic get_mode_arithmetic(const ir_mode *mode);
00140 
00147 FIRM_API unsigned int get_mode_modulo_shift(const ir_mode *mode);
00148 
00150 FIRM_API void *get_mode_link(const ir_mode *mode);
00151 
00153 FIRM_API void set_mode_link(ir_mode *mode, void *l);
00154 
00161 FIRM_API ir_tarval *get_mode_min(ir_mode *mode);
00162 
00169 FIRM_API ir_tarval *get_mode_max(ir_mode *mode);
00170 
00179 FIRM_API ir_tarval *get_mode_null(ir_mode *mode);
00180 
00188 FIRM_API ir_tarval *get_mode_one(ir_mode *mode);
00189 
00196 FIRM_API ir_tarval *get_mode_minus_one(ir_mode *mode);
00197 
00203 FIRM_API ir_tarval *get_mode_all_one(ir_mode *mode);
00204 
00211 FIRM_API ir_tarval *get_mode_infinite(ir_mode *mode);
00212 
00219 FIRM_API ir_tarval *get_mode_NAN(ir_mode *mode);
00220 
00221 FIRM_API ir_mode *mode_M; 
00223 FIRM_API ir_mode *mode_F;   
00224 FIRM_API ir_mode *mode_D;   
00225 FIRM_API ir_mode *mode_Q;   
00226 FIRM_API ir_mode *mode_Bs;  
00227 FIRM_API ir_mode *mode_Bu;  
00228 FIRM_API ir_mode *mode_Hs;  
00229 FIRM_API ir_mode *mode_Hu;  
00230 FIRM_API ir_mode *mode_Is;  
00231 FIRM_API ir_mode *mode_Iu;  
00232 FIRM_API ir_mode *mode_Ls;  
00233 FIRM_API ir_mode *mode_Lu;  
00234 FIRM_API ir_mode *mode_LLs; 
00235 FIRM_API ir_mode *mode_LLu; 
00237 FIRM_API ir_mode *mode_P;   
00238 FIRM_API ir_mode *mode_P_code; 
00241 FIRM_API ir_mode *mode_P_data; 
00245 FIRM_API ir_mode *mode_b;  
00247 FIRM_API ir_mode *mode_X;  
00248 FIRM_API ir_mode *mode_BB; 
00250 FIRM_API ir_mode *mode_T;  
00251 FIRM_API ir_mode *mode_ANY;
00252 FIRM_API ir_mode *mode_BAD;
00255 FIRM_API ir_mode *get_modeF(void);
00257 FIRM_API ir_mode *get_modeD(void);
00259 FIRM_API ir_mode *get_modeQ(void);
00261 FIRM_API ir_mode *get_modeBs(void);
00263 FIRM_API ir_mode *get_modeBu(void);
00265 FIRM_API ir_mode *get_modeHs(void);
00267 FIRM_API ir_mode *get_modeHu(void);
00269 FIRM_API ir_mode *get_modeIs(void);
00271 FIRM_API ir_mode *get_modeIu(void);
00273 FIRM_API ir_mode *get_modeLs(void);
00275 FIRM_API ir_mode *get_modeLu(void);
00277 FIRM_API ir_mode *get_modeLLs(void);
00279 FIRM_API ir_mode *get_modeLLu(void);
00281 FIRM_API ir_mode *get_modeP(void);
00283 FIRM_API ir_mode *get_modeb(void);
00285 FIRM_API ir_mode *get_modeX(void);
00287 FIRM_API ir_mode *get_modeBB(void);
00289 FIRM_API ir_mode *get_modeM(void);
00291 FIRM_API ir_mode *get_modeT(void);
00293 FIRM_API ir_mode *get_modeANY(void);
00295 FIRM_API ir_mode *get_modeBAD(void);
00296 
00298 FIRM_API ir_mode *get_modeP_code(void);
00299 
00301 FIRM_API ir_mode *get_modeP_data(void);
00302 
00307 FIRM_API void set_modeP_code(ir_mode *p);
00308 
00313 FIRM_API void set_modeP_data(ir_mode *p);
00314 
00316 FIRM_API int mode_is_signed (const ir_mode *mode);
00318 FIRM_API int mode_is_float (const ir_mode *mode);
00320 FIRM_API int mode_is_int (const ir_mode *mode);
00322 FIRM_API int mode_is_reference (const ir_mode *mode);
00324 FIRM_API int mode_is_num (const ir_mode *mode);
00326 FIRM_API int mode_is_data (const ir_mode *mode);
00328 FIRM_API int mode_is_datab (const ir_mode *mode);
00330 FIRM_API int mode_is_dataM (const ir_mode *mode);
00331 
00340 FIRM_API int smaller_mode(const ir_mode *sm, const ir_mode *lm);
00341 
00350 FIRM_API int values_in_mode(const ir_mode *sm, const ir_mode *lm);
00351 
00356 FIRM_API ir_mode *find_unsigned_mode(const ir_mode *mode);
00357 
00362 FIRM_API ir_mode *find_signed_mode(const ir_mode *mode);
00363 
00368 FIRM_API ir_mode *find_double_bits_int_mode(const ir_mode *mode);
00369 
00374 FIRM_API int mode_honor_signed_zeros(const ir_mode *mode);
00375 
00379 FIRM_API int mode_overflow_on_unary_Minus(const ir_mode *mode);
00380 
00387 FIRM_API int mode_wrap_around(const ir_mode *mode);
00388 
00392 FIRM_API ir_mode *get_reference_mode_signed_eq(ir_mode *mode);
00393 
00397 FIRM_API void set_reference_mode_signed_eq(ir_mode *ref_mode, ir_mode *int_mode);
00398 
00402 FIRM_API ir_mode *get_reference_mode_unsigned_eq(ir_mode *mode);
00403 
00407 FIRM_API void set_reference_mode_unsigned_eq(ir_mode *ref_mode, ir_mode *int_mode);
00408 
00412 FIRM_API unsigned get_mode_mantissa_size(const ir_mode *mode);
00413 
00417 FIRM_API unsigned get_mode_exponent_size(const ir_mode *mode);
00418 
00424 FIRM_API int is_reinterpret_cast(const ir_mode *src, const ir_mode *dst);
00425 
00429 FIRM_API ir_type *get_type_for_mode(const ir_mode *mode);
00430 
00432 FIRM_API size_t ir_get_n_modes(void);
00433 
00435 FIRM_API ir_mode *ir_get_mode(size_t num);
00436 
00439 #include "end.h"
00440 
00441 #endif