1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
#pragma once
#include "Utils/Bitmask.h"
namespace code {
/**
* Declare all virtual op-codes.
*/
namespace op {
STORM_PKG(core.asm);
enum OpCode {
nop,
mov,
lea,
push,
pop,
pushFlags,
popFlags,
jmp,
call,
ret,
setCond,
fnParam,
fnParamRef,
fnCall,
fnCallRef,
fnRet,
fnRetRef,
STORM_NAME(bor, or),
STORM_NAME(band, and),
STORM_NAME(bxor, xor),
STORM_NAME(bnot, not),
test,
add,
adc,
sub,
sbb,
cmp,
mul,
idiv,
udiv,
imod,
umod,
shl,
shr,
sar,
swap,
icast,
ucast,
// Floating point.
fadd,
fsub,
fneg,
fmul,
fdiv,
fcmp,
ftoi,
ftou,
fcast, // float -> float
fcasti, // float -> int
fcastu, // float -> unsigned
icastf, // int -> float
ucastf, // unsigned -> float
// FP stack (to support calling convention on x86 in 32-bit mode).
fstp,
fld,
// Data
dat,
lblOffset,
align,
// Function prolog/epilog.
prolog,
epilog,
// A shadow mov instruction. Does not affect register usage etc.
// Can be used to save/restore registers without affecting dirty register allocation.
shadowMov,
// Note that a register has been preserved somewhere. Used to generate debugging information.
preserve,
// Source code reference, used for debug information or other transformations.
location,
// Other metadata. Does not emit any machine code.
meta,
// Blocks.
beginBlock,
endBlock,
// Jump to a location making sure to go to a particular block.
jmpBlock,
// Variable activation.
activate,
// Make the next memory operation work on the thread local storage.
threadLocal,
// Keep last
numOpCodes,
};
}
/**
* What is done to the 'dest' of the instructions?
*/
enum DestMode {
STORM_NAME(destNone, none) = 0x0,
STORM_NAME(destRead, read) = 0x1,
STORM_NAME(destWrite, write) = 0x2,
};
BITMASK_OPERATORS(DestMode);
const wchar *name(op::OpCode op);
DestMode destMode(op::OpCode op);
}
|