X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fir-emit.h;h=522438da5b06d3cf9168208ca95f5ed579144006;hb=e343ad0cfd404c92761cd6e0f683ccd46402897b;hp=abfa1ffe73b3cf93737bc63885693e13034587f3;hpb=4ae209510f6d1f6cd86ea936fae1c748ce83caf2;p=mono.git diff --git a/mono/mini/ir-emit.h b/mono/mini/ir-emit.h index abfa1ffe73b..522438da5b0 100644 --- a/mono/mini/ir-emit.h +++ b/mono/mini/ir-emit.h @@ -75,6 +75,12 @@ alloc_ireg_mp (MonoCompile *cfg) return vreg; } +static inline guint32 +alloc_xreg (MonoCompile *cfg) +{ + return alloc_ireg (cfg); +} + static inline guint32 alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) { @@ -100,11 +106,48 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) } } +/* + * Macros used to generate intermediate representation macros + * + * The macros use a `MonoConfig` object as its context, and among other + * things it is used to associate instructions with the memory pool with + * it. + * + * The macros come in three variations with slightly different + * features, the patter is: NEW_OP, EMIT_NEW_OP, MONO_EMIT_NEW_OP, + * the differences are as follows: + * + * `NEW_OP`: these are the basic macros to setup an instruction that is + * passed as an argument. + * + * `EMIT_NEW_OP`: these macros in addition to creating the instruction + * add the instruction to the current basic block in the `MonoConfig` + * object passed. Usually these are used when further customization of + * the `inst` parameter is desired before the instruction is added to the + * MonoConfig current basic block. + * + * `MONO_EMIT_NEW_OP`: These variations of the instructions are used when + * you are merely interested in emitting the instruction into the `MonoConfig` + * parameter. + */ #undef MONO_INST_NEW /* * FIXME: zeroing out some fields is not needed with the new IR, but the old * JIT code still uses the left and right fields, so it has to stay. */ + +/* + * MONO_INST_NEW: create a new MonoInst instance that is allocated on the MonoConfig pool. + * + * @cfg: the MonoConfig object that will be used as the context for the + * instruction. + * @dest: this is the place where the instance of the `MonoInst` is stored. + * @op: the value that should be stored in the MonoInst.opcode field + * + * This initializes an empty MonoInst that has been nulled out, it is allocated + * from the memory pool associated with the MonoConfig, but it is not linked anywhere. + * the cil_code is set to the cfg->ip address. + */ #define MONO_INST_NEW(cfg,dest,op) do { \ (dest) = (MonoInst *)mono_mempool_alloc ((cfg)->mempool, sizeof (MonoInst)); \ (dest)->inst_c0 = (dest)->inst_c1 = 0; \ @@ -266,15 +309,6 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) #define NEW_LDTOKENCONST(cfg,dest,image,token,generic_context) NEW_AOTCONST_TOKEN ((cfg), (dest), MONO_PATCH_INFO_LDTOKEN, (image), (token), (generic_context), STACK_PTR, NULL) -#define NEW_TLS_OFFSETCONST(cfg,dest,key) do { \ - if (cfg->compile_aot) { \ - NEW_AOTCONST ((cfg), (dest), MONO_PATCH_INFO_TLS_OFFSET, GINT_TO_POINTER (key)); \ - } else { \ - int _offset = mini_get_tls_offset ((key)); \ - NEW_PCONST ((cfg), (dest), GINT_TO_POINTER (_offset)); \ - } \ - } while (0) - #define NEW_DECLSECCONST(cfg,dest,image,entry) do { \ if (cfg->compile_aot) { \ NEW_AOTCONST_TOKEN (cfg, dest, MONO_PATCH_INFO_DECLSEC, image, (entry).index, NULL, STACK_OBJ, NULL); \