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

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

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

revision 859 by zherczeg, Wed Jan 4 17:29:11 2012 UTC revision 860 by zherczeg, Mon Jan 9 20:12:58 2012 UTC
# Line 312  static SLJIT_INLINE sljit_uw sljit_get_g Line 312  static SLJIT_INLINE sljit_uw sljit_get_g
312  /* Instruction generation. Returns with error code. */  /* Instruction generation. Returns with error code. */
313    
314  /*  /*
315     Entry instruction. The instruction has "args" number of arguments     The executable code is basically a function call from the viewpoint of
316     and will use the first "general" number of general registers.     the C language. The function calls must obey to the ABI (Application
317     The arguments are passed into the general registers (arg1 to general_reg1, and so on).     Binary Interface) of the platform, which specify the purpose of machine
318     Thus, "args" must be less or equal than "general". A local_size extra     registers and stack handling among other things. The sljit_emit_enter
319     stack space is allocated for the jit code (must be less or equal than     function emits the necessary instructions for setting up a new context
320     SLJIT_MAX_LOCAL_SIZE), which can accessed through SLJIT_LOCALS_REG (see     for the executable code and moves function arguments to the general
321     the notes there). SLJIT_LOCALS_REG is not necessary the real stack pointer!     registers. The number of arguments are specified in the "args"
322     It just points somewhere in the stack if local_size > 0 (!). Thus, the only     parameter and the first argument goes to SLJIT_GENERAL_REG1, the second
323     thing which is known that the memory area between SLJIT_LOCALS_REG and     goes to SLJIT_GENERAL_REG2 and so on. The number of temporary and
324     SLJIT_LOCALS_REG + local_size is a valid stack area if local_size > 0     general registers are passed in "temporaries" and "generals" arguments
325  */     respectively. Since the general registers contains the arguments,
326       "args" must be less or equal than "generals". The sljit_emit_enter
327       is also capable of allocating a stack space for local variables. The
328       "local_size" argument contains the size in bytes of this local area
329       and its staring address is stored in SLJIT_LOCALS_REG. However
330       the SLJIT_LOCALS_REG is not necessary the machine stack pointer.
331       The memory bytes between SLJIT_LOCALS_REG (inclusive) and
332       SLJIT_LOCALS_REG + local_size (exclusive) can be modified freely
333       until the function returns. The stack space is uninitialized.
334    
335  /* Note: multiple calls of this function overwrites the previous call. */     Note: every call of sljit_emit_enter and sljit_set_context overwrites
336             the previous context. */
337    
338  #define SLJIT_MAX_LOCAL_SIZE    65536  #define SLJIT_MAX_LOCAL_SIZE    65536
339    
340  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 generals, int local_size);
341    
342  /* Since sljit_emit_return (and many asserts) uses variables which are initialized  /* The machine code has a context (which contains the local stack space size,
343     by sljit_emit_enter, a simple return is not possible if these variables are not     number of used registers, etc.) which initialized by sljit_emit_enter. Several
344     initialized. sljit_fake_enter does not emit any instruction, just initialize     functions (like sljit_emit_return) requres this context to be able to generate
345     those variables. */     the appropriate code. However, some code fragments (like inline cache) may have
346       no normal entry point so their context is unknown for the compiler. Using the
347       function below we can specify thir context.
348    
349       Note: every call of sljit_emit_enter and sljit_set_context overwrites
350             the previous context. */
351    
352  /* Note: multiple calls of this function overwrites the previous call. */  /* Note: multiple calls of this function overwrites the previous call. */
353    
354  SLJIT_API_FUNC_ATTRIBUTE void sljit_fake_enter(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 generals, int local_size);
355    
356  /* Return from jit. See below the possible values for src and srcw. */  /* Return from jit. See below the possible values for src and srcw. */
357  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int src, sljit_w srcw);  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_return(struct sljit_compiler *compiler, int src, sljit_w srcw);
# Line 530  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 544  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
544  #define SLJIT_SUB                       25  #define SLJIT_SUB                       25
545  /* Flags: I | C | K */  /* Flags: I | C | K */
546  #define SLJIT_SUBC                      26  #define SLJIT_SUBC                      26
547  /* Note: integer mul */  /* Note: integer mul
548  /* Flags: I | O (see SLJIT_C_MUL_*) | K */     Flags: I | O (see SLJIT_C_MUL_*) | K */
549  #define SLJIT_MUL                       27  #define SLJIT_MUL                       27
550  /* Flags: I | E | K */  /* Flags: I | E | K */
551  #define SLJIT_AND                       28  #define SLJIT_AND                       28
# Line 539  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_ Line 553  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_
553  #define SLJIT_OR                        29  #define SLJIT_OR                        29
554  /* Flags: I | E | K */  /* Flags: I | E | K */
555  #define SLJIT_XOR                       30  #define SLJIT_XOR                       30
556  /* Flags: I | E | K */  /* Flags: I | E | K
557       Let bit_length be the length of the shift operation: 32 or 64.
558       If src2 is immediate, src2w is masked by (bit_length - 1).
559       Otherwise, if the content of src2 is outside the range from 0
560       to bit_length - 1, the operation is undefined. */
561  #define SLJIT_SHL                       31  #define SLJIT_SHL                       31
562  /* Flags: I | E | K */  /* Flags: I | E | K
563       Let bit_length be the length of the shift operation: 32 or 64.
564       If src2 is immediate, src2w is masked by (bit_length - 1).
565       Otherwise, if the content of src2 is outside the range from 0
566       to bit_length - 1, the operation is undefined. */
567  #define SLJIT_LSHR                      32  #define SLJIT_LSHR                      32
568  /* Flags: I | E | K */  /* Flags: I | E | K
569       Let bit_length be the length of the shift operation: 32 or 64.
570       If src2 is immediate, src2w is masked by (bit_length - 1).
571       Otherwise, if the content of src2 is outside the range from 0
572       to bit_length - 1, the operation is undefined. */
573  #define SLJIT_ASHR                      33  #define SLJIT_ASHR                      33
574    
575  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,  SLJIT_API_FUNC_ATTRIBUTE int sljit_emit_op2(struct sljit_compiler *compiler, int op,

Legend:
Removed from v.859  
changed lines
  Added in v.860

  ViewVC Help
Powered by ViewVC 1.1.5