| 1 |
/****************************************************************************** |
|---|
| 2 |
License: |
|---|
| 3 |
Copyright (c) 2008 Jarrett Billingsley |
|---|
| 4 |
|
|---|
| 5 |
This software is provided 'as-is', without any express or implied warranty. |
|---|
| 6 |
In no event will the authors be held liable for any damages arising from the |
|---|
| 7 |
use of this software. |
|---|
| 8 |
|
|---|
| 9 |
Permission is granted to anyone to use this software for any purpose, |
|---|
| 10 |
including commercial applications, and to alter it and redistribute it freely, |
|---|
| 11 |
subject to the following restrictions: |
|---|
| 12 |
|
|---|
| 13 |
1. The origin of this software must not be misrepresented; you must not |
|---|
| 14 |
claim that you wrote the original software. If you use this software in a |
|---|
| 15 |
product, an acknowledgment in the product documentation would be |
|---|
| 16 |
appreciated but is not required. |
|---|
| 17 |
|
|---|
| 18 |
2. Altered source versions must be plainly marked as such, and must not |
|---|
| 19 |
be misrepresented as being the original software. |
|---|
| 20 |
|
|---|
| 21 |
3. This notice may not be removed or altered from any source distribution. |
|---|
| 22 |
******************************************************************************/ |
|---|
| 23 |
|
|---|
| 24 |
module minid.opcodes; |
|---|
| 25 |
|
|---|
| 26 |
import tango.text.convert.Format; |
|---|
| 27 |
|
|---|
| 28 |
const uint MaxRegisters = Instruction.rsMax; |
|---|
| 29 |
const uint MaxConstants = Instruction.rsMax; |
|---|
| 30 |
const uint MaxUpvalues = Instruction.rsMax; |
|---|
| 31 |
|
|---|
| 32 |
enum Op : ushort |
|---|
| 33 |
{ |
|---|
| 34 |
Add, |
|---|
| 35 |
AddEq, |
|---|
| 36 |
And, |
|---|
| 37 |
AndEq, |
|---|
| 38 |
Append, |
|---|
| 39 |
As, |
|---|
| 40 |
Call, |
|---|
| 41 |
Cat, |
|---|
| 42 |
CatEq, |
|---|
| 43 |
CheckObjParam, |
|---|
| 44 |
CheckParams, |
|---|
| 45 |
Class, |
|---|
| 46 |
Close, |
|---|
| 47 |
Closure, |
|---|
| 48 |
CondMove, |
|---|
| 49 |
Coroutine, |
|---|
| 50 |
Cmp, |
|---|
| 51 |
Cmp3, |
|---|
| 52 |
Com, |
|---|
| 53 |
Dec, |
|---|
| 54 |
Div, |
|---|
| 55 |
DivEq, |
|---|
| 56 |
EndFinal, |
|---|
| 57 |
Equals, |
|---|
| 58 |
Field, |
|---|
| 59 |
FieldAssign, |
|---|
| 60 |
For, |
|---|
| 61 |
Foreach, |
|---|
| 62 |
ForLoop, |
|---|
| 63 |
Import, |
|---|
| 64 |
In, |
|---|
| 65 |
Inc, |
|---|
| 66 |
Index, |
|---|
| 67 |
IndexAssign, |
|---|
| 68 |
Is, |
|---|
| 69 |
IsTrue, |
|---|
| 70 |
Je, |
|---|
| 71 |
Jle, |
|---|
| 72 |
Jlt, |
|---|
| 73 |
Jmp, |
|---|
| 74 |
Length, |
|---|
| 75 |
LengthAssign, |
|---|
| 76 |
LoadBool, |
|---|
| 77 |
LoadConst, |
|---|
| 78 |
LoadNull, |
|---|
| 79 |
LoadNulls, |
|---|
| 80 |
Method, |
|---|
| 81 |
MethodNC, |
|---|
| 82 |
Mod, |
|---|
| 83 |
ModEq, |
|---|
| 84 |
Move, |
|---|
| 85 |
MoveLocal, |
|---|
| 86 |
Mul, |
|---|
| 87 |
MulEq, |
|---|
| 88 |
Namespace, |
|---|
| 89 |
NamespaceNP, |
|---|
| 90 |
Neg, |
|---|
| 91 |
NewArray, |
|---|
| 92 |
NewGlobal, |
|---|
| 93 |
NewTable, |
|---|
| 94 |
Not, |
|---|
| 95 |
NotIn, |
|---|
| 96 |
ObjParamFail, |
|---|
| 97 |
Or, |
|---|
| 98 |
OrEq, |
|---|
| 99 |
PopCatch, |
|---|
| 100 |
PopFinally, |
|---|
| 101 |
PushCatch, |
|---|
| 102 |
PushFinally, |
|---|
| 103 |
Ret, |
|---|
| 104 |
SetArray, |
|---|
| 105 |
SetEnv, |
|---|
| 106 |
Shl, |
|---|
| 107 |
ShlEq, |
|---|
| 108 |
Shr, |
|---|
| 109 |
ShrEq, |
|---|
| 110 |
Slice, |
|---|
| 111 |
SliceAssign, |
|---|
| 112 |
Sub, |
|---|
| 113 |
SubEq, |
|---|
| 114 |
SuperMethod, |
|---|
| 115 |
SuperOf, |
|---|
| 116 |
Switch, |
|---|
| 117 |
SwitchCmp, |
|---|
| 118 |
Tailcall, |
|---|
| 119 |
Throw, |
|---|
| 120 |
UShr, |
|---|
| 121 |
UShrEq, |
|---|
| 122 |
Vararg, |
|---|
| 123 |
VargIndex, |
|---|
| 124 |
VargIndexAssign, |
|---|
| 125 |
VargLen, |
|---|
| 126 |
VargSlice, |
|---|
| 127 |
Xor, |
|---|
| 128 |
XorEq, |
|---|
| 129 |
Yield |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
// Make sure we don't add too many instructions! |
|---|
| 133 |
static assert(Op.max <= Instruction.opcodeMax); |
|---|
| 134 |
|
|---|
| 135 |
/* |
|---|
| 136 |
Add...............R: dest, src, src |
|---|
| 137 |
AddEq.............R: dest, src, n/a |
|---|
| 138 |
And...............R: dest, src, src |
|---|
| 139 |
AndEq.............R: dest, src, n/a |
|---|
| 140 |
Append............R: dest, src, n/a |
|---|
| 141 |
As................R: dest, src, src class |
|---|
| 142 |
Call..............R: register of func, num params + 1, num results + 1 (both, 0 = use all to end of stack) |
|---|
| 143 |
Cat...............R: dest, src, num values (NOT variadic) |
|---|
| 144 |
CatEq.............R: dest, src, num values (NOT variadic) |
|---|
| 145 |
CheckObjParam.....R: dest, index of parameter, object type |
|---|
| 146 |
CheckParams.......I: n/a, n/a |
|---|
| 147 |
Class.............R: dest, name const index, base class |
|---|
| 148 |
Close.............I: reg start, n/a |
|---|
| 149 |
Closure...........R: dest, index of funcdef, environment (0 = use current function's environment) |
|---|
| 150 |
CondMove..........R: dest, src, n/a |
|---|
| 151 |
Coroutine.........R: dest, src, n/a |
|---|
| 152 |
Cmp...............R: n/a, src, src |
|---|
| 153 |
Cmp3..............R: dest, src, src |
|---|
| 154 |
Com...............R: dest, src, n/a |
|---|
| 155 |
Dec...............R: dest, n/a, n/a |
|---|
| 156 |
Div...............R: dest, src, src |
|---|
| 157 |
DivEq.............R: dest, src, n/a |
|---|
| 158 |
EndFinal..........I: n/a, n/a |
|---|
| 159 |
Equals............R: n/a, src, src |
|---|
| 160 |
Field.............R: dest, src, index |
|---|
| 161 |
FieldAssign.......R: dest, index, src |
|---|
| 162 |
For...............J: base reg, branch offset |
|---|
| 163 |
Foreach...........I: base reg, num indices |
|---|
| 164 |
ForLoop...........J: base reg, branch offset |
|---|
| 165 |
Import............R: dest, name src, n/a |
|---|
| 166 |
In................R: dest, src value, src object |
|---|
| 167 |
Inc...............R: dest, n/a, n/a |
|---|
| 168 |
Index.............R: dest, src object, src index |
|---|
| 169 |
IndexAssign.......R: dest object, dest index, src |
|---|
| 170 |
Is................R: n/a, src, src |
|---|
| 171 |
IsTrue............R: n/a, src, n/a |
|---|
| 172 |
Je................J: isTrue, branch offset |
|---|
| 173 |
Jle...............J: isTrue, branch offset |
|---|
| 174 |
Jlt...............J: isTrue, branch offset |
|---|
| 175 |
Jmp...............J: 1 = jump / 0 = don't (nop), branch offset |
|---|
| 176 |
Length............R: dest, src, n/a |
|---|
| 177 |
LengthAssign......R: dest, src, n/a |
|---|
| 178 |
LoadBool..........R: dest, 1/0, n/a |
|---|
| 179 |
LoadConst.........R: dest local, src const, n/a |
|---|
| 180 |
LoadNull..........I: dest, n/a |
|---|
| 181 |
LoadNulls.........I: dest, num regs |
|---|
| 182 |
Method............R: base reg, object to index, method name |
|---|
| 183 |
MethodNC..........R: base reg, object to index, method name |
|---|
| 184 |
Mod...............R: dest, src, src |
|---|
| 185 |
ModEq.............R: dest, src, n/a |
|---|
| 186 |
Move..............R: dest, src, n/a |
|---|
| 187 |
MoveLocal.........R: dest local, src local, n/a |
|---|
| 188 |
Mul...............R: dest, src, src |
|---|
| 189 |
MulEq.............R: dest, src, n/a |
|---|
| 190 |
Namespace.........R: dest, name const index, parent namespace |
|---|
| 191 |
NamespaceNP.......R: dest, name const index, n/a |
|---|
| 192 |
Neg...............R: dest, src, n/a |
|---|
| 193 |
NewArray..........I: dest, size |
|---|
| 194 |
NewGlobal.........R: n/a, src, const index of global name |
|---|
| 195 |
NewTable..........I: dest, n/a |
|---|
| 196 |
Not...............R: dest, src, n/a |
|---|
| 197 |
NotIn.............R: dest, src value, src object |
|---|
| 198 |
ObjParamFail......R: n/a, src, n/a |
|---|
| 199 |
Or................R: dest, src, src |
|---|
| 200 |
OrEq..............R: dest, src, n/a |
|---|
| 201 |
PopCatch..........I: n/a, n/a |
|---|
| 202 |
PopFinally........I: n/a, n/a |
|---|
| 203 |
PushCatch.........J: exception reg, branch offset |
|---|
| 204 |
PushFinally.......J: n/a, branch offset |
|---|
| 205 |
Ret...............I: base reg, num rets + 1 (0 = return all to end of stack) |
|---|
| 206 |
SetArray..........R: dest, num fields + 1 (0 = set all to end of stack), block offset |
|---|
| 207 |
SetEnv............R: dest, src, n/a |
|---|
| 208 |
Shl...............R: dest, src, src |
|---|
| 209 |
ShlEq.............R: dest, src, n/a |
|---|
| 210 |
Shr...............R: dest, src, src |
|---|
| 211 |
ShrEq.............R: dest, src, n/a |
|---|
| 212 |
Slice.............R: dest, src, n/a (indices are at src + 1 and src + 2) |
|---|
| 213 |
SliceAssign.......R: dest, src, n/a (indices are at dest + 1 and dest + 2) |
|---|
| 214 |
Sub...............R: dest, src, src |
|---|
| 215 |
SubEq.............R: dest, src, n/a |
|---|
| 216 |
SuperMethod.......R: base reg, object to index, method name |
|---|
| 217 |
SuperOf...........R: dest, src, n/a |
|---|
| 218 |
Switch............R: n/a, src, index of switch table |
|---|
| 219 |
SwitchCmp.........R: n/a, src, src |
|---|
| 220 |
Tailcall..........R: Register of func, num params + 1, n/a (0 params = use all to end of stack) |
|---|
| 221 |
Throw.............R: n/a, src, n/a |
|---|
| 222 |
UShr..............R: dest, src, src |
|---|
| 223 |
UShrEq............R: dest, src, n/a |
|---|
| 224 |
Vararg............I: base reg, num rets + 1 (0 = return all to end of stack) |
|---|
| 225 |
VargIndex.........R: dest, idx, n/a |
|---|
| 226 |
VargIndexAssign...R: n/a, idx, src |
|---|
| 227 |
VargLen...........R: dest, n/a, n/a |
|---|
| 228 |
VargSlice.........I: base reg, num rets + 1 (0 = return all to end of stack; indices are at base reg and base reg + 1) |
|---|
| 229 |
Xor...............R: dest, src, src |
|---|
| 230 |
XorEq.............R: dest, src, n/a |
|---|
| 231 |
Yield.............R: register of first yielded value, num values + 1, num results + 1 (both, 0 = to end of stack) |
|---|
| 232 |
*/ |
|---|
| 233 |
|
|---|
| 234 |
template Mask(uint length) |
|---|
| 235 |
{ |
|---|
| 236 |
const uint Mask = (1 << length) - 1; |
|---|
| 237 |
} |
|---|
| 238 |
|
|---|
| 239 |
align(1) struct Instruction |
|---|
| 240 |
{ |
|---|
| 241 |
const uint locMaskSize = 2; |
|---|
| 242 |
const uint locMask = Mask!(locMaskSize) << (16 - locMaskSize); |
|---|
| 243 |
|
|---|
| 244 |
const uint locLocal = 0; |
|---|
| 245 |
const uint locConst = 0b01 << (16 - locMaskSize); |
|---|
| 246 |
const uint locUpval = 0b10 << (16 - locMaskSize); |
|---|
| 247 |
const uint locGlobal = 0b11 << (16 - locMaskSize); |
|---|
| 248 |
|
|---|
| 249 |
const uint opcodeSize = 16; |
|---|
| 250 |
const uint opcodeMax = (1 << opcodeSize) - 1; |
|---|
| 251 |
|
|---|
| 252 |
const uint rdSize = 16; |
|---|
| 253 |
const uint rdMax = (1 << (rdSize - locMaskSize)) - 1; |
|---|
| 254 |
|
|---|
| 255 |
const uint rsSize = 16; |
|---|
| 256 |
const uint rsMax = (1 << (rsSize - locMaskSize)) - 1; |
|---|
| 257 |
|
|---|
| 258 |
const uint rtSize = 16; |
|---|
| 259 |
const uint rtMax = (1 << (rtSize - locMaskSize)) - 1; |
|---|
| 260 |
|
|---|
| 261 |
const uint immSize = rsSize + rtSize; |
|---|
| 262 |
const uint immMax = (1 << immSize) - 1; |
|---|
| 263 |
|
|---|
| 264 |
const uint arraySetFields = 30; |
|---|
| 265 |
|
|---|
| 266 |
Op opcode; |
|---|
| 267 |
ushort rd; |
|---|
| 268 |
|
|---|
| 269 |
union |
|---|
| 270 |
{ |
|---|
| 271 |
struct |
|---|
| 272 |
{ |
|---|
| 273 |
ushort rs; |
|---|
| 274 |
ushort rt; |
|---|
| 275 |
} |
|---|
| 276 |
|
|---|
| 277 |
uint uimm; |
|---|
| 278 |
int imm; |
|---|
| 279 |
} |
|---|
| 280 |
|
|---|
| 281 |
char[] toString() |
|---|
| 282 |
{ |
|---|
| 283 |
char[] cr(uint v) |
|---|
| 284 |
{ |
|---|
| 285 |
uint loc = v & locMask; |
|---|
| 286 |
uint val = v & ~locMask; |
|---|
| 287 |
|
|---|
| 288 |
if(loc == locLocal) |
|---|
| 289 |
return Format("r{}", val); |
|---|
| 290 |
else if(loc == locConst) |
|---|
| 291 |
return Format("c{}", val); |
|---|
| 292 |
else if(loc == locUpval) |
|---|
| 293 |
return Format("u{}", val); |
|---|
| 294 |
else |
|---|
| 295 |
return Format("g{}", val); |
|---|
| 296 |
} |
|---|
| 297 |
|
|---|
| 298 |
switch(opcode) |
|---|
| 299 |
{ |
|---|
| 300 |
case Op.Add: return Format("add {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 301 |
case Op.AddEq: return Format("addeq {}, {}", cr(rd), cr(rs)); |
|---|
| 302 |
case Op.And: return Format("and {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 303 |
case Op.AndEq: return Format("andeq {}, {}", cr(rd), cr(rs)); |
|---|
| 304 |
case Op.Append: return Format("append {}, {}", cr(rd), cr(rs)); |
|---|
| 305 |
case Op.As: return Format("as {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 306 |
case Op.Call: return Format("call r{}, {}, {}", rd, rs, rt); |
|---|
| 307 |
case Op.Cat: return Format("cat {}, r{}, {}", cr(rd), rs, rt); |
|---|
| 308 |
case Op.CatEq: return Format("cateq {}, r{}, {}", cr(rd), rs, rt); |
|---|
| 309 |
case Op.CheckObjParam: return Format("checkobjparm r{}, r{}, {}", rd, rs, cr(rt)); |
|---|
| 310 |
case Op.CheckParams: return "checkparams"; |
|---|
| 311 |
case Op.Class: return Format("class {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 312 |
case Op.Close: return Format("close r{}", rd); |
|---|
| 313 |
case Op.Closure: return rt == 0 ? Format("closure {}, {}", cr(rd), rs) : Format("closure {}, {}, r{}", cr(rd), rs, rt); |
|---|
| 314 |
case Op.CondMove: return Format("cmov {}, {}", cr(rd), cr(rs)); |
|---|
| 315 |
case Op.Coroutine: return Format("coroutine {}, {}", cr(rd), cr(rs)); |
|---|
| 316 |
case Op.Cmp: return Format("cmp {}, {}", cr(rs), cr(rt)); |
|---|
| 317 |
case Op.Cmp3: return Format("cmp3 {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 318 |
case Op.Com: return Format("com {}, {}", cr(rd), cr(rs)); |
|---|
| 319 |
case Op.Dec: return Format("dec {}", cr(rd)); |
|---|
| 320 |
case Op.Div: return Format("div {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 321 |
case Op.DivEq: return Format("diveq {}, {}", cr(rd), cr(rs)); |
|---|
| 322 |
case Op.EndFinal: return "endfinal"; |
|---|
| 323 |
case Op.Equals: return Format("equals {}, {}", cr(rs), cr(rt)); |
|---|
| 324 |
case Op.Field: return Format("field {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 325 |
case Op.FieldAssign: return Format("fielda {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 326 |
case Op.For: return Format("for {}, {}", cr(rd), imm); |
|---|
| 327 |
case Op.Foreach: return Format("foreach r{}, {}", rd, uimm); |
|---|
| 328 |
case Op.ForLoop: return Format("forloop {}, {}", cr(rd), imm); |
|---|
| 329 |
case Op.Import: return Format("import r{}, {}", rd, cr(rs)); |
|---|
| 330 |
case Op.In: return Format("in {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 331 |
case Op.Inc: return Format("inc {}", cr(rd)); |
|---|
| 332 |
case Op.Index: return Format("idx {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 333 |
case Op.IndexAssign: return Format("idxa {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 334 |
case Op.Is: return Format("is {}, {}", cr(rs), cr(rt)); |
|---|
| 335 |
case Op.IsTrue: return Format("istrue {}", cr(rs)); |
|---|
| 336 |
case Op.Je: return Format((rd == 0) ? "jne {}" : "je {}", imm); |
|---|
| 337 |
case Op.Jle: return Format((rd == 0) ? "jgt {}" : "jle {}", imm); |
|---|
| 338 |
case Op.Jlt: return Format((rd == 0) ? "jge {}" : "jlt {}", imm); |
|---|
| 339 |
case Op.Jmp: return (rd == 0) ? "nop" : Format("jmp {}", imm); |
|---|
| 340 |
case Op.Length: return Format("len {}, {}", cr(rd), cr(rs)); |
|---|
| 341 |
case Op.LengthAssign: return Format("lena {}, {}", cr(rd), cr(rs)); |
|---|
| 342 |
case Op.LoadBool: return Format("lb {}, {}", cr(rd), rs); |
|---|
| 343 |
case Op.LoadConst: return Format("lc {}, {}", cr(rd), cr(rs)); |
|---|
| 344 |
case Op.LoadNull: return Format("lnull {}", cr(rd)); |
|---|
| 345 |
case Op.LoadNulls: return Format("lnulls r{}, {}", rd, uimm); |
|---|
| 346 |
case Op.Method: return Format("method r{}, {}, {}", rd, cr(rs), cr(rt)); |
|---|
| 347 |
case Op.MethodNC: return Format("methodnc r{}, {}, {}", rd, cr(rs), cr(rt)); |
|---|
| 348 |
case Op.Mod: return Format("mod {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 349 |
case Op.ModEq: return Format("modeq {}, {}", cr(rd), cr(rs)); |
|---|
| 350 |
case Op.Move: return Format("mov {}, {}", cr(rd), cr(rs)); |
|---|
| 351 |
case Op.MoveLocal: return Format("movl {}, {}", cr(rd), cr(rs)); |
|---|
| 352 |
case Op.Mul: return Format("mul {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 353 |
case Op.MulEq: return Format("muleq {}, {}", cr(rd), cr(rs)); |
|---|
| 354 |
case Op.Namespace: return Format("namespace {}, c{}, {}", cr(rd), rs, cr(rt)); |
|---|
| 355 |
case Op.NamespaceNP: return Format("namespacenp {}, c{}", cr(rd), rs); |
|---|
| 356 |
case Op.Neg: return Format("neg {}, {}", cr(rd), cr(rs)); |
|---|
| 357 |
case Op.NewArray: return Format("newarr r{}, {}", rd, imm); |
|---|
| 358 |
case Op.NewGlobal: return Format("newg {}, {}", cr(rs), cr(rt)); |
|---|
| 359 |
case Op.NewTable: return Format("newtab r{}", rd); |
|---|
| 360 |
case Op.Not: return Format("not {}, {}", cr(rd), cr(rs)); |
|---|
| 361 |
case Op.NotIn: return Format("notin {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 362 |
case Op.ObjParamFail: return Format("objparamfail {}", cr(rs)); |
|---|
| 363 |
case Op.Or: return Format("or {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 364 |
case Op.OrEq: return Format("oreq {}, {}", cr(rd), cr(rs)); |
|---|
| 365 |
case Op.PopCatch: return "popcatch"; |
|---|
| 366 |
case Op.PopFinally: return "popfinally"; |
|---|
| 367 |
case Op.PushCatch: return Format("pushcatch r{}, {}", rd, imm); |
|---|
| 368 |
case Op.PushFinally: return Format("pushfinal {}", imm); |
|---|
| 369 |
case Op.Ret: return Format("ret r{}, {}", rd, uimm); |
|---|
| 370 |
case Op.SetArray: return Format("setarray r{}, {}, block {}", rd, rs, rt); |
|---|
| 371 |
case Op.SetEnv: return Format("setenv {}, {}", cr(rd), cr(rs)); |
|---|
| 372 |
case Op.Shl: return Format("shl {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 373 |
case Op.ShlEq: return Format("shleq {}, {}", cr(rd), cr(rs)); |
|---|
| 374 |
case Op.Shr: return Format("shr {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 375 |
case Op.ShrEq: return Format("shreq {}, {}", cr(rd), cr(rs)); |
|---|
| 376 |
case Op.Slice: return Format("slice {}, r{}", cr(rd), rs); |
|---|
| 377 |
case Op.SliceAssign: return Format("slicea r{}, {}", rd, cr(rs)); |
|---|
| 378 |
case Op.Sub: return Format("sub {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 379 |
case Op.SubEq: return Format("subeq {}, {}", cr(rd), cr(rs)); |
|---|
| 380 |
case Op.SuperMethod: return Format("smethod r{}, {}, {}", rd, cr(rs), cr(rt)); |
|---|
| 381 |
case Op.SuperOf: return Format("superof {}, {}", cr(rd), cr(rs)); |
|---|
| 382 |
case Op.Switch: return Format("switch {}, {}", cr(rs), rt); |
|---|
| 383 |
case Op.SwitchCmp: return Format("swcmp {}, {}", cr(rs), cr(rt)); |
|---|
| 384 |
case Op.Tailcall: return Format("tcall r{}, {}", rd, rs); |
|---|
| 385 |
case Op.Throw: return Format("throw {}", cr(rs)); |
|---|
| 386 |
case Op.UShr: return Format("ushr {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 387 |
case Op.UShrEq: return Format("ushreq {}, {}", cr(rd), cr(rs)); |
|---|
| 388 |
case Op.Vararg: return Format("varg r{}, {}", rd, uimm); |
|---|
| 389 |
case Op.VargIndex: return Format("vargidx {}, {}", cr(rd), cr(rs)); |
|---|
| 390 |
case Op.VargIndexAssign: return Format("vargidxa {}, {}", cr(rd), cr(rs)); |
|---|
| 391 |
case Op.VargLen: return Format("varglen {}", cr(rd)); |
|---|
| 392 |
case Op.VargSlice: return Format("vargslice r{}, {}", rd, uimm); |
|---|
| 393 |
case Op.Xor: return Format("xor {}, {}, {}", cr(rd), cr(rs), cr(rt)); |
|---|
| 394 |
case Op.XorEq: return Format("xoreq {}, {}", cr(rd), cr(rs)); |
|---|
| 395 |
case Op.Yield: return Format("yield r{}, {}, {}", rd, rs, rt); |
|---|
| 396 |
default: return Format("??? opcode = {}", opcode); |
|---|
| 397 |
} |
|---|
| 398 |
} |
|---|
| 399 |
|
|---|
| 400 |
private const bool SerializeAsChunk = true; |
|---|
| 401 |
} |
|---|
| 402 |
|
|---|
| 403 |
static assert(Instruction.sizeof == 8); |
|---|