From e1308e58f7c4e93f3fdc9dabb63a1fe084c1f7b6 Mon Sep 17 00:00:00 2001 From: Sebastian Hack Date: Mon, 13 Dec 2004 14:18:01 +0000 Subject: [PATCH] Some bugfixes [r4648] --- ir/adt/bitset_ia32.h | 23 +++-------------------- ir/adt/bitset_std.h | 13 ++++++++----- ir/adt/impl.h | 26 ++++++++++++++++++++++---- ir/adt/iterator.h | 3 +++ ir/adt/list.h | 1 - 5 files changed, 36 insertions(+), 30 deletions(-) diff --git a/ir/adt/bitset_ia32.h b/ir/adt/bitset_ia32.h index 91644db34..934a3a567 100644 --- a/ir/adt/bitset_ia32.h +++ b/ir/adt/bitset_ia32.h @@ -1,4 +1,6 @@ +#ifndef _BITSET_IA32_H +#define _BITSET_IA32_H #undef _bitset_inside_clear #undef _bitset_inside_set @@ -99,18 +101,6 @@ static INLINE unsigned long *_bitset_sse_data_ptr(void *data, size_t bitset_base #define _bitset_inside_binop_or(tgt,src) _bitset_sse_inside_binop_or(tgt,src) #define _bitset_inside_binop_xor(tgt,src) _bitset_sse_inside_binop_xor(tgt,src) -/* and with zero sets everything to zero. */ -#define _bitset_inside_binop_with_zero_and(tgt) _bitset_sse_inside_binop_with_zero_and(tgt) - -/* And Not with 0 is the identity (its like and with 1) */ -#define _bitset_inside_binop_with_zero_andnot(tgt) - -/* Or with zero is also the identity */ -#define _bitset_inside_binop_with_zero_or(tgt) - -/* Xor with 0 is like negation, we have to do it. */ -#define _bitset_inside_binop_with_zero_xor(tgt) _bitset_sse_inside_binop_with_zero_xor(tgt) - #define _BITSET_SSE_BINOP(name) \ static INLINE void _bitset_sse_inside_binop_ ## name(unsigned long *tgt, unsigned long *src) \ { \ @@ -129,14 +119,6 @@ static INLINE void _bitset_sse_inside_binop_with_zero_and(unsigned long *tgt) tgt[3] = 0; } -static INLINE void _bitset_sse_inside_binop_with_zero_xor(unsigned long *tgt) -{ - __m128i src_op = _mm_setzero_si128(); - __m128i tgt_op = _mm_load_si128((void *) tgt); - __m128i res = _mm_xor_si128(tgt_op, src_op); - _mm_store_si128((__m128i *) tgt, res); -} - static INLINE void _bitset_sse_inside_binop_andnot(unsigned long *tgt, unsigned long *src) { __m128i src_op = _mm_load_si128((void *) src); @@ -151,3 +133,4 @@ _BITSET_SSE_BINOP(xor) #endif +#endif diff --git a/ir/adt/bitset_std.h b/ir/adt/bitset_std.h index b7860ec63..2253c27d2 100644 --- a/ir/adt/bitset_std.h +++ b/ir/adt/bitset_std.h @@ -29,6 +29,14 @@ ((unsigned long *) ((char *) data + bitset_base_size)) +/** + * Clear some units from a certain address on. + * @param addr The address from where to clear. + * @param n The number of units to set to 0. + */ +#define _bitset_inside_clear_units(addr,n) \ + memset(addr, 0, n * BS_UNIT_SIZE) + /** * Set a bit in a unit. * @param unit A pointer to the unit. @@ -100,8 +108,3 @@ static INLINE int _bitset_std_inside_ntz(unsigned long *unit_ptr) #define _bitset_inside_binop_andnot(tgt,src) ((*tgt) &= ~(*src)) #define _bitset_inside_binop_or(tgt,src) ((*tgt) |= (*src)) #define _bitset_inside_binop_xor(tgt,src) ((*tgt) ^= (*src)) - -#define _bitset_inside_binop_with_zero_and(tgt) ((*tgt) &= 0UL) -#define _bitset_inside_binop_with_zero_andnot(tgt) ((*tgt) &= ~0UL) -#define _bitset_inside_binop_with_zero_or(tgt) ((*tgt) |= 0UL) -#define _bitset_inside_binop_with_zero_xor(tgt) ((*tgt) ^= 0UL) diff --git a/ir/adt/impl.h b/ir/adt/impl.h index 12d7eb043..1f66273ab 100644 --- a/ir/adt/impl.h +++ b/ir/adt/impl.h @@ -7,23 +7,36 @@ #ifndef _IMPL_H #define _IMPL_H +#define _HEAD1(name,res,t1) \ + res (name)(t1 p1) + +#define _HEAD2(name,res,t1,t2) \ + res (name)(t1 p1, t2 p2) + +#define _HEAD3(name,res,t1,t2,t3) \ + res (name)(t1 p1, t2 p2, t3 p3) + +#define _HEAD4(name,res,t1,t2,t3,t4) \ + res (name)(t1 p1, t2 p2, t3 p3, t4 p4) + + #define _IMPL1(name,prefix,ret,res,t1) \ -res (name)(t1 p1) { \ +_HEAD1(name, res, t1) { \ ret prefix ## name (p1); \ } #define _IMPL2(name,prefix,ret,res,t1,t2) \ -res (name)(t1 p1, t2 p2) { \ +_HEAD2(name, res, t1, t2) { \ ret prefix ## name (p1, p2); \ } #define _IMPL3(name,prefix,ret,res,t1,t2,t3) \ -res (name)(t1 p1, t2 p2, t3 p3) { \ +_HEAD3(name, res, t1, t2, t3) { \ ret prefix ## name (p1, p2, p3); \ } #define _IMPL4(name,prefix,ret,res,t1,t2,t3,t4) \ -res (name)(t1 p1, t2 p2, t3 p3, t4 p4) { \ +_HEAD4(name, res, t1, t2, t3, t4) { \ ret prefix ## name (p1, p2, p3, p4); \ } @@ -78,4 +91,9 @@ res (name)(t1 p1, t2 p2, t3 p3, t4 p4) { \ #define FIRM_IMPL4_VOID(name,t1,t2,t3,t4) \ _IMPL4(name, __, (void), void, t1, t2, t3, t4) +#define FIRM_PROTO1(name,type,t1) _HEAD1(name, type, t1) +#define FIRM_PROTO2(name,type,t1,t2) _HEAD2(name, type, t1, t2) +#define FIRM_PROTO3(name,type,t1,t2,t3) _HEAD3(name, type, t1, t2, t3) +#define FIRM_PROTO4(name,type,t1,t2,t3,t4) _HEAD4(name, type, t1, t2, t3, t4) + #endif diff --git a/ir/adt/iterator.h b/ir/adt/iterator.h index d2f1acf45..bf74c1106 100644 --- a/ir/adt/iterator.h +++ b/ir/adt/iterator.h @@ -9,6 +9,9 @@ #include "fourcc.h" +/** + * The iterator magic word. + */ #define ITERATOR_MAGIC FOURCC('I', 'T', 'E', 'R') /** diff --git a/ir/adt/list.h b/ir/adt/list.h index d420cd6e2..9664906c5 100644 --- a/ir/adt/list.h +++ b/ir/adt/list.h @@ -8,7 +8,6 @@ #include "firm_config.h" - /* * Simple doubly linked list implementation. * -- 2.20.1