# THE POSSIBILITY OF SUCH DAMAGE.
require "config"
+require "set"
# Interesting invariant, which we take advantage of: branching instructions
# always begin with "b", and no non-branching instructions begin with "b".
"tqs",
"tqz",
"tqnz",
- "peekq",
- "pokeq",
"bqeq",
"bqneq",
"bqa",
"bnz",
"leai",
"leap",
+ "pushCalleeSaves",
+ "popCalleeSaves",
+ "memfence"
]
X86_INSTRUCTIONS =
[
"cdqi",
- "idivi",
- "resetX87Stack"
+ "idivi"
+ ]
+
+ARM_INSTRUCTIONS =
+ [
+ "clrbp",
+ "mvlbl"
+ ]
+
+ARM64_INSTRUCTIONS =
+ [
+ "pcrtoaddr", # Address from PC relative offset - adr instruction
+ "popLRAndFP", # ARM64 requires registers to be pushed and popped in pairs,
+ "pushLRAndFP" # therefore we do LR (link register) and FP (frame pointer) together.
]
RISC_INSTRUCTIONS =
SH4_INSTRUCTIONS =
[
+ "flushcp",
+ "alignformova",
+ "mova",
"shllx",
"shlrx",
"shld",
"storedReversedAndDecrementAddress",
"ldspr",
"stspr",
- "callf",
- "jmpf"
+ "setargs"
]
CXX_INSTRUCTIONS =
[
- "cloopCrash", # no operands
- "cloopCallJSFunction", # operands: callee
- "cloopCallNative", # operands: callee
- "cloopCallSlowPath", # operands: callTarget, currentFrame, currentPC
+ "cloopCrash", # no operands
+ "cloopCallJSFunction", # operands: callee
+ "cloopCallNative", # operands: callee
+ "cloopCallSlowPath", # operands: callTarget, currentFrame, currentPC
+ "cloopCallSlowPathVoid", # operands: callTarget, currentFrame, currentPC
# For debugging only:
# Takes no operands but simply emits whatever follows in // comments as
"cloopDo", # no operands
]
-INSTRUCTIONS = MACRO_INSTRUCTIONS + X86_INSTRUCTIONS + RISC_INSTRUCTIONS + MIPS_INSTRUCTIONS + SH4_INSTRUCTIONS + CXX_INSTRUCTIONS
+INSTRUCTIONS = MACRO_INSTRUCTIONS + X86_INSTRUCTIONS + ARM_INSTRUCTIONS + ARM64_INSTRUCTIONS + RISC_INSTRUCTIONS + MIPS_INSTRUCTIONS + SH4_INSTRUCTIONS + CXX_INSTRUCTIONS
-INSTRUCTION_PATTERN = Regexp.new('\\A((' + INSTRUCTIONS.join(')|(') + '))\\Z')
+INSTRUCTION_SET = INSTRUCTIONS.to_set
def isBranch(instruction)
instruction =~ /^b/