[llvm-commits] [compiler-rt] r78234 - in /compiler-rt/trunk: BlocksRuntime/Block_private.h lib/int_lib.h lib/powidf2.c test/Unit/int_lib.h
Edward O'Callaghan
eocallaghan at auroraux.org
Wed Aug 5 12:57:45 PDT 2009
Author: evocallaghan
Date: Wed Aug 5 14:57:20 2009
New Revision: 78234
URL: http://llvm.org/viewvc/llvm-project?rev=78234&view=rev
Log:
Refactor test suit endianness pre-processor code. More style and readability fixes, start labling endif's
Modified:
compiler-rt/trunk/BlocksRuntime/Block_private.h
compiler-rt/trunk/lib/int_lib.h
compiler-rt/trunk/lib/powidf2.c
compiler-rt/trunk/test/Unit/int_lib.h
Modified: compiler-rt/trunk/BlocksRuntime/Block_private.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/BlocksRuntime/Block_private.h?rev=78234&r1=78233&r2=78234&view=diff
==============================================================================
--- compiler-rt/trunk/BlocksRuntime/Block_private.h (original)
+++ compiler-rt/trunk/BlocksRuntime/Block_private.h Wed Aug 5 14:57:20 2009
@@ -48,13 +48,13 @@
BLOCK_REFCOUNT_MASK = (0xffff),
BLOCK_NEEDS_FREE = (1 << 24),
BLOCK_HAS_COPY_DISPOSE = (1 << 25),
- BLOCK_HAS_CTOR = (1 << 26), // helpers have C++ code
+ BLOCK_HAS_CTOR = (1 << 26), /* helpers have C++ code */
BLOCK_IS_GC = (1 << 27),
BLOCK_IS_GLOBAL = (1 << 28),
BLOCK_HAS_DESCRIPTOR = (1 << 29),
};
-// revised new layout
+/* revised new layout */
struct Block_descriptor {
unsigned long int reserved;
unsigned long int size;
@@ -68,7 +68,7 @@
int reserved;
void (*invoke)(void *, ...);
struct Block_descriptor *descriptor;
- // imported variables
+ /* imported variables */
};
@@ -76,11 +76,11 @@
struct Block_byref {
void *isa;
struct Block_byref *forwarding;
- int flags;//refcount;
+ int flags; /* refcount; */
int size;
void (*byref_keep)(struct Block_byref *dst, struct Block_byref *src);
void (*byref_destroy)(struct Block_byref *);
- // long shared[0];
+ /* long shared[0]; */
};
struct Block_byref_header {
@@ -91,36 +91,36 @@
};
-// Runtime support functions used by compiler when generating copy/dispose helpers
+/* Runtime support functions used by compiler when generating copy/dispose helpers */
enum {
- // see function implementation for a more complete description of these fields and combinations
- BLOCK_FIELD_IS_OBJECT = 3, // id, NSObject, __attribute__((NSObject)), block, ...
- BLOCK_FIELD_IS_BLOCK = 7, // a block variable
- BLOCK_FIELD_IS_BYREF = 8, // the on stack structure holding the __block variable
- BLOCK_FIELD_IS_WEAK = 16, // declared __weak, only used in byref copy helpers
- BLOCK_BYREF_CALLER = 128, // called from __block (byref) copy/dispose support routines.
+ /* see function implementation for a more complete description of these fields and combinations */
+ BLOCK_FIELD_IS_OBJECT = 3, /* id, NSObject, __attribute__((NSObject)), block, ... */
+ BLOCK_FIELD_IS_BLOCK = 7, /* a block variable */
+ BLOCK_FIELD_IS_BYREF = 8, /* the on stack structure holding the __block variable */
+ BLOCK_FIELD_IS_WEAK = 16, /* declared __weak, only used in byref copy helpers */
+ BLOCK_BYREF_CALLER = 128, /* called from __block (byref) copy/dispose support routines. */
};
-// Runtime entry point called by compiler when assigning objects inside copy helper routines
+/* Runtime entry point called by compiler when assigning objects inside copy helper routines */
BLOCK_EXPORT void _Block_object_assign(void *destAddr, const void *object, const int flags);
- // BLOCK_FIELD_IS_BYREF is only used from within block copy helpers
+ /* BLOCK_FIELD_IS_BYREF is only used from within block copy helpers */
-// runtime entry point called by the compiler when disposing of objects inside dispose helper routine
+/* runtime entry point called by the compiler when disposing of objects inside dispose helper routine */
BLOCK_EXPORT void _Block_object_dispose(const void *object, const int flags);
-// Other support functions
+/* Other support functions */
-// runtime entry to get total size of a closure
+/* runtime entry to get total size of a closure */
BLOCK_EXPORT unsigned long int Block_size(void *block_basic);
-// the raw data space for runtime classes for blocks
-// class+meta used for stack, malloc, and collectable based blocks
+/* the raw data space for runtime classes for blocks */
+/* class+meta used for stack, malloc, and collectable based blocks */
BLOCK_EXPORT void * _NSConcreteStackBlock[32];
BLOCK_EXPORT void * _NSConcreteMallocBlock[32];
BLOCK_EXPORT void * _NSConcreteAutoBlock[32];
@@ -129,14 +129,14 @@
BLOCK_EXPORT void * _NSConcreteWeakBlockVariable[32];
-// the intercept routines that must be used under GC
+/* the intercept routines that must be used under GC */
BLOCK_EXPORT void _Block_use_GC( void *(*alloc)(const unsigned long, const bool isOne, const bool isObject),
void (*setHasRefcount)(const void *, const bool),
void (*gc_assign_strong)(void *, void **),
void (*gc_assign_weak)(const void *, void *),
void (*gc_memmove)(void *, void *, unsigned long));
-// earlier version, now simply transitional
+/* earlier version, now simply transitional */
BLOCK_EXPORT void _Block_use_GC5( void *(*alloc)(const unsigned long, const bool isOne, const bool isObject),
void (*setHasRefcount)(const void *, const bool),
void (*gc_assign_strong)(void *, void **),
@@ -145,24 +145,24 @@
BLOCK_EXPORT void _Block_use_RR( void (*retain)(const void *),
void (*release)(const void *));
-// make a collectable GC heap based Block. Not useful under non-GC.
+/* make a collectable GC heap based Block. Not useful under non-GC. */
BLOCK_EXPORT void *_Block_copy_collectable(const void *aBlock);
-// thread-unsafe diagnostic
+/* thread-unsafe diagnostic */
BLOCK_EXPORT const char *_Block_dump(const void *block);
-// Obsolete
+/* Obsolete */
-// first layout
+/* first layout */
struct Block_basic {
void *isa;
- int Block_flags; // int32_t
- int Block_size; // XXX should be packed into Block_flags
+ int Block_flags; /* int32_t */
+ int Block_size; /* XXX should be packed into Block_flags */
void (*Block_invoke)(void *);
- void (*Block_copy)(void *dst, void *src); // iff BLOCK_HAS_COPY_DISPOSE
- void (*Block_dispose)(void *); // iff BLOCK_HAS_COPY_DISPOSE
- //long params[0]; // where const imports, __block storage references, etc. get laid down
+ void (*Block_copy)(void *dst, void *src); /* iff BLOCK_HAS_COPY_DISPOSE */
+ void (*Block_dispose)(void *); /* iff BLOCK_HAS_COPY_DISPOSE */
+ /* long params[0]; // where const imports, __block storage references, etc. get laid down */
};
Modified: compiler-rt/trunk/lib/int_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/int_lib.h?rev=78234&r1=78233&r2=78234&view=diff
==============================================================================
--- compiler-rt/trunk/lib/int_lib.h (original)
+++ compiler-rt/trunk/lib/int_lib.h Wed Aug 5 14:57:20 2009
@@ -25,7 +25,7 @@
#if !defined(INFINITY) && defined(HUGE_VAL)
#define INFINITY HUGE_VAL
-#endif
+#endif /* INFINITY */
typedef int si_int;
typedef unsigned su_int;
@@ -44,7 +44,7 @@
#else
si_int high;
su_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} dwords;
@@ -59,7 +59,7 @@
#else
su_int high;
su_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} udwords;
@@ -79,7 +79,7 @@
#else
di_int high;
du_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} twords;
@@ -94,11 +94,11 @@
#else
du_int high;
du_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} utwords;
-#endif
+#endif /* __x86_64 */
typedef union
{
@@ -120,7 +120,7 @@
#else
udwords high;
udwords low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
} uqwords;
typedef union
@@ -129,4 +129,4 @@
long double f;
} long_double_bits;
-#endif
+#endif /* INT_LIB_H */
Modified: compiler-rt/trunk/lib/powidf2.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/powidf2.c?rev=78234&r1=78233&r2=78234&view=diff
==============================================================================
--- compiler-rt/trunk/lib/powidf2.c (original)
+++ compiler-rt/trunk/lib/powidf2.c Wed Aug 5 14:57:20 2009
@@ -1,19 +1,20 @@
-//===-- powidf2.cpp - Implement __powidf2 ---------------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements __powidf2 for the compiler_rt library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- powidf2.cpp - Implement __powidf2 ---------------------------------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file implements __powidf2 for the compiler_rt library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#include "int_lib.h"
-// Returns: a ^ b
+/* Returns: a ^ b */
double
__powidf2(double a, si_int b)
Modified: compiler-rt/trunk/test/Unit/int_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/Unit/int_lib.h?rev=78234&r1=78233&r2=78234&view=diff
==============================================================================
--- compiler-rt/trunk/test/Unit/int_lib.h (original)
+++ compiler-rt/trunk/test/Unit/int_lib.h Wed Aug 5 14:57:20 2009
@@ -1,70 +1,31 @@
-//===-- int_lib.h - configuration header for libgcc replacement -----------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is a configuration header for libgcc replacement.
-// This file is not part of the interface of this library.
-//
-//===----------------------------------------------------------------------===//
+/* ===-- int_lib.h - configuration header for libgcc replacement -----------===
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ * ===----------------------------------------------------------------------===
+ *
+ * This file is a configuration header for libgcc replacement.
+ * This file is not part of the interface of this library.
+ *
+ * ===----------------------------------------------------------------------===
+ */
#ifndef INT_LIB_H
#define INT_LIB_H
-// Assumption: signed integral is 2's complement
-// Assumption: right shift of signed negative is arithmetic shift
+/* Assumption: signed integral is 2's complement */
+/* Assumption: right shift of signed negative is arithmetic shift */
#include <limits.h>
+#include "endianness.h"
+#include <math.h>
-// TODO: Improve this to minimal pre-processor hackish'ness.
-#if defined (__SVR4) && defined (__sun)
-// config.h build via CMake.
-//#include <config.h>
-
-// Solaris header for endian and byte swap
-//#if defined HAVE_SYS_BYTEORDER_H
-#include <sys/byteorder.h>
-
-// Solaris defines endian by setting _LITTLE_ENDIAN or _BIG_ENDIAN
-#ifdef _BIG_ENDIAN
-# define IS_BIG_ENDIAN
-#endif
-#ifdef _LITTLE_ENDIAN
-# define IS_LITTLE_ENDIAN
-#endif
-
-#ifdef IS_BIG_ENDIAN
-#define __BIG_ENDIAN__ 1
-#define __LITTLE_ENDIAN__ 0
-#endif
-#ifdef IS_LITTLE_ENDIAN
-#define __BIG_ENDIAN__ 0
-#define __LITTLE_ENDIAN__ 1
-#endif
-
-#endif //End of Solaris ifdef.
-
-#ifdef __LITTLE_ENDIAN__
-#if __LITTLE_ENDIAN__
-#define _YUGA_LITTLE_ENDIAN 1
-#define _YUGA_BIG_ENDIAN 0
-#endif
-#endif
-
-#ifdef __BIG_ENDIAN__
-#if __BIG_ENDIAN__
-#define _YUGA_LITTLE_ENDIAN 0
-#define _YUGA_BIG_ENDIAN 1
-#endif
-#endif
-
-#if !defined(_YUGA_LITTLE_ENDIAN) || !defined(_YUGA_BIG_ENDIAN)
-#error unable to determine endian
-#endif
+#if !defined(INFINITY) && defined(HUGE_VAL)
+#define INFINITY HUGE_VAL
+#endif /* INFINITY */
typedef int si_int;
typedef unsigned su_int;
@@ -83,7 +44,7 @@
#else
si_int high;
su_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} dwords;
@@ -98,7 +59,7 @@
#else
su_int high;
su_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} udwords;
@@ -118,7 +79,7 @@
#else
di_int high;
du_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} twords;
@@ -133,7 +94,7 @@
#else
du_int high;
du_int low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
};
} utwords;
@@ -157,7 +118,7 @@
return r.all;
}
-#endif
+#endif /* __x86_64 */
typedef union
{
@@ -179,7 +140,7 @@
#else
udwords high;
udwords low;
-#endif
+#endif /* _YUGA_LITTLE_ENDIAN */
} uqwords;
typedef union
@@ -188,4 +149,4 @@
long double f;
} long_double_bits;
-#endif
+#endif /* INT_LIB_H */
More information about the llvm-commits
mailing list