/[pcre]/code/trunk/sljit/sljitLir.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitLir.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 879 by zherczeg, Sat Jan 14 17:05:53 2012 UTC revision 880 by zherczeg, Sun Jan 15 17:23:37 2012 UTC
# Line 228  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co Line 228  SLJIT_API_FUNC_ATTRIBUTE struct sljit_co
228          compiler->abuf->used_size = 0;          compiler->abuf->used_size = 0;
229    
230          compiler->temporaries = -1;          compiler->temporaries = -1;
231          compiler->generals = -1;          compiler->saveds = -1;
232    
233  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)  #if (defined SLJIT_CONFIG_X86_32 && SLJIT_CONFIG_X86_32)
234          compiler->args = -1;          compiler->args = -1;
# Line 475  static SLJIT_INLINE void set_const(struc Line 475  static SLJIT_INLINE void set_const(struc
475  #define FUNCTION_CHECK_IS_REG(r) \  #define FUNCTION_CHECK_IS_REG(r) \
476          ((r) == SLJIT_UNUSED || (r) == SLJIT_LOCALS_REG || \          ((r) == SLJIT_UNUSED || (r) == SLJIT_LOCALS_REG || \
477          ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG3 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          ((r) >= SLJIT_TEMPORARY_REG1 && (r) <= SLJIT_TEMPORARY_REG3 && (r) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \
478          ((r) >= SLJIT_GENERAL_REG1 && (r) <= SLJIT_GENERAL_REG3 && (r) <= SLJIT_GENERAL_REG1 - 1 + compiler->generals)) \          ((r) >= SLJIT_SAVED_REG1 && (r) <= SLJIT_SAVED_REG3 && (r) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds)) \
479    
480  #define FUNCTION_CHECK_SRC(p, i) \  #define FUNCTION_CHECK_SRC(p, i) \
481          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->generals != -1); \          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \
482          if (((p) >= SLJIT_TEMPORARY_REG1 && (p) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          if (((p) >= SLJIT_TEMPORARY_REG1 && (p) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \
483                          ((p) >= SLJIT_GENERAL_REG1 && (p) <= SLJIT_GENERAL_REG1 - 1 + compiler->generals) || \                          ((p) >= SLJIT_SAVED_REG1 && (p) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds) || \
484                          (p) == SLJIT_LOCALS_REG) \                          (p) == SLJIT_LOCALS_REG) \
485                  SLJIT_ASSERT(i == 0); \                  SLJIT_ASSERT(i == 0); \
486          else if ((p) == SLJIT_IMM) \          else if ((p) == SLJIT_IMM) \
# Line 498  static SLJIT_INLINE void set_const(struc Line 498  static SLJIT_INLINE void set_const(struc
498                  SLJIT_ASSERT_STOP();                  SLJIT_ASSERT_STOP();
499    
500  #define FUNCTION_CHECK_DST(p, i) \  #define FUNCTION_CHECK_DST(p, i) \
501          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->generals != -1); \          SLJIT_ASSERT(compiler->temporaries != -1 && compiler->saveds != -1); \
502          if (((p) >= SLJIT_TEMPORARY_REG1 && (p) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \          if (((p) >= SLJIT_TEMPORARY_REG1 && (p) <= SLJIT_TEMPORARY_REG1 - 1 + compiler->temporaries) || \
503                          ((p) >= SLJIT_GENERAL_REG1 && (p) <= SLJIT_GENERAL_REG1 - 1 + compiler->generals) || \                          ((p) >= SLJIT_SAVED_REG1 && (p) <= SLJIT_SAVED_REG1 - 1 + compiler->saveds) || \
504                          (p) == SLJIT_UNUSED) \                          (p) == SLJIT_UNUSED) \
505                  SLJIT_ASSERT(i == 0); \                  SLJIT_ASSERT(i == 0); \
506          else if ((p) & SLJIT_MEM) { \          else if ((p) & SLJIT_MEM) { \
# Line 551  SLJIT_API_FUNC_ATTRIBUTE void sljit_comp Line 551  SLJIT_API_FUNC_ATTRIBUTE void sljit_comp
551  }  }
552    
553  static char* reg_names[] = {  static char* reg_names[] = {
554          (char*)"<noreg>", (char*)"tmp_r1", (char*)"tmp_r2", (char*)"tmp_r3",          (char*)"<noreg>", (char*)"t1", (char*)"t2", (char*)"t3",
555          (char*)"tmp_er1", (char*)"tmp_er2", (char*)"gen_r1", (char*)"gen_r2",          (char*)"te1", (char*)"te2", (char*)"s1", (char*)"s2",
556          (char*)"gen_r3", (char*)"gen_er1", (char*)"gen_er2", (char*)"stack_r"          (char*)"s3", (char*)"se1", (char*)"se2", (char*)"lcr"
557  };  };
558    
559  static char* freg_names[] = {  static char* freg_names[] = {
# Line 674  static SLJIT_INLINE void check_sljit_gen Line 674  static SLJIT_INLINE void check_sljit_gen
674  #endif  #endif
675  }  }
676    
677  static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size)  static SLJIT_INLINE void check_sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
678  {  {
679          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
680          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
681          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
682          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(temporaries);
683          SLJIT_UNUSED_ARG(generals);          SLJIT_UNUSED_ARG(saveds);
684          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
685    
686          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
687          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);
688          SLJIT_ASSERT(generals >= 0 && generals <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
689          SLJIT_ASSERT(args <= generals);          SLJIT_ASSERT(args <= saveds);
690          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
691  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
692          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
693                  fprintf(compiler->verbose, "  enter args=%d temporaries=%d generals=%d local_size=%d\n", args, temporaries, generals, local_size);                  fprintf(compiler->verbose, "  enter args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);
694  #endif  #endif
695  }  }
696    
697  static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size)  static SLJIT_INLINE void check_sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
698  {  {
699          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
700          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
701          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
702          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(temporaries);
703          SLJIT_UNUSED_ARG(generals);          SLJIT_UNUSED_ARG(saveds);
704          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
705    
706          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
707          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);
708          SLJIT_ASSERT(generals >= 0 && generals <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
709          SLJIT_ASSERT(args <= generals);          SLJIT_ASSERT(args <= saveds);
710          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
711  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
712          if (SLJIT_UNLIKELY(!!compiler->verbose))          if (SLJIT_UNLIKELY(!!compiler->verbose))
713                  fprintf(compiler->verbose, "  fake_enter args=%d temporaries=%d generals=%d local_size=%d\n", args, temporaries, generals, local_size);                  fprintf(compiler->verbose, "  fake_enter args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);
714  #endif  #endif
715  }  }
716    
# Line 743  static SLJIT_INLINE void check_sljit_emi Line 743  static SLJIT_INLINE void check_sljit_emi
743  #endif  #endif
744  }  }
745    
746  static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int generals, int local_size)  static SLJIT_INLINE void check_sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size)
747  {  {
748          /* If debug and verbose are disabled, all arguments are unused. */          /* If debug and verbose are disabled, all arguments are unused. */
749          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
# Line 751  static SLJIT_INLINE void check_sljit_emi Line 751  static SLJIT_INLINE void check_sljit_emi
751          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
752          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
753          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(temporaries);
754          SLJIT_UNUSED_ARG(generals);          SLJIT_UNUSED_ARG(saveds);
755          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
756    
757          SLJIT_ASSERT(args >= 0 && args <= 3);          SLJIT_ASSERT(args >= 0 && args <= 3);
758          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);          SLJIT_ASSERT(temporaries >= 0 && temporaries <= SLJIT_NO_TMP_REGISTERS);
759          SLJIT_ASSERT(generals >= 0 && generals <= SLJIT_NO_GEN_REGISTERS);          SLJIT_ASSERT(saveds >= 0 && saveds <= SLJIT_NO_GEN_REGISTERS);
760          SLJIT_ASSERT(args <= generals);          SLJIT_ASSERT(args <= saveds);
761          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);          SLJIT_ASSERT(local_size >= 0 && local_size <= SLJIT_MAX_LOCAL_SIZE);
762  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)  #if (defined SLJIT_DEBUG && SLJIT_DEBUG)
763          compiler->temporaries = temporaries;          compiler->temporaries = temporaries;
764          compiler->generals = generals;          compiler->saveds = saveds;
765          FUNCTION_CHECK_DST(dst, dstw);          FUNCTION_CHECK_DST(dst, dstw);
766          compiler->temporaries = -1;          compiler->temporaries = -1;
767          compiler->generals = -1;          compiler->saveds = -1;
768  #endif  #endif
769  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)  #if (defined SLJIT_VERBOSE && SLJIT_VERBOSE)
770          if (SLJIT_UNLIKELY(!!compiler->verbose)) {          if (SLJIT_UNLIKELY(!!compiler->verbose)) {
771                  fprintf(compiler->verbose, "  fast_enter ");                  fprintf(compiler->verbose, "  fast_enter ");
772                  sljit_verbose_param(dst, dstw);                  sljit_verbose_param(dst, dstw);
773                  fprintf(compiler->verbose, " args=%d temporaries=%d generals=%d local_size=%d\n", args, temporaries, generals, local_size);                  fprintf(compiler->verbose, " args=%d temporaries=%d saveds=%d local_size=%d\n", args, temporaries, saveds, local_size);
774          }          }
775  #endif  #endif
776  }  }
# Line 1318  SLJIT_API_FUNC_ATTRIBUTE void sljit_free Line 1318  SLJIT_API_FUNC_ATTRIBUTE void sljit_free
1318          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1319  }  }
1320    
1321  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size)  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_enter(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
1322  {  {
1323          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1324          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1325          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(temporaries);
1326          SLJIT_UNUSED_ARG(generals);          SLJIT_UNUSED_ARG(saveds);
1327          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1328          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1329          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1330  }  }
1331    
1332  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size)  SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
1333  {  {
1334          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1335          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1336          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(temporaries);
1337          SLJIT_UNUSED_ARG(generals);          SLJIT_UNUSED_ARG(saveds);
1338          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1339          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1340  }  }
# Line 1349  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 1349  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
1349          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;
1350  }  }
1351    
1352  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int generals, int local_size)  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_fast_enter(struct sljit_compiler *compiler, int dst, sljit_w dstw, int args, int temporaries, int saveds, int local_size)
1353  {  {
1354          SLJIT_UNUSED_ARG(compiler);          SLJIT_UNUSED_ARG(compiler);
1355          SLJIT_UNUSED_ARG(dst);          SLJIT_UNUSED_ARG(dst);
1356          SLJIT_UNUSED_ARG(dstw);          SLJIT_UNUSED_ARG(dstw);
1357          SLJIT_UNUSED_ARG(args);          SLJIT_UNUSED_ARG(args);
1358          SLJIT_UNUSED_ARG(temporaries);          SLJIT_UNUSED_ARG(temporaries);
1359          SLJIT_UNUSED_ARG(generals);          SLJIT_UNUSED_ARG(saveds);
1360          SLJIT_UNUSED_ARG(local_size);          SLJIT_UNUSED_ARG(local_size);
1361          SLJIT_ASSERT_STOP();          SLJIT_ASSERT_STOP();
1362          return SLJIT_ERR_UNSUPPORTED;          return SLJIT_ERR_UNSUPPORTED;

Legend:
Removed from v.879  
changed lines
  Added in v.880

  ViewVC Help
Powered by ViewVC 1.1.5