From 3da5ed2598245b896255bc444aaa1768f6098cfe Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 19 May 2010 11:44:44 +0000 Subject: [PATCH] we can do without the odd align.h [r27545] --- include/libfirm/adt/align.h | 66 ------------------------------------- include/libfirm/adt/array.h | 7 +++- ir/adt/pdeq.c | 3 ++ ir/libcore/lc_defines.h | 11 ------- 4 files changed, 9 insertions(+), 78 deletions(-) delete mode 100644 include/libfirm/adt/align.h diff --git a/include/libfirm/adt/align.h b/include/libfirm/adt/align.h deleted file mode 100644 index feda6c332..000000000 --- a/include/libfirm/adt/align.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. - * - * This file is part of libFirm. - * - * This file may be distributed and/or modified under the terms of the - * GNU General Public License version 2 as published by the Free Software - * Foundation and appearing in the file LICENSE.GPL included in the - * packaging of this file. - * - * Licensees holding valid libFirm Professional Edition licenses may use - * this file in accordance with the libFirm Commercial License. - * Agreement provided with the Software. - * - * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE - * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -/** - * @file - * @brief macros for alignment. - * @author Markus Armbruster - * @version $Id$ - */ -#ifndef FIRM_ADT_ALIGN_H -#define FIRM_ADT_ALIGN_H - -#include - -/** A size handled efficiently by malloc(), at least 1K. */ -#define PREF_MALLOC_SIZE 2048 - - -/** A wrapper around GNU C's __attribute__ */ - -/* According to the documentation, the attributes we are interested in - work with 2.5, but we encountered trouble before 2.7. */ -#if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 7 -# define HAVE_ATTRIBUTE 1 -# define ATTRIBUTE(attrs) __attribute__ (attrs) -#else -# define ATTRIBUTE(attrs) -#endif - - -/* Alignment */ - -/** A type that has most constrained alignment. */ -typedef union { - long double d; - void *p; - long l; -} aligned_type ATTRIBUTE ((aligned)); - -/** Inquiring about the alignment of a type. */ -#ifdef __GNUC__ -# define ALIGNOF(type) __alignof__ (type) -#else -# define ALIGNOF(type) offsetof (struct { char c; type d; }, d) -#endif - -/** Maximal alignment required for any type. */ -#define MAX_ALIGN ALIGNOF (aligned_type) - -#endif diff --git a/include/libfirm/adt/array.h b/include/libfirm/adt/array.h index d84c8f195..52a598bfc 100644 --- a/include/libfirm/adt/array.h +++ b/include/libfirm/adt/array.h @@ -31,7 +31,6 @@ #include "obst.h" #include "fourcc.h" -#include "align.h" #include "xmalloc.h" /** @@ -220,6 +219,12 @@ assert((0 <= (idx)) && ((idx) < ARR_LEN((arr)))) #endif +/** A type that has most constrained alignment. */ +typedef union { + long double d; + void *p; + long l; +} aligned_type; /** * Construct an array header. diff --git a/ir/adt/pdeq.c b/ir/adt/pdeq.c index 642fd3558..8d596d0f3 100644 --- a/ir/adt/pdeq.c +++ b/ir/adt/pdeq.c @@ -43,6 +43,9 @@ /** Size of pdeq block cache. */ #define TUNE_NSAVED_PDEQS 16 +/** A size handled efficiently by malloc(), at least 1K. */ +#define PREF_MALLOC_SIZE 2048 + /** * Maximal number of data items in a pdeq chunk. */ diff --git a/ir/libcore/lc_defines.h b/ir/libcore/lc_defines.h index 622100496..54e637b72 100644 --- a/ir/libcore/lc_defines.h +++ b/ir/libcore/lc_defines.h @@ -36,15 +36,4 @@ #define LC_FOURCC(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24)) #define LC_FOURCC_STR(str) LC_FOURCC(str[0], str[1], str[2], str[3]) -#define LC_OFFSETOF(type,memb) ((char *) &((type *) 0)->memb - (char *) 0) - -#ifdef __GNUC__ -#define LC_ALIGNOF(type) __alignof__(type) -#else -#define LC_ALIGNOF(type) LC_OFFSETOF(struct { char c; type d; }, d) -#endif - -#define LC_PTR2INT(x) (((char *)(x)) - (char *)0) -#define LC_INT2PTR(x) (((char *)(x)) + (char *)0) - #endif -- 2.20.1