summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/lightning/asm-common.h
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-06-20 08:27:04 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-06-20 08:27:04 +0000
commitfa7ac00838827672f5c4a08dd1a37021285326e6 (patch)
treeafa7fced77a8eb31ff83793bc206022094c369c5 /src/runtime/c/pgf/lightning/asm-common.h
parentf8073ea1cd935154a50b0b9b8221db1254119100 (diff)
add x86_64 support to GNU lightning
Diffstat (limited to 'src/runtime/c/pgf/lightning/asm-common.h')
-rw-r--r--src/runtime/c/pgf/lightning/asm-common.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/runtime/c/pgf/lightning/asm-common.h b/src/runtime/c/pgf/lightning/asm-common.h
index 42c8814a9..bdaa6c2ea 100644
--- a/src/runtime/c/pgf/lightning/asm-common.h
+++ b/src/runtime/c/pgf/lightning/asm-common.h
@@ -14,7 +14,7 @@
*
* GNU lightning is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1, or (at your option)
+ * by the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU lightning is distributed in the hope that it will be useful, but
@@ -24,8 +24,8 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with GNU lightning; see the file COPYING.LESSER; if not, write to the
- * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
+ * Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
*
***********************************************************************/
@@ -37,21 +37,25 @@
#ifndef _ASM_SAFETY
#define JITFAIL(MSG) 0
#else
-#if defined __GNUC__ && (__GNUC__ == 3 ? __GNUC_MINOR__ >= 2 : __GNUC__ > 3)
+#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || (defined __GNUC__ && (__GNUC__ == 3 ? __GNUC_MINOR__ >= 2 : __GNUC__ > 3))
#define JITFAIL(MSG) jit_fail(MSG, __FILE__, __LINE__, __func__)
-#else
+#elif defined __GNUC__
#define JITFAIL(MSG) jit_fail(MSG, __FILE__, __LINE__, __FUNCTION__)
+#else
+#define JITFAIL(MSG) jit_fail(MSG, __FILE__, __LINE__, "(unknown)")
#endif
#endif
-#if defined __GNUC__ && (__GNUC__ == 3 ? __GNUC_MINOR__ >= 2 : __GNUC__ > 3)
+#if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || (defined __GNUC__ && (__GNUC__ == 3 ? __GNUC_MINOR__ >= 2 : __GNUC__ > 3))
#define JITSORRY(MSG) jit_fail("sorry, unimplemented: " MSG, __FILE__, __LINE__, __func__)
-#else
+#elif defined __GNUC__
#define JITSORRY(MSG) jit_fail("sorry, unimplemented: " MSG, __FILE__, __LINE__, __FUNCTION__)
+#else
+#define JITSORRY(MSG) jit_fail("sorry, unimplemented: " MSG, __FILE__, __LINE__, "(unknown)")
#endif
#ifdef __GNUC__
-#define JIT_UNUSED __attribute__((unused))
+#define JIT_UNUSED __attribute__((__unused__))
#else
#define JIT_UNUSED
#endif
@@ -91,11 +95,13 @@ typedef unsigned long _ul;
#define _jit_UC(X) ((_uc )(X))
#define _jit_US(X) ((_us )(X))
#define _jit_UI(X) ((_ui )(X))
+#define _jit_SI(X) ((int )(X))
#define _jit_SL(X) ((_sl )(X))
#define _jit_UL(X) ((_ul )(X))
# define _PUC(X) ((_uc *)(X))
# define _PUS(X) ((_us *)(X))
# define _PUI(X) ((_ui *)(X))
+# define _PSI(X) ((int *)(X))
# define _PSL(X) ((_sl *)(X))
# define _PUL(X) ((_ul *)(X))
@@ -105,9 +111,9 @@ typedef unsigned long _ul;
#define _jit_L(L) _jit_UL(((*_jit.x.ul_pc++)= _jit_UL((L) )))
#define _jit_I_noinc(I) _jit_UL(((*_jit.x.ui_pc)= _jit_UI((I) )))
-#define _MASK(N) ((unsigned)((1<<(N)))-1)
-#define _siP(N,I) (!((((unsigned)(I))^(((unsigned)(I))<<1))&~_MASK(N)))
-#define _uiP(N,I) (!(((unsigned)(I))&~_MASK(N)))
+#define _MASK(N) ((unsigned long)((1L<<(N)))-1L)
+#define _siP(N,I) (!((((unsigned long)(I))^(((unsigned long)(I))<<1))&~_MASK(N)))
+#define _uiP(N,I) (!(((unsigned long)(I))&~_MASK(N)))
#define _suiP(N,I) (_siP(N,I) | _uiP(N,I))
#ifndef _ASM_SAFETY
@@ -125,8 +131,10 @@ typedef unsigned long _ul;
#define _s0P(I) ((I)==0)
#define _s8P(I) _siP(8,I)
#define _s16P(I) _siP(16,I)
+#define _s32P(I) _siP(32,I)
#define _u8P(I) _uiP(8,I)
#define _u16P(I) _uiP(16,I)
+#define _u32P(I) _uiP(32,I)
#define _su8(I) _ck_su(8,I)
#define _su16(I) _ck_su(16,I)