/*------------------------------------------------------------------*/
/* D e f i n e s */
/*------------------------------------------------------------------*/
-
-#define NOT_IMPLEMENTED(x) \
- g_error ("FIXME: %s is not yet implemented.", x);
-
#define ALPHA_DEBUG(x) \
if (mini_alpha_verbose_level) \
g_debug ("ALPHA_DEBUG: %s is called.", x);
#include "mini-alpha.h"
#include "inssel.h"
#include "cpu-alpha.h"
+#include "jit-icalls.h"
/*========================= End of Includes ========================*/
gboolean lmf_addr_key_inited = FALSE;
+MonoBreakpointInfo
+mono_breakpoint_info [MONO_BREAKPOINT_ARRAY_SIZE];
+
/*====================== End of Global Variables ===================*/
-static void mono_arch_break(void);
gpointer mono_arch_get_lmf_addr (void);
typedef enum {
}
static void
-add_valuetype (MonoGenericSharingContext *ctx, MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
+add_valuetype (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig, ArgInfo *ainfo, MonoType *type,
gboolean is_return,
guint32 *gr, guint32 *fr, guint32 *stack_size)
{
/*========================= End of Function ========================*/
-static void
- peephole_pass (MonoCompile *cfg, MonoBasicBlock *bb)
+// This peephole function is called before "local_regalloc" method
+// TSV_TODO - Check what we need to move here
+void
+mono_arch_peephole_pass_1 (MonoCompile *cfg, MonoBasicBlock *bb)
+{
+ CFG_DEBUG(3) g_print ("ALPHA: PEEPHOLE_1 pass\n");
+}
+
+// This peephole function is called after "local_regalloc" method
+void
+mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb)
{
- MonoInst *ins, *last_ins = NULL;
+ MonoInst *ins, *n, *last_ins = NULL;
ins = bb->code;
- CFG_DEBUG(3) g_print ("ALPHA: PEEPHOLE pass\n");
+ CFG_DEBUG(3) g_print ("ALPHA: PEEPHOLE_2 pass\n");
- while (ins)
- {
+ MONO_BB_FOR_EACH_INS_SAFE (bb, n, ins) {
switch (ins->opcode)
{
case OP_MOVE:
case OP_FMOVE:
- case OP_SETREG:
/*
* Removes:
*
if (ins->dreg == ins->sreg1 &&
ins->dreg != alpha_at)
{
- if (last_ins)
- last_ins->next = ins->next;
-
- ins = ins->next;
+ MONO_DELETE_INS (bb, ins);
continue;
}
last_ins->dreg != alpha_at &&
ins->dreg == last_ins->sreg1)
{
- last_ins->next = ins->next;
-
- ins = ins->next;
+ MONO_DELETE_INS (bb, ins);
continue;
}
}
else
{
- last_ins->next = ins->next;
- ins = ins->next;
+ MONO_DELETE_INS (bb, ins);
continue;
}
}
{
if (ins->dreg == last_ins->sreg1)
{
- last_ins->next = ins->next;
-
- ins = ins->next;
+ MONO_DELETE_INS (bb, ins);
continue;
}
else
{
if (ins->dreg == last_ins->sreg1)
{
- last_ins->next = ins->next;
-
- ins = ins->next;
+ MONO_DELETE_INS (bb, ins);
continue;
}
else
{
if (ins->dreg == last_ins->dreg)
{
- last_ins->next = ins->next;
-
- ins = ins->next;
+ MONO_DELETE_INS (bb, ins);
continue;
}
else
bb->last_ins = last_ins;
}
-
-
// Convert to opposite branch opcode
static guint16 cvt_branch_opcode(guint16 opcode)
{
* Converts complex opcodes into simpler ones so that each IR instruction
* corresponds to one machine instruction.
*/
-static void
- mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
+void
+mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb)
{
- MonoInst *ins, *temp, *last_ins = NULL;
+ MonoInst *ins, *n, *temp, *last_ins = NULL;
MonoInst *next;
ins = bb->code;
* cdq.
*/
- while (ins)
- {
+ MONO_BB_FOR_EACH_INS_SAFE (bb, n, ins) {
switch (ins->opcode)
{
case OP_DIV_IMM:
ins->sreg2 = temp->dreg;
// We should try to reevaluate new IR opcode
- continue;
+ //continue;
}
next = ins->next;
ins->sreg2 = temp->dreg;
// We should try to reevaluate new IR opcode
- continue;
+ //continue;
}
next = ins->next;
bb->max_vreg = cfg->rs->next_vreg;
}
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_local_regalloc. */
-/* */
-/* Function - We first scan the list of instructions and we */
-/* save the liveness information of each register */
-/* (when the register is first used, when its value */
-/* is set etc.). We also reverse the list of instr- */
-/* uctions (in the InstList list) because assigning */
-/* registers backwards allows for more tricks to be */
-/* used. */
-/* */
-/*------------------------------------------------------------------*/
-
-void
-mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
-{
- CFG_DEBUG(2) ALPHA_DEBUG("mono_arch_local_regalloc");
-
- if (!bb->code)
- return;
-
- mono_arch_lowering_pass (cfg, bb);
-
- mono_local_regalloc(cfg, bb);
-}
-
/*========================= End of Function ========================*/
#define AXP_GENERAL_REGS 6
CFG_DEBUG(2) ALPHA_DEBUG("mono_arch_output_basic_block");
- if (cfg->opt & MONO_OPT_PEEPHOLE)
- peephole_pass (cfg, bb);
-
CFG_DEBUG(2) g_print ("Basic block %d(%p) starting at offset 0x%x\n",
bb->block_num, bb, bb->native_offset);
mono_debug_open_block (cfg, bb, offset);
- ins = bb->code;
- while (ins)
- {
+ MONO_BB_FOR_EACH_INS (bb, ins) {
offset = ((char *)code) - ((char *)cfg->native_code);
max_len = ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
switch (ins->opcode)
{
+ case OP_RELAXED_NOP:
+ break;
case OP_LSHR:
// Shift 64 bit value right
CFG_DEBUG(4) g_print("ALPHA_CHECK: [long_shr] dreg=%d, sreg1=%d, sreg2=%d\n",
case OP_LCALL:
case OP_VCALL:
case OP_VOIDCALL:
- case CEE_CALL:
+ case OP_CALL:
CFG_DEBUG(4) g_print("ALPHA_CHECK: [fcall/lcall/vcall/voidcall/call] Target: [");
call = (MonoCallInst*)ins;
alpha_bsr(code, alpha_ra, 0);
}
break;
-
- case CEE_RET:
- CFG_DEBUG(4) g_print("ALPHA_CHECK: [ret]\n");
-
- alpha_ret(code, alpha_ra, 1);
- break;
case OP_THROW:
CFG_DEBUG(4) g_print("ALPHA_CHECK: [throw] sreg1=%0x\n",
last_ins = ins;
last_offset = offset;
-
- ins = ins->next;
- }
+ }
cfg->code_len = ((char *)code) - ((char *)cfg->native_code);
}
if (*ip2 != (t_addr & 0xFFFFFFFF) ||
*(ip2+1) != ((t_addr>>32) & 0xFFFFFFFF))
- NOT_IMPLEMENTED("mono_arch_patch_code: MONO_PATCH_INFO_CLASS_INIT");
+ NOT_IMPLEMENTED;
// amd64_call_code (ip2, 0);
break;
}
/*========================= End of Function ========================*/
-/*------------------------------------------------------------------*/
-/* */
-/* Name - mono_arch_break */
-/* */
-/* Function - Process a "break" operation for debugging. */
-/* */
-/*------------------------------------------------------------------*/
-
-static void
-mono_arch_break(void) {
-}
-
-
/*------------------------------------------------------------------*/
/* */
/* Name - mono_arch_register_lowlevel_calls */
{
ALPHA_DEBUG("mono_arch_register_lowlevel_calls");
- mono_register_jit_icall (mono_arch_break, "mono_arch_break", NULL, TRUE);
mono_register_jit_icall (mono_arch_get_lmf_addr, "mono_arch_get_lmf_addr",
NULL, TRUE);
}
CFG_DEBUG(3) g_print("mono_arch_get_inst_for_method: %s\n", cmethod->name);
- if (cmethod->klass == mono_defaults.thread_class &&
- strcmp (cmethod->name, "MemoryBarrier") == 0) {
- MONO_INST_NEW (cfg, ins, OP_MEMORY_BARRIER);
- }
-
return ins;
}
{
ALPHA_DEBUG("mono_arch_create_class_init_trampoline");
- NOT_IMPLEMENTED("mono_arch_create_class_init_trampoline: check MONO_ARCH_HAVE_CREATE_SPECIFIC_TRAMPOLINE define");
+ NOT_IMPLEMENTED;
return 0;
}
break;
default:
- NOT_IMPLEMENTED("");
+ NOT_IMPLEMENTED;
}
if (!inreg && (ainfo->storage != ArgOnStack))
return 0;
}
+gpointer
+mono_arch_get_this_arg_from_call (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig, gssize *regs, guint8 *code)
+{
+ unsigned int *pc = (unsigned int *)code;
+
+ ALPHA_PRINT g_debug("ALPHA_CHECK: [mono_arch_get_this_arg_from_call] code: %p regs: %p",
+ pc, regs);
+
+ if (MONO_TYPE_ISSTRUCT (sig->ret))
+ return (gpointer)regs [alpha_a1];
+ else
+ return (gpointer)regs [alpha_a0];
+}
+
+gpointer
+mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target)
+{
+ unsigned int *code, *start;
+ MonoDomain *domain = mono_domain_get ();
+ int i;
+
+ ALPHA_PRINT g_debug("ALPHA_CHECK: [mono_arch_get_delegate_invoke_impl]");
+
+ /* FIXME: Support more cases */
+ if (MONO_TYPE_ISSTRUCT (sig->ret))
+ return NULL;
+
+ return NULL;
+}
guint32
mono_arch_get_patch_offset (guint8 *code)
{
return 3;
}
+
+gpointer
+mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
+{
+ /* FIXME: implement */
+ g_assert_not_reached ();
+}