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 @@
* PURPOSE.
*/
/*
* Project: libFIRM
* File name: ir/tv/fltcalc.c
* Purpose:
* Author:
* Modified by:
* Created: 2003
* CVS-ID: $Id$
* Copyright: (c) 2003 Universitt Karlsruhe
/**
* @file
* @brief tarval floating point calculations
* @date 2003
* @author Mathias Heil
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "fltcalc.h"
#include "strcalc.h"
......
......@@ -17,19 +17,15 @@
* PURPOSE.
*/
/*
* Project: libFIRM
* File name: ir/tv/fltcalc.h
* Purpose:
* Author:
* Modified by:
* Created: 2003
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
/**
* @file
* @brief tarval floating point calculations
* @date 2003
* @author Mathias Heil
* @version $Id$
*/
#ifndef _FLTCALC_H_
#define _FLTCALC_H_
#ifndef FIRM_TV_FLTCALC_H
#define FIRM_TV_FLTCALC_H
#include "firm_config.h"
......@@ -48,7 +44,7 @@ typedef enum {
FC_div, /**< divide */
FC_neg, /**< negate */
FC_int, /**< truncate to integer */
FC_rnd /**< round to integer */
FC_rnd /**< round to integer */
} fc_op_t;
enum {
......@@ -68,9 +64,6 @@ typedef enum {
#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
* All functions that accept NULL as return buffer put their result into an
......@@ -82,7 +75,7 @@ const void *fc_get_buffer(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
* 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
* @return The result pointer passed to the function. If this was NULL this returns
* 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
* 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);
* @return The result pointer passed to the function. If this was NULL this returns
* 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
......@@ -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
* a pointer to the internal accumulator buffer
*/
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_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_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_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_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_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);
/*@}*/
int fc_is_zero(const void *a);
......@@ -162,13 +155,13 @@ int fc_is_inf(const void *a);
int fc_is_nan(const void *a);
int fc_is_subnormal(const void *a);
FC_DECLARE2(add);
FC_DECLARE2(sub);
FC_DECLARE2(mul);
FC_DECLARE2(div);
FC_DECLARE1(neg);
FC_DECLARE1(int);
FC_DECLARE1(rnd);
char *fc_add(const void *a, const void *b, void *result);
char *fc_sub(const void *a, const void *b, void *result);
char *fc_mul(const void *a, const void *b, void *result);
char *fc_div(const void *a, const void *b, void *result);
char *fc_neg(const void *a, void *result);
char *fc_int(const void *a, void *result);
char *fc_rnd(const void *a, void *result);
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);
fc_rounding_mode_t fc_get_rounding_mode(void);
/** 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
* encoding formats, i.e.
* One bit sign
......@@ -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);
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 @@
* PURPOSE.
*/
/*
* Project: libFIRM
* File name: ir/tv/strcalc.c
* Purpose:
* Author: Mathias Heil
* Modified by:
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
/**
* @file
* @brief Provides basic mathematical operations on values represented as strings.
* @date 2003
* @author Mathias Heil
* @version $Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
......
......@@ -17,19 +17,13 @@
* 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
* to perform calculations with these values.
......@@ -37,9 +31,8 @@
* of them if you need to store the result.
*
*/
#ifndef _STRCALC_H_
#define _STRCALC_H_
#ifndef FIRM_TV_STRCALC_H
#define FIRM_TV_STRCALC_H
#include "irmode.h"
......@@ -88,7 +81,7 @@ enum {
*/
typedef enum {
SC_ADD = 0, /**< Addition */
SC_SUB, /**< Substraction */
SC_SUB, /**< Subtraction */
SC_NEG, /**< Unary Minus */
SC_MUL, /**< Multiplication */
SC_DIV, /**< Integer Division (with rounding toward zero ?) */
......@@ -186,4 +179,4 @@ void init_strcalc(int precision_in_bytes);
void finish_strcalc(void);
int sc_get_precision(void);
#endif /* _STRCALC_H_ */
#endif /* FIRM_TV_STRCALC_H */
......@@ -17,33 +17,24 @@
* PURPOSE.
*/
/*
* Project: libFIRM
* File name: ir/tv/tv.c
* Purpose: Representation of and static computations on target machine
* values.
* Author: Mathias Heil
* Modified by:
* Created:
* 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.
/**
* @file
* @brief Representation of and static computations on target machine
* values.
* @date 2003
* @author Mathias Heil
* @version $Id$
* @summary
*
* 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
# include "config.h"
#endif
#include <assert.h> /* assertions */
#include <stdlib.h> /* atoi() */
#ifdef HAVE_STRING_H
......
......@@ -17,71 +17,41 @@
* 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
*
* Declarations for Target Values.
*/
#ifndef _TV_H_
#define _TV_H_
#include "irmode.h"
#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.
* @file
* @brief Representation of and static computations on target machine
* values.
* @date 2003
* @author Mathias Heil
* @version $Id$
* @summary
* Tarvals represent target machine values. They are typed by modes.
* Tarvals only represent values of mode_sort:
* int_number,
* float_number,
* boolean,
* reference,
* character
* - int_number,
* - float_number,
* - boolean,
* - reference,
* - character
*
* In case of references the module accepts an entity to represent the
* value.
* Furthermore, computations and conversions of these values can
* Furthermore, computations and conversions of these values can
* 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
* The original tv module originated in the fiasco compiler written ...
* This is the new version, described in the tech report 1999-14 by ...
*
* SEE ALSO
* @sa
* Techreport 1999-14
* irmode.h for the modes definitions
* irnode.h for the pn_Cmp table
*
* tarval_init1 and tarval_init2 for initialization of the
* module
*
******/
*/
#ifndef FIRM_TV_TV_H
#define FIRM_TV_TV_H
#include "firm_types.h"
#include "irnode.h"
#ifndef _TARVAL_TYPEDEF_
#define _TARVAL_TYPEDEF_
......@@ -623,4 +593,4 @@ int tarval_snprintf(char *buf, size_t buflen, tarval *tv);
*/
int tarval_printf(tarval *tv);
#endif /* _TV_H_ */
#endif /* FIRM_TV_TV_H */
......@@ -17,19 +17,16 @@
* PURPOSE.
*/
/*
* Project: libFIRM
* File name: ir/tv/tv_t.h
* Purpose: Representation of and static computations on target machine
* values -- private header.
* Author: Mathias Heil
* Modified by:
* Created:
* CVS-ID: $Id$
* Copyright: (c) 2003 Universität Karlsruhe
/**
* @file
* @brief Representation of and static computations on target machine
* values -- private header.
* @date 2003
* @author Mathias Heil
* @version $Id$
*/
#ifndef _TV_T_H_
#define _TV_T_H_
#ifndef FIRM_TV_TV_T_H
#define FIRM_TV_TV_T_H
#include "firm_config.h"
......@@ -37,12 +34,12 @@
#include "irmode.h"
#include "tv.h"
/* debugging aid */
/** Debugging aid for the firmEvaluator: Marks for reserved tarvals values. */
enum reserved_id {
resid_tarval_bad = 1,
resid_tarval_undefined = 2,
resid_tarval_b_false = 3,
resid_tarval_b_true = 4
resid_tarval_bad = 1, /**< tarval_bad marker. */
resid_tarval_undefined = 2, /**< tarval_undefined marker. */
resid_tarval_b_false = 3, /**< tarval_b_false marker. */
resid_tarval_b_true = 4 /**< tarval_b_true marker. */
};
/**
......@@ -123,4 +120,4 @@ _get_tarval_b_true(void) {
#define get_tarval_b_true() _get_tarval_b_true()
#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