summaryrefslogtreecommitdiff
path: root/sljit
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2014-07-09 04:41:15 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2014-07-09 04:41:15 +0000
commit85506d78d451291ac39e3fc1a7d02738c69423ae (patch)
tree7dd8a08ce11c1aeafaa7a4bc3fd9062361a2d94a /sljit
parentbbbc944ef10fe3f383e95b10c13308c0695d0d1a (diff)
downloadpcre-85506d78d451291ac39e3fc1a7d02738c69423ae.tar.gz
Minor JIT compiler update.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1493 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'sljit')
-rw-r--r--sljit/sljitConfigInternal.h8
-rw-r--r--sljit/sljitLir.c4
-rw-r--r--sljit/sljitLir.h26
-rw-r--r--sljit/sljitNativeARM_32.c2
-rw-r--r--sljit/sljitNativeARM_T2_32.c2
-rw-r--r--sljit/sljitNativeX86_64.c16
6 files changed, 36 insertions, 22 deletions
diff --git a/sljit/sljitConfigInternal.h b/sljit/sljitConfigInternal.h
index 26a614d..6351e5b 100644
--- a/sljit/sljitConfigInternal.h
+++ b/sljit/sljitConfigInternal.h
@@ -155,10 +155,14 @@
#undef SLJIT_EXECUTABLE_ALLOCATOR
#endif
+#if (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
+ || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
+#define SLJIT_CONFIG_ARM_32 1
+#endif
+
#if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32) || (defined SLJIT_CONFIG_X86_64 && SLJIT_CONFIG_X86_64)
#define SLJIT_CONFIG_X86 1
-#elif (defined SLJIT_CONFIG_ARM_V5 && SLJIT_CONFIG_ARM_V5) || (defined SLJIT_CONFIG_ARM_V7 && SLJIT_CONFIG_ARM_V7) \
- || (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2) || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
+#elif (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32) || (defined SLJIT_CONFIG_ARM_64 && SLJIT_CONFIG_ARM_64)
#define SLJIT_CONFIG_ARM 1
#elif (defined SLJIT_CONFIG_PPC_32 && SLJIT_CONFIG_PPC_32) || (defined SLJIT_CONFIG_PPC_64 && SLJIT_CONFIG_PPC_64)
#define SLJIT_CONFIG_PPC 1
diff --git a/sljit/sljitLir.c b/sljit/sljitLir.c
index 29fc322..29b6040 100644
--- a/sljit/sljitLir.c
+++ b/sljit/sljitLir.c
@@ -873,6 +873,8 @@ static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler,
SLJIT_UNUSED_ARG(args);
SLJIT_UNUSED_ARG(scratches);
SLJIT_UNUSED_ARG(saveds);
+ SLJIT_UNUSED_ARG(fscratches);
+ SLJIT_UNUSED_ARG(fsaveds);
SLJIT_UNUSED_ARG(local_size);
SLJIT_ASSERT(args >= 0 && args <= 3);
@@ -900,6 +902,8 @@ static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler
SLJIT_UNUSED_ARG(args);
SLJIT_UNUSED_ARG(scratches);
SLJIT_UNUSED_ARG(saveds);
+ SLJIT_UNUSED_ARG(fscratches);
+ SLJIT_UNUSED_ARG(fsaveds);
SLJIT_UNUSED_ARG(local_size);
#if (defined SLJIT_VERBOSE && SLJIT_VERBOSE) || (defined SLJIT_DEBUG && SLJIT_DEBUG)
diff --git a/sljit/sljitLir.h b/sljit/sljitLir.h
index 1ca4599..50e47fb 100644
--- a/sljit/sljitLir.h
+++ b/sljit/sljitLir.h
@@ -163,9 +163,11 @@ of sljitConfigInternal.h */
#define SLJIT_R0 1
#define SLJIT_R1 2
#define SLJIT_R2 3
-/* Note: on x86-32, R3 - R6 are emulated (using stack loads & stores),
- so they cannot be used for memory addressing. There is no such
- limitation on other CPUs. */
+/* Note: on x86-32, R3 - R6 (same as S3 - S6) are emulated (they
+ are allocated on the stack). These registers are called virtual
+ and cannot be used for memory addressing (cannot be part of
+ any SLJIT_MEM1, SLJIT_MEM2 construct). There is no such
+ limitation on other CPUs. See sljit_get_register_index(). */
#define SLJIT_R3 4
#define SLJIT_R4 5
#define SLJIT_R5 6
@@ -181,9 +183,11 @@ of sljitConfigInternal.h */
#define SLJIT_S0 (SLJIT_NUMBER_OF_REGISTERS)
#define SLJIT_S1 (SLJIT_NUMBER_OF_REGISTERS - 1)
#define SLJIT_S2 (SLJIT_NUMBER_OF_REGISTERS - 2)
-/* Note: on x86-32, S3 - S6 are emulated (using stack loads & stores),
- so they cannot be used for memory addressing. There is no such
- limitation on other CPUs. */
+/* Note: on x86-32, S3 - S6 (same as R3 - R6) are emulated (they
+ are allocated on the stack). These registers are called virtual
+ and cannot be used for memory addressing (cannot be part of
+ any SLJIT_MEM1, SLJIT_MEM2 construct). There is no such
+ limitation on other CPUs. See sljit_get_register_index(). */
#define SLJIT_S3 (SLJIT_NUMBER_OF_REGISTERS - 3)
#define SLJIT_S4 (SLJIT_NUMBER_OF_REGISTERS - 4)
#define SLJIT_S5 (SLJIT_NUMBER_OF_REGISTERS - 5)
@@ -807,15 +811,17 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op2(struct sljit_compiler *compiler
sljit_si src2, sljit_sw src2w);
/* The following function is a helper function for sljit_emit_op_custom.
- It returns with the real machine register index of any SLJIT_SCRATCH
- SLJIT_SAVED or SLJIT_LOCALS register.
- Note: it returns with -1 for virtual registers (all EREGs on x86-32). */
+ It returns with the real machine register index ( >=0 ) of any SLJIT_R,
+ SLJIT_S and SLJIT_SP registers.
+
+ Note: it returns with -1 for virtual registers (only on x86-32). */
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg);
/* The following function is a helper function for sljit_emit_op_custom.
It returns with the real machine register index of any SLJIT_FLOAT register.
- Note: the index is divided by 2 on ARM 32 bit architectures. */
+
+ Note: the index is always an even number on ARM (except ARM-64), MIPS, and SPARC. */
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg);
diff --git a/sljit/sljitNativeARM_32.c b/sljit/sljitNativeARM_32.c
index 0c44664..265e155 100644
--- a/sljit/sljitNativeARM_32.c
+++ b/sljit/sljitNativeARM_32.c
@@ -1975,7 +1975,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
{
check_sljit_get_float_register_index(reg);
- return reg;
+ return reg << 1;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
diff --git a/sljit/sljitNativeARM_T2_32.c b/sljit/sljitNativeARM_T2_32.c
index cfdc08c..6a714f8 100644
--- a/sljit/sljitNativeARM_T2_32.c
+++ b/sljit/sljitNativeARM_T2_32.c
@@ -1512,7 +1512,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_register_index(sljit_si reg)
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_get_float_register_index(sljit_si reg)
{
check_sljit_get_float_register_index(reg);
- return reg;
+ return reg << 1;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_op_custom(struct sljit_compiler *compiler,
diff --git a/sljit/sljitNativeX86_64.c b/sljit/sljitNativeX86_64.c
index 58d460a..39eb9e5 100644
--- a/sljit/sljitNativeX86_64.c
+++ b/sljit/sljitNativeX86_64.c
@@ -91,7 +91,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
sljit_si args, sljit_si scratches, sljit_si saveds,
sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
{
- sljit_si i, tmp, size, allocated_size;
+ sljit_si i, tmp, size, saved_register_size;
sljit_ub *inst;
CHECK_ERROR();
@@ -107,7 +107,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
#endif
/* Including the return address saved by the call instruction. */
- allocated_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
+ saved_register_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
tmp = saveds < SLJIT_NUMBER_OF_SAVED_REGISTERS ? (SLJIT_S0 + 1 - saveds) : SLJIT_FIRST_SAVED_REG;
for (i = SLJIT_S0; i >= tmp; i--) {
@@ -172,7 +172,7 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
#endif
}
- local_size = ((local_size + FIXED_LOCALS_OFFSET + allocated_size + 16 - 1) & ~(16 - 1)) - allocated_size;
+ local_size = ((local_size + FIXED_LOCALS_OFFSET + saved_register_size + 16 - 1) & ~(16 - 1)) - saved_register_size;
compiler->local_size = local_size;
#ifdef _WIN64
@@ -185,9 +185,9 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_enter(struct sljit_compiler *compil
*inst++ = GROUP_BINARY_83;
*inst++ = MOD_REG | SUB | 4;
/* Allocated size for registers must be divisible by 8. */
- SLJIT_ASSERT(!(allocated_size & 0x7));
+ SLJIT_ASSERT(!(saved_register_size & 0x7));
/* Aligned to 16 byte. */
- if (allocated_size & 0x8) {
+ if (saved_register_size & 0x8) {
*inst++ = 5 * sizeof(sljit_sw);
local_size -= 5 * sizeof(sljit_sw);
} else {
@@ -246,7 +246,7 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler,
sljit_si args, sljit_si scratches, sljit_si saveds,
sljit_si fscratches, sljit_si fsaveds, sljit_si local_size)
{
- sljit_si allocated_size;
+ sljit_si saved_register_size;
CHECK_ERROR_VOID();
check_sljit_set_context(compiler, args, scratches, saveds, fscratches, fsaveds, local_size);
@@ -260,8 +260,8 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler,
#endif
/* Including the return address saved by the call instruction. */
- allocated_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
- compiler->local_size = ((local_size + FIXED_LOCALS_OFFSET + allocated_size + 16 - 1) & ~(16 - 1)) - allocated_size;
+ saved_register_size = GET_SAVED_REGISTERS_SIZE(scratches, saveds, 1);
+ compiler->local_size = ((local_size + FIXED_LOCALS_OFFSET + saved_register_size + 16 - 1) & ~(16 - 1)) - saved_register_size;
}
SLJIT_API_FUNC_ATTRIBUTE sljit_si sljit_emit_return(struct sljit_compiler *compiler, sljit_si op, sljit_si src, sljit_sw srcw)