if (get_entity_peculiarity(ent) == description) {
/* @@@ GL Methode um Fehler anzuzeigen aufrufen! */
printf("WARNING: Calling method description %s in method %s which has "
- "no implementation!\n", id_to_str(get_entity_ident(ent)),
- id_to_str(get_entity_ident(get_irg_ent(current_ir_graph))));
+ "no implementation!\n", get_entity_name(ent),
+ get_entity_name(get_irg_ent(current_ir_graph)));
} else {
exchange(node, new_Bad());
}
init_firm (default_initialize_local_variable_func_t *func)
{
/* initialize all ident stuff */
- id_init ();
+ id_init (1024);
/* create the type kinds. */
init_tpop ();
/* create an obstack and put all tarvals in a pdeq */
larger values generally mean slower startup. */
-/** Expected number of distinct identifiers */
-#define TUNE_NIDENTS 1024
-
/** Expected number of classes */
#define TUNE_NCLASSES 128
+++ /dev/null
-/*
- * Project: libFIRM
- * File name: ir/common/xfprintf.c
- * Purpose: Xfprintf --- extended formatted output to files.
- * Author: Christian von Roques
- * Modified by:
- * Created: 1999 by getting from fiasco
- * CVS-ID: $Id$
- * Copyright: (c) 1995, 1996 Christian von Roques
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef USE_PRINTF
-
-#include <assert.h>
-#include "xprintf.h"
-
-
-static int
-xfprinter (void *f, const char *data, size_t len)
-{
- size_t togo = len;
-
- while (togo > 0) {
- size_t n = fwrite (data, 1, togo, (FILE*)f);
-
- if (!n) return -1;
- togo -= n;
- data += n;
- }
-
- return len;
-}
-
-int
-xfprintf (FILE *F, const char *fmt, ...)
-{
- va_list args;
- int res;
-
- va_start (args, fmt);
- res = xvgprintf (xfprinter, F, fmt, args);
- va_end (args);
- return res;
-}
-
-
-int
-xvfprintf (FILE *F, const char *fmt, va_list args)
-{
- return xvgprintf (xfprinter, F, fmt, args);
-}
-
-
-int
-xprintf (const char *fmt, ...)
-{
- va_list args;
- int res;
-
- va_start (args, fmt);
- res = xvgprintf (xfprinter, stdout, fmt, args);
- va_end (args);
- return res;
-}
-
-int
-xvprintf (const char *fmt, va_list args)
-{
- return xvgprintf (xfprinter, stdout, fmt, args);
-}
-
-#endif /* USE_PRINTF */
+++ /dev/null
-/*
- * Project: libFIRM
- * File name: ir/common/xgprintf.c
- * Purpose: Xgprintf --- extended formatted output via generic printer functions.
- * Author: Christian von Roques
- * Modified by:
- * Created: 1999 by getting from fiasco
- * CVS-ID: $Id$
- * Copyright: (c) 1995, 1996 Christian von Roques
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-
-/* Implements ANSI-C printf formats minus locale plus extensions,
- noteably GNU Libc-like registering of specifier-handlers. */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef USE_PRINTF
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <limits.h>
-#include <string.h>
-#include "misc.h"
-#include "xprintf.h"
-
-
-/* >= size of ASCII representation of a number using base 8 + 1 */
-#define BUFSIZE ((sizeof(unsigned long)*CHAR_BIT)/3 + 2)
-
-/* For printing double/float numbers, must be large enough for
- arbitrary numbers with %g. @@@ Yeek! */
-#define FBUFSIZE 128
-
-static xprintf_function *print_func[UCHAR_MAX+1];
-
-
-void
-xprintf_register (char spec, xprintf_function *func)
-{
- assert ((spec > 0) && !print_func[(unsigned char)spec]);
- print_func[(unsigned char)spec] = func;
-}
-
-int
-xvgprintf (xgprintf_func *out, void *arg, const char *fmt, va_list args)
-{
- int done; /* number of chars printed */
- unsigned long num;
- int is_neg;
- long signed_num;
- int base;
- char c;
- char fbuf[FBUFSIZE]; /* buffer for sprintf @@@ Yeek! */
- char buf[BUFSIZE]; /* buffer for itoa */
- char *str; /* buffer pointer for number conversion */
- const char *s; /* string to be printed by string: */
- int len; /* length of s */
- char pad; /* padding: ' ' or '0' */
- int showsign; /* always show sign ['+'] */
- int space; /* print space if positive */
- int left; /* left justify */
- int alt; /* alternate format 0x... */
- char fc; /* conversion specifier */
- int width; /* width of output field */
- int prec; /* min. # of digits for integers; max
- number of chars for from string */
- int qualifier; /* 'h', 'l', or 'L' for integer fields */
-
- done = 0;
-
-#define P(__b,__l) do { out (arg, __b, __l); done += __l; } while (0)
-
- while (*fmt) {
- const char *next = strchr (fmt, '%');
-
- if (!next) {
- P (fmt, strlen(fmt));
- break;
- } else if (next != fmt) {
- P (fmt, next-fmt);
- fmt = next;
- }
-
- /* Check for "%%". Note that although the ANSI standard lists
- '%' as a conversion specifier, it says "The complete format
- specification shall be `%%'," so we can avoid all the width
- and prec processing. */
- if (fmt[1] == '%') {
- P (fmt, 1);
- fmt += 2;
- continue;
- }
-
- /* process flags */
- is_neg = showsign = space = left = alt = 0; pad = ' ';
-
- repeat:
- ++fmt; /* this also skips first '%' */
- switch (*fmt) {
- case '-': left = 1; goto repeat;
- case '+': showsign = 1; goto repeat;
- case ' ': space = 1; goto repeat;
- case '#': alt = 1; goto repeat;
- case '0': pad = '0'; goto repeat;
- }
-
- /* get field width */
- width = 0;
- if (*fmt == '*') {
- ++fmt, width = va_arg(args, int);
- if (width < 0) {left = 1; width = -width;}
- } else
- while (isdigit(*fmt))
- width = 10*width + *fmt++ - '0';
-
- /* get the prec */
- if (*fmt == '.') {
- ++fmt;
- if (*fmt == '*') {++fmt; prec = va_arg(args, int);}
- else { prec = 0; while (isdigit(*fmt)) prec = 10*prec + *fmt++ - '0'; }
- if (prec < 0) prec = 0;
- } else prec = -1; /* -1 == unspecified */
-
- /* get the conversion qualifier */
- if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L')
- qualifier = *fmt++;
- else
- qualifier = -1;
-
- fc = *fmt++;
-
- if (print_func[(unsigned char)fc]) {
- xprintf_info info;
- int func_done;
-
- info.prec = prec;
- info.width = width;
- info.spec = fc;
- info.is_long_double = qualifier == 'L';
- info.is_short = qualifier == 'h';
- info.is_long = qualifier == 'l';
- info.alt = alt;
- info.space = space;
- info.left = left;
- info.showsign = showsign;
- info.pad = pad;
-
- /* Sharing `args' with another function is not blessed by ANSI
- C. From ISO/IEC DIS 9899, section 4.4:
-
- If access to the varying arguments is desired, the called
- function shall declare an object (referred as `ap' in this
- section) having type va_list. The object `ap' may be passed
- as an argument to another function; if that function invokes
- the va_arg macro with parameter `ap', the value of `ap' in
- the calling function is indeterminate and shall be passed to
- the va_end macro prior to any futher reference to `ap'.
-
- Nevertheless, it works with most compilers, including gcc. */
- func_done = print_func[(unsigned char)fc] (out, arg, &info, &args);
- if (func_done < 0) return -1;
- else done += func_done;
-
- } else {
-
- /* default base */
- base = 10;
-
- switch (fc) {
-
- case 'c': /* Character */
- { c = (char) va_arg (args, int);
- s = &c;
- len = 1;
- goto string;
- }
-
- case 's': /* String */
- { static const char null[] = "(null)";
- s = va_arg(args, char *);
- if (!s) {
- s = null;
- len = (prec == -1 || prec >= (int) sizeof(null) - 1) ? sizeof(null) - 1 : 0;
- } else {
- len = strlen (s);
- }
-
- string:
- if (prec >= 0 && prec < len)
- len = prec;
- width -= len;
-
- if (!left)
- while (width-- > 0)
- P (" ", 1);
- P (s, len);
- while (width-- > 0)
- P (" ", 1);
- break;
- }
- case 'p': /* Pointer */
- { const char nil[] = "(nil)";
- const void *ptr = va_arg (args, void *);
- if (!ptr && (prec==-1 || prec>=(int)sizeof(nil)-1)) {
- s = nil;
- len = sizeof(nil) - 1;
- goto string;
- }
-
- base = 16; alt = 1; fc = 'x';
- num = (unsigned long) ptr;
- goto number2;
- }
-
- case 'o': /* Octal */
- base = 8;
- case 'u': /* Unsigned */
- goto number;
-
- case 'X': /* heXadecimal */
- case 'x': /* heXadecimal */
- base = 16;
- number: /* get and print a unsigned number */
-
- if (qualifier == 'l')
- num = va_arg(args, unsigned long);
- else if (qualifier == 'h')
- /* vormals unsigned short, falsch fuer gcc 2.96
- siehe http://mail.gnu.org/pipermail/discuss-gnustep/1999-October/010624.html */
- num = va_arg(args, unsigned int);
- else
- num = va_arg(args, unsigned int);
- /* ANSI only specifies the `+' and ` ' flags for signed conversions. */
- is_neg = showsign = space = 0;
- goto number2;
-
- case 'd': /* Decimal */
- case 'i': /* Integer */
- if (qualifier == 'l')
- signed_num = va_arg(args, long);
- else if (qualifier == 'h')
- /* vormals short, falsch fuer gcc 2.96 siehe
- http://mail.gnu.org/pipermail/discuss-gnustep/1999-October/010624.html */
- signed_num = va_arg(args, int);
- else
- signed_num = va_arg(args, int);
- num = (is_neg = signed_num < 0) ? - signed_num : signed_num;
-
- number2: /* print number in num */
- {
- static const char conv_TABLE[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- static const char conv_table[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-
- const char *conv = fc=='X' ? conv_TABLE : conv_table;
- str = buf+BUFSIZE; /* str = _itoa(buf+BUFSIZE,num,base,fc=='X') */
- if (!num) *--str = '0';
- else do *--str = conv[num % base]; while (num/=base);
- len = buf + BUFSIZE - str;
- }
-
- /* prepend 0 for octal format. */
- if (alt && base == 8 && prec<=len) {
- *--str = '0';
- ++len;
- }
-
- /* we will print s ==> cut prec and width */
- prec -= len;
- width -= len;
-
- if (prec > 0) width -= prec; /* we will use all precision space! */
-
- if (is_neg || showsign || space) --width;
- if (base == 16 && alt) width -= 2;
-
- if (!left && pad==' ')
- while (width-- > 0) P (" ", 1);
-
- if (is_neg)
- P ("-", 1);
- else if (showsign)
- P ("+", 1);
- else if (space)
- P (" ", 1);
-
- if (base == 16 && alt) {
- P ("0", 1);
- P (&fc, 1);
- }
-
- if (!left && pad=='0')
- while (width-- > 0) P ("0", 1);
-
- while (prec-- > 0) P ("0", 1);
-
- P (str, len);
-
- while (width-- > 0) P (" ", 1);
- break;
-
- /* @@@ NYI (just hacked) */
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
-#ifdef HAVE_ANSI_SPRINTF
- len = sprintf (fbuf, "%1.20e", va_arg (args, double));
-#else
- sprintf (fbuf, "%1.20e", va_arg (args, double));
- len = strlen (fbuf);
-#endif
- s = fbuf;
- goto string;
-
- case 'n': /* assign #printed characters */
- if (qualifier == 'l') *va_arg (args, long *) = done;
- else if (qualifier == 'h') *va_arg (args, short *) = done;
- else { assert (qualifier == -1); *va_arg (args, int *) = done; }
- break;
-
- case 'm': /* errno, GNU extension */
- /* strerror() is ANSI C, sys_nerr & sys_errlist are not */
- s = strerror (errno);
- len = strlen (s);
- goto string;
-
- default:
- assert (0);
- }
- }
- }
- return done;
-}
-
-
-int
-xgprintf (xgprintf_func *out, void *arg, const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start (args, fmt);
- i = xvgprintf (out, arg, fmt, args);
- va_end (args);
- return i;
-}
-
-#endif /* !USE_PRINTF */
+++ /dev/null
-/*
- * Project: libFIRM
- * File name: ir/common/xoprintf.c
- * Purpose: Xoprintf --- extended formatted output to obstacks.
- * Author: Christian von Roques
- * Modified by:
- * Created: 1999 by getting from fiasco
- * CVS-ID: $Id$
- * Copyright: (c) 1995, 1996 Christian von Roques
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#ifndef USE_PRINTF
-
-#include <obstack.h>
-#include <string.h>
-#include <assert.h>
-#include "xprintf.h"
-
-/* bcopy is not ISO C */
-#define bcopy(X, Y, Z) memcpy((Y), (X), (Z))
-
-static int
-xoprinter (void *obst, const char *data, size_t len)
-{
- obstack_grow ((struct obstack *)obst, data, len);
- return len;
-}
-
-
-int
-xoprintf (struct obstack *obst, const char *fmt, ...)
-{
- va_list args;
- int res;
-
- va_start (args, fmt);
- res = xvgprintf (xoprinter, obst, fmt, args);
- va_end (args);
- return res;
-}
-
-int
-xvoprintf (struct obstack *obst, const char *fmt, va_list args)
-{
- return xvgprintf (xoprinter, obst, fmt, args);
-}
-
-#endif /* USE_PRINTF */
+++ /dev/null
-/*
- * Project: libFIRM
- * File name: ir/common/xp_help.h
- * Purpose: Macros to help writing output handlers.
- * Author: Markus Armbruster
- * Modified by:
- * Created: 1999 by getting from fiasco
- * CVS-ID: $Id$
- * Copyright: (c) 1996 Markus Armbruster
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-
-
-#ifndef _XP_HELP_H
-#define _XP_HELP_H
-
-# ifdef HAVE_STRING_H
-# include <string.h>
-# endif
-#ifdef USE_PRINTF
-# define XP_ARG1 stream
-# define XP_ARGN args
-# define XP_GETARG(type, index) (*(type *)args[index])
-# define XPMR(p,n) fwrite ((p), 1, (n), stream)
-# define XPR(p) fputs ((p), stream)
-# define XPF1R(fmt, arg) fprintf (stream, (fmt), (arg))
-# define XPF3R(fmt, a1, a2, a3) fprintf (stream, (fmt), (a1), (a2), (a3))
-# define XPCR(p) (putc (*(p), stream) == EOF ? -1 : 1)
-#else /* !USE_PRINTF */
-# define XP_ARG1 f, a
-# define XP_ARGN ap
-# define XP_GETARG(type, index) va_arg (*ap, type)
-# define XPMR(p,n) f (a, (p), (n))
-# define XPR(p) f (a, (p), strlen((p)))
-# define XPF1R(fmt, arg) xgprintf (f, a, (fmt), (arg))
-# define XPF3R(fmt, a1, a2, a3) xgprintf (f, a, (fmt), (a1), (a2), (a3))
-# define XPCR(p) XPMR (p, 1)
-#endif /* !USE_PRINTF */
-
-#define XP(p) XP_CHK (XPR ((p)))
-#define XPM(p,n) XP_CHK (XPMR ((p), (n)))
-#define XPSR(p) XPMR ((p), sizeof(p)-1)
-#define XPS(p) XPM ((p), sizeof(p)-1)
-#define XPF1(fmt, arg) XP_CHK (XPF1R ((fmt), (arg)))
-#define XPC(c) XP_CHK (XPCR ((c)))
-#define XP_CHK(expr) \
- do { \
- int n = (expr); \
- if (n < 0) return -1; else printed += n; \
- } while (0)
-
-#endif
+++ /dev/null
-/*
- * Project: libFIRM
- * File name: ir/common/xprintf.h
- * Purpose: Declarations for xprintf & friends.
- * Author: Christian von Roques
- * Modified by:
- * Created: 1999 by getting from fiasco
- * CVS-ID: $Id$
- * Copyright: (c) 1995, 1996 Christian von Roques
- * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
- */
-
-
-/* Parts of this file are adapted from the GNU C Library.
-Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#ifndef _XPRINTF_H_
-#define _XPRINTF_H_
-
-#ifdef USE_PRINTF
-
-/* This code is just an incomplete sketch how GNU libc could be used,
- if it provided the necessary functionality. Problems:
- o obstack_printf() is not yet available, it will be in version 2.
- o User defined conversion specifiers cannot take struct arguments.
- Using GNU libc should be *significantly* faster. */
-
-# include <printf.h>
-
-# define XP_PAR1 FILE *stream
-# define XP_PARN const void **args
-
-typedef struct printf_info xprintf_info;
-
-/* @@@ GNU libc version 2's register_printf_function *requires*
- non-NULL 3rd argument */
-# define xprintf_register(spec, func) \
- register_printf_function ((spec), (func), NULL)
-
-# define xprintf printf
-# define xvprintf vprintf
-# define xfprintf fprintf
-# define xvfprintf vfprintf
-# define xoprintf obstack_printf
-# define xvoprintf obstack_vprintf
-
-#else /* !USE_PRINTF */
-
-/* Emulate GNU libc functionality on top of standard libc */
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-
-
-# define XP_PAR1 xgprintf_func *f, void *a
-# define XP_PARN va_list *ap
-
-/* Type of a generic print function */
-typedef int xgprintf_func (void *, const char *, size_t);
-
-typedef struct
-{
- int prec; /* Precision. */
- int width; /* Width. */
- unsigned char spec; /* Format letter. */
- unsigned int is_long_double:1;/* L flag. */
- unsigned int is_short:1; /* h flag. */
- unsigned int is_long:1; /* l flag. */
- unsigned int alt:1; /* # flag. */
- unsigned int space:1; /* Space flag. */
- unsigned int left:1; /* - flag. */
- unsigned int showsign:1; /* + flag. */
- char pad; /* Padding character. */
-} xprintf_info;
-
-/* Type of a printf specifier-handler function.
- `printer' is the generic print function to be called with first
- argument `out'. `info' gives information about the format
- specification. Arguments can be read from `args'. The function
- shall return the number of characters written, or -1 for errors. */
-typedef int xprintf_function (xgprintf_func *printer, void *out,
- const xprintf_info *info,
- va_list *args);
-
-void xprintf_register (char spec, xprintf_function *);
-
-int xgprintf(xgprintf_func *, void *, const char *, ...);
-int xvgprintf(xgprintf_func *, void *, const char *, va_list);
-
-int xprintf (const char *, ...);
-int xvprintf (const char *, va_list);
-int xfprintf (FILE *, const char *, ...);
-int xvfprintf (FILE *, const char *, va_list);
-
-struct obstack;
-int xoprintf (struct obstack *, const char *, ...);
-int xvoprintf (struct obstack *, const char *, va_list);
-
-#endif /* !USE_PRINTF */
-#endif /* _XPRINTF_H_ */
-# Hey Emacs, this is a -*- makefile -*-
#
-# libFIRM Project
-#
-# $Id$
+# Project: libFIRM
+# File name: ir/debug/Makefile.in
+# Purpose:
+# Author: Boris Boesler, Till Riedel
+# Modified by:
+# Created:
+# CVS-ID: $Id$
+# Copyright: (c) 1999-2003 Universität Karlsruhe
+# Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
#
top_srcdir := @top_srcdir@
/*
-* Copyright (C) 2001 by Universitaet Karlsruhe
-* All rights reserved.
-*
-* Authors: Goetz Lindenmaier
-*
-* dbginfo: This is a empty implementation of the Firm interface to
-* debugging support. It only guarantees that the Firm library compiles
-* and runs without any real debugging support.
-* The functions herein are declared weak so that they can be overriden
-* by a real implementation.
-*/
-
-/* $Id$ */
+ * Project: libFIRM
+ * File name: ir/debug/dbginfo.c
+ * Purpose: Implements the Firm interface to debug information.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created: 2001
+ * CVS-ID: $Id$
+ * Copyright: (c) 2001-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
/*
-* Copyright (C) 2001 by Universitaet Karlsruhe
-* All rights reserved.
-*/
+ * Project: libFIRM
+ * File name: ir/debug/dbginfo.h
+ * Purpose: Implements the Firm interface to debug information.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created: 2001
+ * CVS-ID: $Id$
+ * Copyright: (c) 2001-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
/**
* @file dbginfo.h
*
* @author Goetz Lindenmaier
*
-* Firm requires
-* a debugging module fulfilling this interface, else no debugging information
-* is passed to the backend.
-* The interface requires a datatype representing the debugging information.
-* Firm supports administrating a reference to the debug information
-* in every firm node. Further Firm optimizations call routines to
-* propagate debug information from old nodes to new nodes if the optimization
-* replaces the old ones by the new ones.
+* Firm requires a debugging module fulfilling this interface, else no
+* debugging information is passed to the backend.
+* The interface requires a datatype representing the debugging
+* information. Firm supports administrating a reference to the debug
+* information in every firm node. Further Firm optimizations call
+* routines to propagate debug information from old nodes to new nodes
+* if the optimization replaces the old ones by the new ones.
*
*/
-/* $Id$ */
-
# ifndef _DBGINFO_H_
# define _DBGINFO_H_
/*
-* Copyright (C) 2001 by Universitaet Karlsruhe
-* All rights reserved.
-*/
+ * Project: libFIRM
+ * File name: ir/debug/dbginfo.h
+ * Purpose: Implements the Firm interface to debug information -- private header.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created: 2001
+ * CVS-ID: $Id$
+ * Copyright: (c) 2001-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
/**
* @file dbginfo_t.h
* and runs without any real debugging support.
*/
-/* $Id$ */
#ifndef __DBGINFO_T_H__
#define __DBGINFO_T_H__
-# Hey Emacs, this is a -*- makefile -*-
#
-# libFIRM Project
-#
-# $Id$
+# Project: libFIRM
+# File name: ir/ident/Makefile.in
+# Purpose:
+# Author: Boris Boesler, Till Riedel
+# Modified by:
+# Created:
+# CVS-ID: $Id$
+# Copyright: (c) 1999-2003 Universität Karlsruhe
+# Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
#
top_srcdir := @top_srcdir@
-/* Ident --- unique handles for identifiers
- Copyright (C) 1995, 1996 Markus Armbruster
- All rights reserved. */
-
-/* $Id$ */
+/*
+ * Project: libFIRM
+ * File name: ir/common/ident.c
+ * Purpose: Hash table to store names.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID: $Id$
+ * Copyright: (c) 1999-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
#ifdef HAVE_CONFIG_H
# include <config.h>
#include "ident_t.h"
#include "array.h"
-#include "tune.h"
-#include "misc.h"
#include "set.h"
-#define ID_TO_STR(id) ((const char *)&(id)->dptr[0])
-#define ID_TO_STRLEN(id) ((id)->size)
-#define ID_TO_HASH(id) ((long)(id) + (id)->hash)
-
-/* Vormals Debugunterstuetzung, entfernt (debug.h). */
-# define ID_VRFY(id) ((void)0)
-# define IDS_VRFY(id) ((void)0)
-
-#ifdef STATS
-# define id_stats() set_stats (id_set)
-#else
-# define id_stats() ((void)0)
-#endif
-
-
static set *id_set;
-void id_init(void)
+void id_init(int initial_n_idents)
{
- id_set = new_set(memcmp, TUNE_NIDENTS);
+ id_set = new_set(memcmp, initial_n_idents);
}
INLINE ident *id_from_str (const char *str, int len)
return id_from_str(str, strlen(str));
}
-INLINE const char *id_to_str(ident *id)
+INLINE const char *get_id_str(ident *id)
{
return (const char *)id->dptr;
}
-INLINE int id_to_strlen(ident *id)
+INLINE int get_id_strlen(ident *id)
{
return id->size;
}
int id_is_prefix(ident *prefix, ident *id)
{
- if (id_to_strlen(prefix) > id_to_strlen(id)) return 0;
- return 0 == memcmp(prefix->dptr, id->dptr, id_to_strlen(prefix));
+ if (get_id_strlen(prefix) > get_id_strlen(id)) return 0;
+ return 0 == memcmp(prefix->dptr, id->dptr, get_id_strlen(prefix));
}
int id_is_suffix(ident *suffix, ident *id)
{
- int suflen = id_to_strlen(suffix);
- int idlen = id_to_strlen(id);
+ int suflen = get_id_strlen(suffix);
+ int idlen = get_id_strlen(id);
char *part;
if (suflen > idlen) return 0;
int id_contains_char(ident *id, char c)
{
- return strchr(id_to_str(id), c) != NULL;
+ return strchr(get_id_str(id), c) != NULL;
}
int print_id (ident *id)
{
- return printf("%s", id_to_str(id));
+ return printf("%s", get_id_str(id));
}
int fprint_id (FILE *F, ident *id)
{
- return fprintf(F, "%s", id_to_str(id));
+ return fprintf(F, "%s", get_id_str(id));
}
-/* Declarations for ident.
- Copyright (C) 1995, 1996 Markus Armbruster */
-
-/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-* All rights reserved.
-*
-* Authors: Martin Trapp, Christian Schaefer
-*/
-
+/*
+ * Project: libFIRM
+ * File name: ir/common/ident_t.h
+ * Purpose: Data type for unique names.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID: $Id$
+ * Copyright: (c) 1999-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
/**
* @file ident.h
*
* Identifiers are used in the firm library. This is the interface to it.
*/
-/* $Id$ */
# ifndef _IDENT_H_
# define _IDENT_H_
/* Identifiers */
-/**
- * Initialises the ident handling.
- *
- * Must be called before any id_*() function can be called.
- */
-void id_init(void);
-
/**
* The abstract data type ident.
*
*
* @return id - a handle for the generated ident
*
- * @see id_to_str(), id_to_strlen()
+ * @see get_id_str(), get_id_strlen()
*/
ident *new_id_from_str (const char *str);
*
* @return id - a handle for the generated ident
*
- * @see new_id_to_str(), id_to_strlen()
+ * @see new_get_id_str(), get_id_strlen()
*/
-INLINE ident *id_from_str (const char *str, int len);
+INLINE ident *id_from_str (const char *str, int len);
/**
* Returns a string represented by an ident.
*
* @return cp - a string
*
- * @see new_id_to_str(), id_from_str(), id_to_strlen()
+ * @see new_get_id_str(), id_from_str(), get_id_strlen()
*/
-INLINE const char *id_to_str (ident *id);
+INLINE const char *get_id_str (ident *id);
+//INLINE const char *get_id_str (ident *id); /* No more supported */
+#define id_to_str get_id_str
/**
* Returns the length of the string represented by an ident.
*
* @return len - the length of the string
*
- * @see new_id_to_str(), id_from_str(), id_to_str()
+ * @see new_get_id_str(), id_from_str(), get_id_str()
*/
-INLINE int id_to_strlen(ident *id);
-
+INLINE int get_id_strlen(ident *id);
+#define id_to_strlen get_id_strlen
/**
* Returns true if prefix is a prefix of an ident.
*
* @param prefix - the prefix
* @param id - the ident
*
- * @see new_id_to_str(), id_from_str(), id_to_str(), id_is_prefix()
+ * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix()
*/
int id_is_prefix (ident *prefix, ident *id);
* @param suffix - the suffix
* @param id - the ident
*
- * @see new_id_to_str(), id_from_str(), id_to_str(), id_is_prefix()
+ * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix()
*/
int id_is_suffix (ident *suffix, ident *id);
* @param id - the ident
* @param c - the character
*
- * @see new_id_to_str(), id_from_str(), id_to_str()
+ * @see new_get_id_str(), id_from_str(), get_id_str()
*/
int id_contains_char (ident *id, char c);
* @return
* number of btes written
*
- * @see new_id_to_str(), id_from_str(), id_to_str(), id_is_prefix(), fprint_id()
+ * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix(), fprint_id()
*/
int print_id (ident *id);
* @return
* number of btes written
*
- * @see new_id_to_str(), id_from_str(), id_to_str(), id_is_prefix(), print_id()
+ * @see new_get_id_str(), id_from_str(), get_id_str(), id_is_prefix(), print_id()
*/
int fprint_id (FILE *F, ident *id);
-/* Declarations for ident.
- Copyright (C) 1995, 1996 Markus Armbruster */
-
-/* Copyright (C) 1998 - 2000 by Universitaet Karlsruhe
-* All rights reserved.
-*
-* Authors: Martin Trapp, Christian Schaefer
-*/
-
-/* $Id$ */
+/*
+ * Project: libFIRM
+ * File name: ir/common/ident_t.h
+ * Purpose: Hash table to store names -- private header.
+ * Author: Goetz Lindenmaier
+ * Modified by:
+ * Created:
+ * CVS-ID: $Id$
+ * Copyright: (c) 1999-2003 Universität Karlsruhe
+ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
+ */
# ifndef _IDENT_T_H_
# define _IDENT_T_H_
# include "ident.h"
+void id_init (int initial_n_idents);
-void id_init (void);
-
-/* @@@ tune */
#define ID_HASH(str, len) \
((( ((unsigned char *)(str))[0] * 33 \
+ ((unsigned char *)(str))[(len)>>1]) * 31 \
block->attr.block.graph_arr[pos] = res;
} else {
/* printf(" value already computed by %s\n",
- id_to_str(block->attr.block.graph_arr[pos]->op->name)); */
+ get_id_str(block->attr.block.graph_arr[pos]->op->name)); */
}
return res;
} else if (get_irn_opcode(n) == iro_SymConst) {
if (get_SymConst_kind(n) == linkage_ptr_info) {
/* don't use get_SymConst_ptr_info as it mangles the name. */
- fprintf (F, "SymC %s", id_to_str(get_SymConst_ptrinfo(n)));
+ fprintf (F, "SymC %s", get_id_str(get_SymConst_ptrinfo(n)));
} else {
assert(get_kind(get_SymConst_type(n)) == k_type);
assert(get_type_ident(get_SymConst_type(n)));
- fprintf (F, "SymC %s ", id_to_str(get_type_ident(get_SymConst_type(n))));
+ fprintf (F, "SymC %s ", get_id_str(get_type_ident(get_SymConst_type(n))));
if (get_SymConst_kind(n) == type_tag)
fprintf (F, "tag");
else
/* all others */
} else {
- fprintf (F, "%s", id_to_str(get_irn_opident(n)));
+ fprintf (F, "%s", get_id_str(get_irn_opident(n)));
}
}
case iro_Shr:
case iro_Abs:
case iro_Cmp:
- fprintf (F, "%s", id_to_str(get_mode_ident(get_irn_mode(n))));
+ fprintf (F, "%s", get_id_str(get_mode_ident(get_irn_mode(n))));
break;
default:
;
switch (get_irn_opcode(n)) {
case iro_Start:
if (false && interprocedural_view) {
- fprintf (F, "%s", id_to_str(get_entity_ident(get_irg_ent(current_ir_graph))));
+ fprintf (F, "%s", get_id_str(get_entity_ident(get_irg_ent(current_ir_graph))));
}
break;
case iro_Proj:
fprintf(F, "state: layout_fixed,\n");
}
if (get_type_mode(tp))
- fprintf(F, "mode: %s,\n", id_to_str(get_mode_ident(get_type_mode(tp))));
+ fprintf(F, "mode: %s,\n", get_id_str(get_mode_ident(get_type_mode(tp))));
fprintf(F, "size: %dB,\n", get_type_size(tp));
}
static void print_type_node(type *tp) {
fprintf (F, "node: {title: ");
PRINT_TYPEID(tp);
- fprintf (F, " label: \"%s %s\"", id_to_str(get_type_tpop_nameid(tp)), id_to_str(get_type_ident(tp)));
+ fprintf (F, " label: \"%s %s\"", get_id_str(get_type_tpop_nameid(tp)), get_id_str(get_type_ident(tp)));
fprintf (F, " info1: \"");
print_type_info(tp);
fprintf (F, "\"");
PRINT_ENTID(ent); fprintf(F, "\"");
fprintf (F, DEFAULT_TYPE_ATTRIBUTE);
fprintf (F, "label: ");
- fprintf (F, "\"ent %s\" " ENTITY_NODE_ATTR , id_to_str(get_entity_ident(ent)));
+ fprintf (F, "\"ent %s\" " ENTITY_NODE_ATTR , get_id_str(get_entity_ident(ent)));
fprintf (F, "\n info1: \"\nid: "); PRINT_ENTID(ent);
fprintf (F, "\nallocation: ");
switch (get_entity_allocation(ent)) {
case existent: fprintf (F, "existent"); break;
}
fprintf(F, "\nname: %s\nld_name: %s",
- id_to_str(get_entity_ident(ent)),
- id_to_str(get_entity_ld_ident(ent)));
+ get_id_str(get_entity_ident(ent)),
+ get_id_str(get_entity_ld_ident(ent)));
fprintf(F, "\noffset: %d", get_entity_offset(ent));
if (is_method_type(get_entity_type(ent))) {
if (get_entity_irg(ent)) /* can be null */
ent = get_irg_ent(irg);
id = ent->ld_name ? ent->ld_name : ent->name;
/* Don't use get_entity_ld_ident (ent) as it computes the mangled name! */
- len = id_to_strlen (id);
- cp = id_to_str (id);
+ len = get_id_strlen (id);
+ cp = get_id_str (id);
if (dump_file_suffix)
fname = malloc (len + 5 + strlen(suffix) + strlen(dump_file_suffix));
else
int i;
fprintf(F, "graph: { title: %p label: %s status:clustered color:white \n",
- (void*) irg, id_to_str(get_entity_ident(get_irg_ent(irg))));
+ (void*) irg, get_id_str(get_entity_ident(get_irg_ent(irg))));
for (i = ARR_LEN(arr) - 1; i >= 0; --i) {
ir_node * node = arr[i];
ident * irg_ident = get_entity_ident(get_irg_ent(entry->key));
fprintf(F, "graph: { title: %s label: %s status:clustered color:white \n",
- id_to_str(irg_ident), id_to_str(irg_ident));
+ get_id_str(irg_ident), get_id_str(irg_ident));
for (i = ARR_LEN(arr) - 1; i >= 0; --i) {
ir_node * node = arr[i];
get_mode_name(const ir_mode *mode)
{
ANNOUNCE();
- return id_to_str(mode->name);
+ return get_id_str(mode->name);
}
mode_sort
#endif
#include <string.h>
+#include "ident.h"
#include "irnode_t.h"
#include "irgraph_t.h"
#include "irmode_t.h"
get_irn_opname (const ir_node *node)
{
assert(node);
- return id_to_str(node->op->name);
+ return get_id_str(node->op->name);
}
INLINE ident *
/** Output information about a graph */
#define DDMG(X) printf("%s(l.%i) %s: %ld (%p)\n", __MYFUNC__, __LINE__, get_entity_name(get_irg_ent(X)), get_irg_graph_nr(X), (X))
/** Output information about an ident */
-#define DDMI(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, id_to_str(X), (X))
+#define DDMI(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, get_id_str(X), (X))
/** Output information about a mode */
#define DDMM(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, get_mode_name(X), (X))
/** Output information about a loop */
/* Returns the string for the opcode. */
const char *get_op_name (ir_op *op) {
- return id_to_str(op->name);
+ return get_id_str(op->name);
}
opcode get_op_code (ir_op *op){
INLINE const char *
get_entity_name (entity *ent) {
assert (ent);
- return id_to_str(get_entity_ident(ent));
+ return get_id_str(get_entity_ident(ent));
}
ident *
INLINE const char *
get_entity_ld_name (entity *ent) {
- return id_to_str(get_entity_ld_ident(ent));
+ return get_id_str(get_entity_ld_ident(ent));
}
/*
ident *res;
type_id = mangle_type ((type *) ent->owner);
- obstack_grow(&mangle_obst, id_to_str(type_id), id_to_strlen(type_id));
+ obstack_grow(&mangle_obst, get_id_str(type_id), get_id_strlen(type_id));
obstack_1grow(&mangle_obst,'_');
- obstack_grow(&mangle_obst,id_to_str(ent->name),id_to_strlen(ent->name));
+ obstack_grow(&mangle_obst,get_id_str(ent->name),get_id_strlen(ent->name));
len = obstack_object_size (&mangle_obst);
cp = obstack_finish (&mangle_obst);
res = id_from_str(cp, len);
int len;
ident *res;
- obstack_grow(&mangle_obst, id_to_str(first), id_to_strlen(first));
- obstack_grow(&mangle_obst, id_to_str(scnd), id_to_strlen(scnd));
+ obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first));
+ obstack_grow(&mangle_obst, get_id_str(scnd), get_id_strlen(scnd));
len = obstack_object_size (&mangle_obst);
cp = obstack_finish (&mangle_obst);
res = id_from_str (cp, len);
int len;
ident *res;
- obstack_grow(&mangle_obst, id_to_str(first), id_to_strlen(first));
+ obstack_grow(&mangle_obst, get_id_str(first), get_id_strlen(first));
obstack_1grow(&mangle_obst,'_');
- obstack_grow(&mangle_obst,id_to_str(scnd),id_to_strlen(scnd));
+ obstack_grow(&mangle_obst,get_id_str(scnd),get_id_strlen(scnd));
len = obstack_object_size (&mangle_obst);
cp = obstack_finish (&mangle_obst);
res = id_from_str (cp, len);
/* Returns the string for the tp_opcode. */
const char *get_tpop_name (tp_op *op) {
- return id_to_str(op->name);
+ return get_id_str(op->name);
}
tp_opcode get_tpop_code (tp_op *op){
const char* get_type_tpop_name(type *tp) {
assert(tp && tp->kind == k_type);
- return id_to_str(tp->type_op->name);
+ return get_id_str(tp->type_op->name);
}
tp_opcode get_type_tpop_code(type *tp) {
const char* get_type_name(type *tp) {
assert(tp && tp->kind == k_type);
- return (id_to_str(tp->name));
+ return (get_id_str(tp->name));
}
int get_type_size(type *tp) {
const char *get_union_delim_name (type *uni, int pos) {
assert(uni && (uni->type_op == type_union));
assert(pos >= 0 && pos < get_union_n_types(uni));
- return id_to_str(uni->attr.ua.delim_names[pos]);
+ return get_id_str(uni->attr.ua.delim_names[pos]);
}
void set_union_delim_nameid (type *uni, int pos, ident *id) {
assert(uni && (uni->type_op == type_union));
const char *get_enumeration_name(type *enumeration, int pos) {
assert(enumeration && (enumeration->type_op == type_enumeration));
assert(pos >= 0 && pos < get_enumeration_n_enums(enumeration));
- return id_to_str(enumeration->attr.ea.enum_nameid[pos]);
+ return get_id_str(enumeration->attr.ea.enum_nameid[pos]);
}
/* typecheck */