Skip to content

Instruction Set

Nick Pope edited this page Jun 19, 2013 · 26 revisions

Virtual Machine Instruction Set

NID Manipulations

add

Add two numeric NIDs together and put result into dest, or add one value to dest.

add $<dest> [$]<a> [$]<b>

add $<dest> [$]<value>

sub

Subtract two numeric NIDs (b from a) and put result into dest.

sub $<dest> [$]<a> [$]<b>

sub $<dest> [$]<value>

div

div $<dest> [$]<a> [$]<b>

div $<dest> [$]<value>

mul

mul $<dest> [$]<a> [$]<b>

mul $<dest> [$]<value>

shl

Shift value left by n bits and put into dest.

shl $<dest> [$]<value> [$]<n>

shl $<dest> [$]<n>

shr

Shift value right by n bits and put into dest.

shr $<dest> [$]<value> [$]<n>

shr $<dest> [$]<n>

and

and $<dest> [$]<a> [$]<b>

and $<dest> [$]<value>

or

or $<dest> [$]<a> [$]<b>

or $<dest> [$]<value>

xor

xor $<dest> [$]<a> [$]<b>

xor $<dest> [$]<value>

neg

neg $<dest> [$]<value>

neg $<dest>

inc

inc $<value>

dec

dec $<value>

clr

Sets value to null.

clr $<value>

int

Convert value to an integer and put into dest.

int $<dest> [$]<value>

int $<dest>

flt

Convert value to a float and put into dest.

flt $<dest> [$]<value>

flt $<dest>

Data

cpy

Copy a value from source into dest.

cpy $<dest> [$]<source>

const

const <NAME> <value>

ret

Return value.

ret [$]<value>

Branching

jump

jmp :<label>

jeq

jeq :<label> [$]<a> [$]<b>

jne

jne :<label> [$]<a> [$]<b>

jle

jle :<label> [$]<a> [$]<b>

jge

jge :<label> [$]<a> [$]<b>

jlt

jlt :<label> [$]<a> [$]<b>

jgt

jgt :<label> [$]<a> [$]<b>

Hypergraph Access

get

Read a single value from the t1 t2 HARC into dest.

get $<dest> [$]<t1> [$]<t2>

def

Define the HARC t1 t2 as value. The value may be a constant or definition.

def [$]<t1> [$]<t2> [$]<value>

dep

Add a dependency where a1 a2 depends upon b1 b2. dep [$]<a1> [$]<a2> [$]<b1> [$]<b2>

new

Create a new NID in dest which matches the kind NID.

new $<dest> [$]<kind>

new $<dest>

del

Delete the HARC t1 t2.

del [$]<t1> [$]<t2>

High Level

path

Follow a path through the graph, starting at element and putting the result into dest. Elements may be repeated any number of times and are separated by dots. The pathd form also adds dependencies to the HARC whose definition this corresponds to ($t1 and $t2).

path $<dest> [$]<element>[.]*

pathd $<dest> [$]<element>[.]*

clone

sclone

dclone

jisa

jisa :<label> [$]<value> [$]<pattern>

jisnt

Clone this wiki locally