insert_after_ins (bb, last_ins, (dest)); \
} while (0)
-#define NEW_ICONST(cfg,dest,val) do { \
- (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \
- (dest)->opcode = OP_ICONST; \
- (dest)->inst_c0 = (val); \
- (dest)->type = STACK_I4; \
- } while (0)
-
-
#undef DEBUG
#define DEBUG(a) if (cfg->verbose_level > 1) a
#include "trace.h"
#include "mini-alpha.h"
-#include "inssel.h"
#include "cpu-alpha.h"
#include "jit-icalls.h"
ins = bb->code;
- if (bb->max_vreg > cfg->rs->next_vreg)
- cfg->rs->next_vreg = bb->max_vreg;
-
/*
* FIXME: Need to add more instructions, but the current machine
* description can't model some parts of the composite instructions like
case OP_MUL_IMM:
NEW_INS (cfg, temp, OP_I8CONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
switch (ins->opcode)
{
{
NEW_INS (cfg, temp, OP_I8CONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->opcode = OP_COMPARE;
ins->sreg2 = temp->dreg;
{
NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->opcode = OP_ICOMPARE;
ins->sreg2 = temp->dreg;
{
NEW_INS (cfg, temp, OP_I8CONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->opcode = OP_STOREI8_MEMBASE_REG;
ins->sreg1 = temp->dreg;
}
MonoInst *temp;
NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->opcode = OP_STOREI4_MEMBASE_REG;
ins->sreg1 = temp->dreg;
}
MonoInst *temp;
NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->opcode = OP_STOREI1_MEMBASE_REG;
ins->sreg1 = temp->dreg;
}
MonoInst *temp;
NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->opcode = OP_STOREI2_MEMBASE_REG;
ins->sreg1 = temp->dreg;
}
MonoInst *temp;
NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
switch(ins->opcode)
{
MonoInst *temp;
NEW_INS (cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int (cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
switch(ins->opcode)
{
MonoInst *temp;
NEW_INS(cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int(cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->sreg2 = temp->dreg;
ins->opcode = OP_LSHR;
}
MonoInst *temp;
NEW_INS(cfg, temp, OP_ICONST);
temp->inst_c0 = ins->inst_imm;
- temp->dreg = mono_regstate_next_int(cfg->rs);
+ temp->dreg = mono_alloc_ireg (cfg);
ins->sreg2 = temp->dreg;
ins->opcode = OP_LSHL;
}
bb->last_ins = last_ins;
- bb->max_vreg = cfg->rs->next_vreg;
+ bb->max_vreg = cfg->next_vreg;
}
/*========================= End of Function ========================*/
#define EMIT_ALPHA_BRANCH(Tins, PRED_REG, ALPHA_BR) \
offset = ((char *)code - \
(char *)cfg->native_code); \
- if (Tins->flags & MONO_INST_BRLABEL) \
- { \
- if (Tins->inst_i0->inst_c0) \
- { \
- CFG_DEBUG(3) g_print("inst_c0: %0lX, data: %p]\n", \
- Tins->inst_i0->inst_c0, \
- cfg->native_code + Tins->inst_i0->inst_c0); \
- alpha_##ALPHA_BR (code, PRED_REG, 0); \
- } \
- else \
- { \
- CFG_DEBUG(3) g_print("add patch info: MONO_PATCH_INFO_LABEL offset: %0X, inst_i0: %p]\n", \
- offset, Tins->inst_i0); \
- mono_add_patch_info (cfg, offset, \
- MONO_PATCH_INFO_LABEL, Tins->inst_i0); \
- alpha_##ALPHA_BR (code, PRED_REG, 0); \
- } \
- } \
- else \
- { \
if (Tins->inst_true_bb->native_offset) \
{ \
long br_offset = (char *)cfg->native_code + \
MONO_PATCH_INFO_BB, \
Tins->inst_true_bb); \
alpha_##ALPHA_BR (code, PRED_REG, 0); \
- } \
- }
+ }
#define EMIT_COND_EXC_BRANCH(ALPHA_BR, PRED_REG, EXC_NAME) \
CFG_DEBUG(4) g_print("ALPHA_CHECK: [br] target: %p, next: %p, curr: %p, last: %p [",
ins->inst_target_bb, bb->next_bb, ins, bb->last_ins);
- if (ins->flags & MONO_INST_BRLABEL)
+ if (ins->inst_target_bb->native_offset)
{
- if (ins->inst_i0->inst_c0)
- {
- CFG_DEBUG(4) g_print("inst_c0: %0lX, data: %p]\n",
- ins->inst_i0->inst_c0,
- cfg->native_code + ins->inst_i0->inst_c0);
- alpha_br(code, alpha_zero, 0);
- }
- else
- {
- CFG_DEBUG(4) g_print("add patch info: MONO_PATCH_INFO_LABEL offset: %0X, inst_i0: %p]\n",
- offset, ins->inst_i0);
- mono_add_patch_info (cfg, offset,
- MONO_PATCH_INFO_LABEL, ins->inst_i0);
-
- alpha_br(code, alpha_zero, 0);
- }
+ // Somehow native offset is offset from
+ // start of the code. So convert it to
+ // offset branch
+ long br_offset = (char *)cfg->native_code +
+ ins->inst_target_bb->native_offset - 4 - (char *)code;
+
+ CFG_DEBUG(4) g_print("jump to: native_offset: %0X, address %p]\n",
+ ins->inst_target_bb->native_offset,
+ cfg->native_code +
+ ins->inst_target_bb->native_offset);
+ alpha_br(code, alpha_zero, br_offset/4);
}
else
{
- if (ins->inst_target_bb->native_offset)
- {
- // Somehow native offset is offset from
- // start of the code. So convert it to
- // offset branch
- long br_offset = (char *)cfg->native_code +
- ins->inst_target_bb->native_offset - 4 - (char *)code;
-
- CFG_DEBUG(4) g_print("jump to: native_offset: %0X, address %p]\n",
- ins->inst_target_bb->native_offset,
- cfg->native_code +
- ins->inst_target_bb->native_offset);
- alpha_br(code, alpha_zero, br_offset/4);
- }
- else
- {
- CFG_DEBUG(4) g_print("add patch info: MONO_PATCH_INFO_BB offset: %0X, target_bb: %p]\n",
- offset, ins->inst_target_bb);
-
- mono_add_patch_info (cfg, offset,
- MONO_PATCH_INFO_BB,
- ins->inst_target_bb);
- alpha_br(code, alpha_zero, 0);
- }
+ CFG_DEBUG(4) g_print("add patch info: MONO_PATCH_INFO_BB offset: %0X, target_bb: %p]\n",
+ offset, ins->inst_target_bb);
+
+ mono_add_patch_info (cfg, offset,
+ MONO_PATCH_INFO_BB,
+ ins->inst_target_bb);
+ alpha_br(code, alpha_zero, 0);
}
break;
{
MONO_INST_NEW (cfg, vtarg, OP_MOVE);
vtarg->sreg1 = vt_reg;
- vtarg->dreg = mono_regstate_next_int (cfg->rs);
+ vtarg->dreg = mono_alloc_ireg (cfg);
mono_bblock_add_inst (cfg->cbb, vtarg);
mono_call_inst_add_outarg_reg (cfg, call, vtarg->dreg,
MONO_INST_NEW (cfg, this, OP_MOVE);
this->type = this_type;
this->sreg1 = this_reg;
- this->dreg = mono_regstate_next_int (cfg->rs);
+ this->dreg = mono_alloc_ireg (cfg);
mono_bblock_add_inst (cfg->cbb, this);
mono_call_inst_add_outarg_reg (cfg, call, this->dreg,
cinfo->ret.reg = alpha_f0;
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->ret))
+ if (!mono_type_generic_inst_is_valuetype (ret_type))
{
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = alpha_r0;
add_general (pgr, &stack_size, ainfo);
break;
case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (sig->params [i]))
+ if (!mono_type_generic_inst_is_valuetype (ptype))
{
add_general (pgr, &stack_size, ainfo);
break;
CFG_DEBUG(2) ALPHA_DEBUG("mono_arch_get_allocatable_int_vars");
- header = mono_method_get_header (cfg->method);
+ header = cfg->header;
sig = mono_method_signature (cfg->method);
/*========================= End of Function ========================*/
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_get_thread_intrinsic */
-/* */
-/* Function - */
-/* */
-/* Returns - */
-/* */
-/*------------------------------------------------------------------*/
-
-MonoInst *
-mono_arch_get_thread_intrinsic (MonoCompile* cfg)
-{
- MonoInst *ins;
-
- if (thread_tls_offset == -1)
- return NULL;
-
- MONO_INST_NEW (cfg, ins, OP_TLS_GET);
- ins->inst_offset = thread_tls_offset;
- return (ins);
-}
-
-/*========================= End of Function ========================*/
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_get_inst_for_method */
/*------------------------------------------------------------------*/
void*
-mono_arch_instrument_epilog (MonoCompile *cfg, void *func, void *p,
- gboolean enable_arguments)
+mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments, gboolean preserve_argument_registers)
{
unsigned int *code = p;
int save_mode = SAVE_NONE;
CFG_DEBUG(2) ALPHA_DEBUG("mono_arch_allocate_vars");
- header = mono_method_get_header (cfg->method);
+ header = cfg->header;
sig = mono_method_signature (cfg->method);
*/
gpointer*
-mono_arch_get_vcall_slot_addr (guint8* code, gpointer *regs)
+mono_arch_get_vcall_slot_addr (guint8* code, mgreg_t *regs)
{
unsigned int *pc = (unsigned int *)code;
guint32 reg, disp;
}
gpointer
-mono_arch_get_this_arg_from_call (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig, gssize *regs, guint8 *code)
+mono_arch_get_this_arg_from_call (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig, mgreg_t *regs, guint8 *code)
{
unsigned int *pc = (unsigned int *)code;