mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
199 lines
6.7 KiB
JavaScript
199 lines
6.7 KiB
JavaScript
function sign(input, output) {
|
|
return [input, output];
|
|
}
|
|
|
|
var u32 = "u32";
|
|
var i32 = "i32";
|
|
var i64 = "i64";
|
|
var f32 = "f32";
|
|
var f64 = "f64";
|
|
|
|
var vector = function vector(t) {
|
|
var vecType = [t]; // $FlowIgnore
|
|
|
|
vecType.vector = true;
|
|
return vecType;
|
|
};
|
|
|
|
var controlInstructions = {
|
|
unreachable: sign([], []),
|
|
nop: sign([], []),
|
|
// block ?
|
|
// loop ?
|
|
// if ?
|
|
// if else ?
|
|
br: sign([u32], []),
|
|
br_if: sign([u32], []),
|
|
br_table: sign(vector(u32), []),
|
|
return: sign([], []),
|
|
call: sign([u32], []),
|
|
call_indirect: sign([u32], [])
|
|
};
|
|
var parametricInstructions = {
|
|
drop: sign([], []),
|
|
select: sign([], [])
|
|
};
|
|
var variableInstructions = {
|
|
get_local: sign([u32], []),
|
|
set_local: sign([u32], []),
|
|
tee_local: sign([u32], []),
|
|
get_global: sign([u32], []),
|
|
set_global: sign([u32], [])
|
|
};
|
|
var memoryInstructions = {
|
|
"i32.load": sign([u32, u32], [i32]),
|
|
"i64.load": sign([u32, u32], []),
|
|
"f32.load": sign([u32, u32], []),
|
|
"f64.load": sign([u32, u32], []),
|
|
"i32.load8_s": sign([u32, u32], [i32]),
|
|
"i32.load8_u": sign([u32, u32], [i32]),
|
|
"i32.load16_s": sign([u32, u32], [i32]),
|
|
"i32.load16_u": sign([u32, u32], [i32]),
|
|
"i64.load8_s": sign([u32, u32], [i64]),
|
|
"i64.load8_u": sign([u32, u32], [i64]),
|
|
"i64.load16_s": sign([u32, u32], [i64]),
|
|
"i64.load16_u": sign([u32, u32], [i64]),
|
|
"i64.load32_s": sign([u32, u32], [i64]),
|
|
"i64.load32_u": sign([u32, u32], [i64]),
|
|
"i32.store": sign([u32, u32], []),
|
|
"i64.store": sign([u32, u32], []),
|
|
"f32.store": sign([u32, u32], []),
|
|
"f64.store": sign([u32, u32], []),
|
|
"i32.store8": sign([u32, u32], []),
|
|
"i32.store16": sign([u32, u32], []),
|
|
"i64.store8": sign([u32, u32], []),
|
|
"i64.store16": sign([u32, u32], []),
|
|
"i64.store32": sign([u32, u32], []),
|
|
current_memory: sign([], []),
|
|
grow_memory: sign([], [])
|
|
};
|
|
var numericInstructions = {
|
|
"i32.const": sign([i32], [i32]),
|
|
"i64.const": sign([i64], [i64]),
|
|
"f32.const": sign([f32], [f32]),
|
|
"f64.const": sign([f64], [f64]),
|
|
"i32.eqz": sign([i32], [i32]),
|
|
"i32.eq": sign([i32, i32], [i32]),
|
|
"i32.ne": sign([i32, i32], [i32]),
|
|
"i32.lt_s": sign([i32, i32], [i32]),
|
|
"i32.lt_u": sign([i32, i32], [i32]),
|
|
"i32.gt_s": sign([i32, i32], [i32]),
|
|
"i32.gt_u": sign([i32, i32], [i32]),
|
|
"i32.le_s": sign([i32, i32], [i32]),
|
|
"i32.le_u": sign([i32, i32], [i32]),
|
|
"i32.ge_s": sign([i32, i32], [i32]),
|
|
"i32.ge_u": sign([i32, i32], [i32]),
|
|
"i64.eqz": sign([i64], [i64]),
|
|
"i64.eq": sign([i64, i64], [i32]),
|
|
"i64.ne": sign([i64, i64], [i32]),
|
|
"i64.lt_s": sign([i64, i64], [i32]),
|
|
"i64.lt_u": sign([i64, i64], [i32]),
|
|
"i64.gt_s": sign([i64, i64], [i32]),
|
|
"i64.gt_u": sign([i64, i64], [i32]),
|
|
"i64.le_s": sign([i64, i64], [i32]),
|
|
"i64.le_u": sign([i64, i64], [i32]),
|
|
"i64.ge_s": sign([i64, i64], [i32]),
|
|
"i64.ge_u": sign([i64, i64], [i32]),
|
|
"f32.eq": sign([f32, f32], [i32]),
|
|
"f32.ne": sign([f32, f32], [i32]),
|
|
"f32.lt": sign([f32, f32], [i32]),
|
|
"f32.gt": sign([f32, f32], [i32]),
|
|
"f32.le": sign([f32, f32], [i32]),
|
|
"f32.ge": sign([f32, f32], [i32]),
|
|
"f64.eq": sign([f64, f64], [i32]),
|
|
"f64.ne": sign([f64, f64], [i32]),
|
|
"f64.lt": sign([f64, f64], [i32]),
|
|
"f64.gt": sign([f64, f64], [i32]),
|
|
"f64.le": sign([f64, f64], [i32]),
|
|
"f64.ge": sign([f64, f64], [i32]),
|
|
"i32.clz": sign([i32], [i32]),
|
|
"i32.ctz": sign([i32], [i32]),
|
|
"i32.popcnt": sign([i32], [i32]),
|
|
"i32.add": sign([i32, i32], [i32]),
|
|
"i32.sub": sign([i32, i32], [i32]),
|
|
"i32.mul": sign([i32, i32], [i32]),
|
|
"i32.div_s": sign([i32, i32], [i32]),
|
|
"i32.div_u": sign([i32, i32], [i32]),
|
|
"i32.rem_s": sign([i32, i32], [i32]),
|
|
"i32.rem_u": sign([i32, i32], [i32]),
|
|
"i32.and": sign([i32, i32], [i32]),
|
|
"i32.or": sign([i32, i32], [i32]),
|
|
"i32.xor": sign([i32, i32], [i32]),
|
|
"i32.shl": sign([i32, i32], [i32]),
|
|
"i32.shr_s": sign([i32, i32], [i32]),
|
|
"i32.shr_u": sign([i32, i32], [i32]),
|
|
"i32.rotl": sign([i32, i32], [i32]),
|
|
"i32.rotr": sign([i32, i32], [i32]),
|
|
"i64.clz": sign([i64], [i64]),
|
|
"i64.ctz": sign([i64], [i64]),
|
|
"i64.popcnt": sign([i64], [i64]),
|
|
"i64.add": sign([i64, i64], [i64]),
|
|
"i64.sub": sign([i64, i64], [i64]),
|
|
"i64.mul": sign([i64, i64], [i64]),
|
|
"i64.div_s": sign([i64, i64], [i64]),
|
|
"i64.div_u": sign([i64, i64], [i64]),
|
|
"i64.rem_s": sign([i64, i64], [i64]),
|
|
"i64.rem_u": sign([i64, i64], [i64]),
|
|
"i64.and": sign([i64, i64], [i64]),
|
|
"i64.or": sign([i64, i64], [i64]),
|
|
"i64.xor": sign([i64, i64], [i64]),
|
|
"i64.shl": sign([i64, i64], [i64]),
|
|
"i64.shr_s": sign([i64, i64], [i64]),
|
|
"i64.shr_u": sign([i64, i64], [i64]),
|
|
"i64.rotl": sign([i64, i64], [i64]),
|
|
"i64.rotr": sign([i64, i64], [i64]),
|
|
"f32.abs": sign([f32], [f32]),
|
|
"f32.neg": sign([f32], [f32]),
|
|
"f32.ceil": sign([f32], [f32]),
|
|
"f32.floor": sign([f32], [f32]),
|
|
"f32.trunc": sign([f32], [f32]),
|
|
"f32.nearest": sign([f32], [f32]),
|
|
"f32.sqrt": sign([f32], [f32]),
|
|
"f32.add": sign([f32, f32], [f32]),
|
|
"f32.sub": sign([f32, f32], [f32]),
|
|
"f32.mul": sign([f32, f32], [f32]),
|
|
"f32.div": sign([f32, f32], [f32]),
|
|
"f32.min": sign([f32, f32], [f32]),
|
|
"f32.max": sign([f32, f32], [f32]),
|
|
"f32.copysign": sign([f32, f32], [f32]),
|
|
"f64.abs": sign([f64], [f64]),
|
|
"f64.neg": sign([f64], [f64]),
|
|
"f64.ceil": sign([f64], [f64]),
|
|
"f64.floor": sign([f64], [f64]),
|
|
"f64.trunc": sign([f64], [f64]),
|
|
"f64.nearest": sign([f64], [f64]),
|
|
"f64.sqrt": sign([f64], [f64]),
|
|
"f64.add": sign([f64, f64], [f64]),
|
|
"f64.sub": sign([f64, f64], [f64]),
|
|
"f64.mul": sign([f64, f64], [f64]),
|
|
"f64.div": sign([f64, f64], [f64]),
|
|
"f64.min": sign([f64, f64], [f64]),
|
|
"f64.max": sign([f64, f64], [f64]),
|
|
"f64.copysign": sign([f64, f64], [f64]),
|
|
"i32.wrap/i64": sign([i64], [i32]),
|
|
"i32.trunc_s/f32": sign([f32], [i32]),
|
|
"i32.trunc_u/f32": sign([f32], [i32]),
|
|
"i32.trunc_s/f64": sign([f32], [i32]),
|
|
"i32.trunc_u/f64": sign([f64], [i32]),
|
|
"i64.extend_s/i32": sign([i32], [i64]),
|
|
"i64.extend_u/i32": sign([i32], [i64]),
|
|
"i64.trunc_s/f32": sign([f32], [i64]),
|
|
"i64.trunc_u/f32": sign([f32], [i64]),
|
|
"i64.trunc_s/f64": sign([f64], [i64]),
|
|
"i64.trunc_u/f64": sign([f64], [i64]),
|
|
"f32.convert_s/i32": sign([i32], [f32]),
|
|
"f32.convert_u/i32": sign([i32], [f32]),
|
|
"f32.convert_s/i64": sign([i64], [f32]),
|
|
"f32.convert_u/i64": sign([i64], [f32]),
|
|
"f32.demote/f64": sign([f64], [f32]),
|
|
"f64.convert_s/i32": sign([i32], [f64]),
|
|
"f64.convert_u/i32": sign([i32], [f64]),
|
|
"f64.convert_s/i64": sign([i64], [f64]),
|
|
"f64.convert_u/i64": sign([i64], [f64]),
|
|
"f64.promote/f32": sign([f32], [f64]),
|
|
"i32.reinterpret/f32": sign([f32], [i32]),
|
|
"i64.reinterpret/f64": sign([f64], [i64]),
|
|
"f32.reinterpret/i32": sign([i32], [f32]),
|
|
"f64.reinterpret/i64": sign([i64], [f64])
|
|
};
|
|
export var signatures = Object.assign({}, controlInstructions, parametricInstructions, variableInstructions, memoryInstructions, numericInstructions); |