Commit 4316c003 authored by Michael Beck's avatar Michael Beck
Browse files

Updated header

removed ugly defined that create simple declarartions
more doxygen docu added

[r13512]
parent 628ca4a7
...@@ -17,23 +17,18 @@ ...@@ -17,23 +17,18 @@
* PURPOSE. * PURPOSE.
*/ */
/* /**
* Project: libFIRM * @file
* File name: ir/tv/fltcalc.c * @brief tarval floating point calculations
* Purpose: * @date 2003
* Author: * @author Mathias Heil
* Modified by: * @version $Id$
* Created: 2003
* CVS-ID: $Id$
* Copyright: (c) 2003 Universitt Karlsruhe
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include "fltcalc.h" #include "fltcalc.h"
#include "strcalc.h" #include "strcalc.h"
......
...@@ -17,19 +17,15 @@ ...@@ -17,19 +17,15 @@
* PURPOSE. * PURPOSE.
*/ */
/* /**
* Project: libFIRM * @file
* File name: ir/tv/fltcalc.h * @brief tarval floating point calculations
* Purpose: * @date 2003
* Author: * @author Mathias Heil
* Modified by: * @version $Id$
* Created: 2003
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
*/ */
#ifndef FIRM_TV_FLTCALC_H
#ifndef _FLTCALC_H_ #define FIRM_TV_FLTCALC_H
#define _FLTCALC_H_
#include "firm_config.h" #include "firm_config.h"
...@@ -48,7 +44,7 @@ typedef enum { ...@@ -48,7 +44,7 @@ typedef enum {
FC_div, /**< divide */ FC_div, /**< divide */
FC_neg, /**< negate */ FC_neg, /**< negate */
FC_int, /**< truncate to integer */ FC_int, /**< truncate to integer */
FC_rnd /**< round to integer */ FC_rnd /**< round to integer */
} fc_op_t; } fc_op_t;
enum { enum {
...@@ -68,9 +64,6 @@ typedef enum { ...@@ -68,9 +64,6 @@ typedef enum {
#define FC_DEFAULT_PRECISION 64 #define FC_DEFAULT_PRECISION 64
#define FC_DECLARE1(code) char* fc_##code(const void *a, void *result)
#define FC_DECLARE2(code) char* fc_##code(const void *a, const void *b, void *result)
/*@{*/ /*@{*/
/** internal buffer access /** internal buffer access
* All functions that accept NULL as return buffer put their result into an * All functions that accept NULL as return buffer put their result into an
...@@ -82,7 +75,7 @@ const void *fc_get_buffer(void); ...@@ -82,7 +75,7 @@ const void *fc_get_buffer(void);
int fc_get_buffer_length(void); int fc_get_buffer_length(void);
/*}@*/ /*}@*/
char* fc_val_from_str(const char *str, unsigned int len, char exp_size, char mant_size, char *result); char *fc_val_from_str(const char *str, unsigned int len, char exp_size, char mant_size, char *result);
/** get the representation of a floating point value /** get the representation of a floating point value
* This function tries to builds a representation having the same value as the * This function tries to builds a representation having the same value as the
...@@ -101,7 +94,7 @@ char* fc_val_from_str(const char *str, unsigned int len, char exp_size, char man ...@@ -101,7 +94,7 @@ char* fc_val_from_str(const char *str, unsigned int len, char exp_size, char man
* @return The result pointer passed to the function. If this was NULL this returns * @return The result pointer passed to the function. If this was NULL this returns
* a pointer to the internal accumulator buffer * a pointer to the internal accumulator buffer
*/ */
char* fc_val_from_float(LLDBL l, char exp_size, char mant_size, char *result); char *fc_val_from_float(LLDBL l, char exp_size, char mant_size, char *result);
/** retrieve the float value of an internal value /** retrieve the float value of an internal value
* This function casts the internal value to LLDBL and returns a LLDBL with * This function casts the internal value to LLDBL and returns a LLDBL with
...@@ -130,7 +123,7 @@ LLDBL fc_val_to_float(const void *val); ...@@ -130,7 +123,7 @@ LLDBL fc_val_to_float(const void *val);
* @return The result pointer passed to the function. If this was NULL this returns * @return The result pointer passed to the function. If this was NULL this returns
* a pointer to the internal accumulator buffer * a pointer to the internal accumulator buffer
*/ */
char* fc_cast(const void *val, char exp_size, char mant_size, char *result); char *fc_cast(const void *val, char exp_size, char mant_size, char *result);
/*@{*/ /*@{*/
/** build a special float value /** build a special float value
...@@ -148,12 +141,12 @@ char* fc_cast(const void *val, char exp_size, char mant_size, char *result); ...@@ -148,12 +141,12 @@ char* fc_cast(const void *val, char exp_size, char mant_size, char *result);
* @return The result pointer passed to the function. If this was NULL this returns * @return The result pointer passed to the function. If this was NULL this returns
* a pointer to the internal accumulator buffer * a pointer to the internal accumulator buffer
*/ */
char* fc_get_min(unsigned int exponent_size, unsigned int mantissa_size, char* result); char *fc_get_min(unsigned int exponent_size, unsigned int mantissa_size, char* result);
char* fc_get_max(unsigned int exponent_size, unsigned int mantissa_size, char* result); char *fc_get_max(unsigned int exponent_size, unsigned int mantissa_size, char* result);
char* fc_get_snan(unsigned int exponent_size, unsigned int mantissa_size, char* result); char *fc_get_snan(unsigned int exponent_size, unsigned int mantissa_size, char* result);
char* fc_get_qnan(unsigned int exponent_size, unsigned int mantissa_size, char* result); char *fc_get_qnan(unsigned int exponent_size, unsigned int mantissa_size, char* result);
char* fc_get_plusinf(unsigned int exponent_size, unsigned int mantissa_size, char* result); char *fc_get_plusinf(unsigned int exponent_size, unsigned int mantissa_size, char* result);
char* fc_get_minusinf(unsigned int exponent_size, unsigned int mantissa_size, char* result); char *fc_get_minusinf(unsigned int exponent_size, unsigned int mantissa_size, char* result);
/*@}*/ /*@}*/
int fc_is_zero(const void *a); int fc_is_zero(const void *a);
...@@ -162,13 +155,13 @@ int fc_is_inf(const void *a); ...@@ -162,13 +155,13 @@ int fc_is_inf(const void *a);
int fc_is_nan(const void *a); int fc_is_nan(const void *a);
int fc_is_subnormal(const void *a); int fc_is_subnormal(const void *a);
FC_DECLARE2(add); char *fc_add(const void *a, const void *b, void *result);
FC_DECLARE2(sub); char *fc_sub(const void *a, const void *b, void *result);
FC_DECLARE2(mul); char *fc_mul(const void *a, const void *b, void *result);
FC_DECLARE2(div); char *fc_div(const void *a, const void *b, void *result);
FC_DECLARE1(neg); char *fc_neg(const void *a, void *result);
FC_DECLARE1(int); char *fc_int(const void *a, void *result);
FC_DECLARE1(rnd); char *fc_rnd(const void *a, void *result);
char *fc_print(const void *a, char *buf, int buflen, unsigned base); char *fc_print(const void *a, char *buf, int buflen, unsigned base);
...@@ -229,7 +222,7 @@ fc_rounding_mode_t fc_set_rounding_mode(fc_rounding_mode_t mode); ...@@ -229,7 +222,7 @@ fc_rounding_mode_t fc_set_rounding_mode(fc_rounding_mode_t mode);
fc_rounding_mode_t fc_get_rounding_mode(void); fc_rounding_mode_t fc_get_rounding_mode(void);
/** Get bit representation of a value /** Get bit representation of a value
* This function allows to read a value in encoded form, bytewise. * This function allows to read a value in encoded form, byte wise.
* The value will be packed corresponding to the way used by the IEEE * The value will be packed corresponding to the way used by the IEEE
* encoding formats, i.e. * encoding formats, i.e.
* One bit sign * One bit sign
...@@ -253,6 +246,6 @@ fc_rounding_mode_t fc_get_rounding_mode(void); ...@@ -253,6 +246,6 @@ fc_rounding_mode_t fc_get_rounding_mode(void);
unsigned char fc_sub_bits(const void *val, unsigned num_bit, unsigned byte_ofs); unsigned char fc_sub_bits(const void *val, unsigned num_bit, unsigned byte_ofs);
void init_fltcalc(int precision); void init_fltcalc(int precision);
void finish_fltcalc (void); void finish_fltcalc(void);
#endif /* _FLTCALC_H_ */ #endif /* FIRM_TV_FLTCALC_H */
...@@ -17,18 +17,14 @@ ...@@ -17,18 +17,14 @@
* PURPOSE. * PURPOSE.
*/ */
/* /**
* Project: libFIRM * @file
* File name: ir/tv/strcalc.c * @brief Provides basic mathematical operations on values represented as strings.
* Purpose: * @date 2003
* Author: Mathias Heil * @author Mathias Heil
* Modified by: * @version $Id$
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
......
...@@ -17,19 +17,13 @@ ...@@ -17,19 +17,13 @@
* PURPOSE. * PURPOSE.
*/ */
/*
* Project: libFIRM
* File name: ir/tv/strcalc.h
* Purpose: Provides basic mathematical operations on values represented as strings.
* Author: Mathias Heil
* Modified by:
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2003 Universitt Karlsruhe
*/
/** /**
* @file strcalc.h * @file
* @brief Provides basic mathematical operations on values represented as strings.
* @date 2003
* @author Mathias Heil
* @version $Id$
* @summary
* *
* The module uses a string to represent values, and provides operations * The module uses a string to represent values, and provides operations
* to perform calculations with these values. * to perform calculations with these values.
...@@ -37,9 +31,8 @@ ...@@ -37,9 +31,8 @@
* of them if you need to store the result. * of them if you need to store the result.
* *
*/ */
#ifndef FIRM_TV_STRCALC_H
#ifndef _STRCALC_H_ #define FIRM_TV_STRCALC_H
#define _STRCALC_H_
#include "irmode.h" #include "irmode.h"
...@@ -88,7 +81,7 @@ enum { ...@@ -88,7 +81,7 @@ enum {
*/ */
typedef enum { typedef enum {
SC_ADD = 0, /**< Addition */ SC_ADD = 0, /**< Addition */
SC_SUB, /**< Substraction */ SC_SUB, /**< Subtraction */
SC_NEG, /**< Unary Minus */ SC_NEG, /**< Unary Minus */
SC_MUL, /**< Multiplication */ SC_MUL, /**< Multiplication */
SC_DIV, /**< Integer Division (with rounding toward zero ?) */ SC_DIV, /**< Integer Division (with rounding toward zero ?) */
...@@ -186,4 +179,4 @@ void init_strcalc(int precision_in_bytes); ...@@ -186,4 +179,4 @@ void init_strcalc(int precision_in_bytes);
void finish_strcalc(void); void finish_strcalc(void);
int sc_get_precision(void); int sc_get_precision(void);
#endif /* _STRCALC_H_ */ #endif /* FIRM_TV_STRCALC_H */
...@@ -17,33 +17,24 @@ ...@@ -17,33 +17,24 @@
* PURPOSE. * PURPOSE.
*/ */
/* /**
* Project: libFIRM * @file
* File name: ir/tv/tv.c * @brief Representation of and static computations on target machine
* Purpose: Representation of and static computations on target machine * values.
* values. * @date 2003
* Author: Mathias Heil * @author Mathias Heil
* Modified by: * @version $Id$
* Created: * @summary
* CVS-ID: $Id$
* Copyright: (c) 2003-2007 Universitt Karlsruhe
*/
/*
* Values are stored in a format depending upon chosen arithmetic
* module. Default uses strcalc and fltcalc.
* *
* Values are stored in a format depending upon chosen arithmetic
* module. Default uses strcalc and fltcalc.
* This implementation assumes:
* - target has IEEE-754 floating-point arithmetic.
*/ */
/* This implementation assumes:
* - target has IEEE-754 floating-point arithmetic. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h> /* assertions */ #include <assert.h> /* assertions */
#include <stdlib.h> /* atoi() */ #include <stdlib.h> /* atoi() */
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
......
...@@ -17,71 +17,41 @@ ...@@ -17,71 +17,41 @@
* PURPOSE. * PURPOSE.
*/ */
/*
* Project: libFIRM
* File name: ir/tv/tv.h
* Purpose: Representation of and static computations on target machine
* values.
* Author: Mathias Heil
* Modified by:
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
*/
/** /**
* @file tv.h * @file
* * @brief Representation of and static computations on target machine
* Declarations for Target Values. * values.
*/ * @date 2003
#ifndef _TV_H_ * @author Mathias Heil
#define _TV_H_ * @version $Id$
* @summary
#include "irmode.h" * Tarvals represent target machine values. They are typed by modes.
#include "irnode.h"
/****h* libfirm/tv
*
* NAME
* tv -- TargetValue, short tarval.
* Internal representation for machine values.
*
* AUTHORS
* Matthias Heil
*
* DESCRIPTION
* Tarvals represent target machine values. They are typed by modes.
* Tarvals only represent values of mode_sort: * Tarvals only represent values of mode_sort:
* int_number, * - int_number,
* float_number, * - float_number,
* boolean, * - boolean,
* reference, * - reference,
* character * - character
* *
* In case of references the module accepts an entity to represent the * In case of references the module accepts an entity to represent the
* value. * value.
* Furthermore, computations and conversions of these values can * Furthermore, computations and conversions of these values can
* be performed. * be performed.
* *
* USES
* This module is closely related to the irmode module, as the modes
* defined there are thoroughly used throughout the whole module.
* Also, the comparison functions rely on the definition of comparison
* values in the irnode module.
*
* HISTORY * HISTORY
* The original tv module originated in the fiasco compiler written ... * The original tv module originated in the fiasco compiler written ...
* This is the new version, described in the tech report 1999-14 by ... * This is the new version, described in the tech report 1999-14 by ...
* *
* SEE ALSO * @sa
* Techreport 1999-14 * Techreport 1999-14
* irmode.h for the modes definitions * irmode.h for the modes definitions
* irnode.h for the pn_Cmp table * irnode.h for the pn_Cmp table
* */
* tarval_init1 and tarval_init2 for initialization of the #ifndef FIRM_TV_TV_H
* module #define FIRM_TV_TV_H
*
******/ #include "firm_types.h"
#include "irnode.h"
#ifndef _TARVAL_TYPEDEF_ #ifndef _TARVAL_TYPEDEF_
#define _TARVAL_TYPEDEF_ #define _TARVAL_TYPEDEF_
...@@ -623,4 +593,4 @@ int tarval_snprintf(char *buf, size_t buflen, tarval *tv); ...@@ -623,4 +593,4 @@ int tarval_snprintf(char *buf, size_t buflen, tarval *tv);
*/ */
int tarval_printf(tarval *tv); int tarval_printf(tarval *tv);
#endif /* _TV_H_ */ #endif /* FIRM_TV_TV_H */
...@@ -17,19 +17,16 @@ ...@@ -17,19 +17,16 @@
* PURPOSE. * PURPOSE.
*/ */
/* /**
* Project: libFIRM * @file
* File name: ir/tv/tv_t.h * @brief Representation of and static computations on target machine
* Purpose: Representation of and static computations on target machine * values -- private header.
* values -- private header. * @date 2003
* Author: Mathias Heil * @author Mathias Heil
* Modified by: * @version $Id$
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
*/ */
#ifndef _TV_T_H_ #ifndef FIRM_TV_TV_T_H
#define _TV_T_H_ #define FIRM_TV_TV_T_H
#include "firm_config.h" #include "firm_config.h"
...@@ -37,12 +34,12 @@ ...@@ -37,12 +34,12 @@
#include "irmode.h" #include "irmode.h"
#include "tv.h" #include "tv.h"
/* debugging aid */ /** Debugging aid for the firmEvaluator: Marks for reserved tarvals values. */
enum reserved_id { enum reserved_id {
resid_tarval_bad = 1, resid_tarval_bad = 1, /**< tarval_bad marker. */
resid_tarval_undefined = 2, resid_tarval_undefined = 2, /**< tarval_undefined marker. */
resid_tarval_b_false = 3, resid_tarval_b_false = 3, /**< tarval_b_false marker. */
resid_tarval_b_true = 4 resid_tarval_b_true = 4 /**< tarval_b_true marker. */
}; };
/** /**
...@@ -123,4 +120,4 @@ _get_tarval_b_true(void) { ...@@ -123,4 +120,4 @@ _get_tarval_b_true(void) {
#define get_tarval_b_true() _get_tarval_b_true() #define get_tarval_b_true() _get_tarval_b_true()
#define get_tarval_P_void() _get_tarval_P_void() #define get_tarval_P_void() _get_tarval_P_void()
#endif /* _TV_T_H_ */ #endif /* FIRM_TV_TV_T_H */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment