Skip to content

Commit 4e79109

Browse files
committed
Initial change for supporting 4-arg ops
1 parent e52568d commit 4e79109

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

src/mono/mono/mini/genmdesc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,12 @@ def parse_mini_ops (target_define):
9191
if m != None:
9292
opcodes [m.group (1)] = OpDef(opcode_id, m.group (1), m.group (2), m.group (3), m.group (4))
9393
else:
94-
print ("Unable to parse line: '{0}'".format (line))
95-
exit (1)
94+
m = re.search (r"MINI_OP4\(\w+\s*\,\s*\"([^\"]+)\", (\w+), (\w+), (\w+), (\w+), (\w+)\)", line)
95+
if m != None:
96+
opcodes [m.group (1)] = OpDef(opcode_id, m.group (1), m.group (2), m.group (3), m.group (4))
97+
else:
98+
print ("Unable to parse line: '{0}'".format (line))
99+
exit (1)
96100
opcode_id += 1
97101
opcode_file.close ()
98102
return opcodes

src/mono/mono/mini/helpers.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,38 @@
2525
#ifdef MINI_OP3
2626
#undef MINI_OP3
2727
#endif
28+
#ifdef MINI_OP4
29+
#undef MINI_OP4
30+
#endif
2831

2932
// This, instead of an array of pointers, to optimize away a pointer and a relocation per string.
3033
#define MSGSTRFIELD(line) MSGSTRFIELD1(line)
3134
#define MSGSTRFIELD1(line) str##line
3235
static const struct msgstr_t {
3336
#define MINI_OP(a,b,dest,src1,src2) char MSGSTRFIELD(__LINE__) [sizeof (b)];
3437
#define MINI_OP3(a,b,dest,src1,src2,src3) char MSGSTRFIELD(__LINE__) [sizeof (b)];
38+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) char MSGSTRFIELD(__LINE__) [sizeof (b)];
3539
#include "mini-ops.h"
3640
#undef MINI_OP
3741
#undef MINI_OP3
42+
#undef MINI_OP4
3843
} opstr = {
3944
#define MINI_OP(a,b,dest,src1,src2) b,
4045
#define MINI_OP3(a,b,dest,src1,src2,src3) b,
46+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) b,
4147
#include "mini-ops.h"
4248
#undef MINI_OP
4349
#undef MINI_OP3
50+
#undef MINI_OP4
4451
};
4552
static const gint16 opidx [] = {
4653
#define MINI_OP(a,b,dest,src1,src2) offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)),
4754
#define MINI_OP3(a,b,dest,src1,src2,src3) offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)),
55+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)),
4856
#include "mini-ops.h"
4957
#undef MINI_OP
5058
#undef MINI_OP3
59+
#undef MINI_OP4
5160
};
5261

5362
#endif /* DISABLE_LOGGING */

src/mono/mono/mini/method-to-ir.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,12 @@ static GENERATE_GET_CLASS_WITH_CACHE (geqcomparer, "System.Collections.Generic",
201201
#ifdef MINI_OP3
202202
#undef MINI_OP3
203203
#endif
204-
#define MINI_OP(a,b,dest,src1,src2) dest, src1, src2, ' ',
205-
#define MINI_OP3(a,b,dest,src1,src2,src3) dest, src1, src2, src3,
204+
#ifdef MINI_OP4
205+
#undef MINI_OP4
206+
#endif
207+
#define MINI_OP(a,b,dest,src1,src2) dest, src1, src2, ' ', ' ',
208+
#define MINI_OP3(a,b,dest,src1,src2,src3) dest, src1, src2, src3, ' ',
209+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) dest, src1, src2, src3, src4,
206210
#define NONE ' '
207211
#define IREG 'i'
208212
#define FREG 'f'
@@ -220,9 +224,11 @@ mini_ins_info[] = {
220224
};
221225
#undef MINI_OP
222226
#undef MINI_OP3
227+
#undef MINI_OP4
223228

224229
#define MINI_OP(a,b,dest,src1,src2) ((src2) != NONE ? 2 : ((src1) != NONE ? 1 : 0)),
225230
#define MINI_OP3(a,b,dest,src1,src2,src3) ((src3) != NONE ? 3 : ((src2) != NONE ? 2 : ((src1) != NONE ? 1 : 0))),
231+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) ((src4) != NONE ? 4 : ((src3) != NONE ? 3 : ((src2) != NONE ? 2 : ((src1) != NONE ? 1 : 0)))),
226232
/*
227233
* This should contain the index of the last sreg + 1. This is not the same
228234
* as the number of sregs for opcodes like IA64_CMP_EQ_IMM.
@@ -232,6 +238,7 @@ const gint8 mini_ins_sreg_counts[] = {
232238
};
233239
#undef MINI_OP
234240
#undef MINI_OP3
241+
#undef MINI_OP4
235242

236243
guint32
237244
mono_alloc_ireg (MonoCompile *cfg)

src/mono/mono/mini/mini-llvm.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,12 @@ typedef struct {
210210
#ifdef MINI_OP3
211211
#undef MINI_OP3
212212
#endif
213-
#define MINI_OP(a,b,dest,src1,src2) dest, src1, src2, ' ',
214-
#define MINI_OP3(a,b,dest,src1,src2,src3) dest, src1, src2, src3,
213+
#ifdef MINI_OP4
214+
#undef MINI_OP4
215+
#endif
216+
#define MINI_OP(a,b,dest,src1,src2) dest, src1, src2, ' ', ' ',
217+
#define MINI_OP3(a,b,dest,src1,src2,src3) dest, src1, src2, src3, ' ',
218+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) dest, src1, src2, src3, src4,
215219
#define NONE ' '
216220
#define IREG 'i'
217221
#define FREG 'f'
@@ -225,6 +229,7 @@ mini_llvm_ins_info[] = {
225229
};
226230
#undef MINI_OP
227231
#undef MINI_OP3
232+
#undef MINI_OP4
228233

229234
#if TARGET_SIZEOF_VOID_P == 4
230235
#define GET_LONG_IMM(ins) ((ins)->inst_l)

src/mono/mono/mini/mini.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,15 +717,15 @@ typedef struct {
717717
LLVMArgInfo args [1];
718718
} LLVMCallInfo;
719719

720-
#define MONO_MAX_SRC_REGS 3
720+
#define MONO_MAX_SRC_REGS 4
721721

722722
struct MonoInst {
723723
guint16 opcode;
724724
guint8 type; /* stack type */
725725
guint8 flags;
726726

727727
/* used by the register allocator */
728-
gint32 dreg, sreg1, sreg2, sreg3;
728+
gint32 dreg, sreg1, sreg2, sreg3, sreg4;
729729

730730
MonoInst *next, *prev;
731731

@@ -1728,15 +1728,20 @@ extern MonoJitStats mono_jit_stats;
17281728
#ifdef MINI_OP3
17291729
#undef MINI_OP3
17301730
#endif
1731+
#ifdef MINI_OP4
1732+
#undef MINI_OP4
1733+
#endif
17311734
#define MINI_OP(a,b,dest,src1,src2) a,
17321735
#define MINI_OP3(a,b,dest,src1,src2,src3) a,
1736+
#define MINI_OP4(a,b,dest,src1,src2,src3,src4) a,
17331737
enum {
17341738
OP_START = MONO_CEE_LAST - 1,
17351739
#include "mini-ops.h"
17361740
OP_LAST
17371741
};
17381742
#undef MINI_OP
17391743
#undef MINI_OP3
1744+
#undef MINI_OP4
17401745

17411746
#if TARGET_SIZEOF_VOID_P == 8
17421747
#define OP_PCONST OP_I8CONST

0 commit comments

Comments
 (0)