Skip to content

Commit

Permalink
[EraVM][AsmParser] Migrate to new asm syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
atrosinenko authored and PavelKopyl committed Aug 7, 2024
1 parent c67241c commit 52aa478
Show file tree
Hide file tree
Showing 89 changed files with 1,736 additions and 1,647 deletions.
60 changes: 30 additions & 30 deletions lld/test/ELF/eravm-code-reloc.s
Original file line number Diff line number Diff line change
Expand Up @@ -66,51 +66,51 @@ foo_local:
.type caller_g,@function
.globl caller_g
caller_g:
near_call r1, @foo, @handler
far_call r3, r4, @foo
call r1, @foo, @handler
callf r3, r4, @foo
add @.OUTLINED_FUNCTION_RET0, r0, stack-[1]
jump @foo_local
.OUTLINED_FUNCTION_RET0:
jump @label
ret.ok.to_label r1, @label
ret.revert.to_label r1, @label
ret.panic.to_label @label
retl r1, @label
revl r1, @label
pncl @label
.globl label
label:
jump code[@jump_table + 1]
ret
; INPUT-LABEL: <caller_g>:
; INPUT-NEXT: 00 00 00 00 00 01 04 0f near_call r1, 0, 0
; INPUT-NEXT: 00 00 00 00 00 01 04 0f call r1, 0, 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 handler
; INPUT-NEXT: R_ERAVM_16_SCALE_8 foo
; INPUT-NEXT: 00 00 00 00 00 43 04 21 far_call r3, r4, 0
; INPUT-NEXT: 00 00 00 00 00 43 04 21 callf r3, r4, 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 foo
; INPUT-NEXT: 00 01 00 00 00 00 00 3d add 0, r0, stack-[1 + r0]
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0x40
; INPUT-NEXT: 00 00 00 00 00 00 01 3d jump 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0x18
; INPUT-NEXT: 00 00 00 00 00 00 01 3d jump 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 label
; INPUT-NEXT: 00 00 00 00 00 01 04 2e ret.ok.to_label r1, 0
; INPUT-NEXT: 00 00 00 00 00 01 04 2e retl 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 label
; INPUT-NEXT: 00 00 00 00 00 01 04 30 ret.revert.to_label r1, 0
; INPUT-NEXT: 00 00 00 00 00 01 04 30 revl 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 label
; INPUT-NEXT: 00 00 00 00 00 00 04 32 ret.panic.to_label 0
; INPUT-NEXT: 00 00 00 00 00 00 04 32 pncl 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 label
; INPUT-LABEL: <label>:
; INPUT-NEXT: 00 00 00 01 00 00 01 3e jump code[1]
; INPUT-NEXT: R_ERAVM_16_SCALE_32 jump_table
; INPUT-NEXT: 00 00 00 00 00 01 04 2d ret

; OUTPUT-LABEL: <caller_g>:
; OUTPUT-NEXT: 00 12 00 13 00 01 04 0f near_call r1, 19, 18
; OUTPUT-NEXT: 00 00 00 13 00 43 04 21 far_call r3, r4, 19
; OUTPUT-NEXT: 00 12 00 13 00 01 04 0f call r1, 19, 18
; OUTPUT-NEXT: 00 00 00 13 00 43 04 21 callf r3, r4, 19
; OUTPUT-NEXT: 00 01 00 18 00 00 00 3d add 24, r0, stack-[1 + r0]
; OUTPUT-NEXT: 00 00 00 13 00 00 01 3d jump 19
; OUTPUT-NEXT: 00 00 00 1c 00 00 01 3d jump 28
; OUTPUT-NEXT: 00 00 00 1c 00 01 04 2e ret.ok.to_label r1, 28
; OUTPUT-NEXT: 00 00 00 1c 00 01 04 30 ret.revert.to_label r1, 28
; OUTPUT-NEXT: 00 00 00 1c 00 00 04 32 ret.panic.to_label 28
; OUTPUT-NEXT: 00 00 00 1c 00 01 04 2e retl 28
; OUTPUT-NEXT: 00 00 00 1c 00 01 04 30 revl 28
; OUTPUT-NEXT: 00 00 00 1c 00 00 04 32 pncl 28
; OUTPUT-LABEL: <label>:
; OUTPUT-NEXT: 00 00 00 02 00 00 01 3e jump code[2]
; OUTPUT-NEXT: 00 00 00 00 00 01 04 2d ret
Expand All @@ -119,43 +119,43 @@ label:
.type caller_l,@function
.globl caller_l
caller_l:
near_call r1, @foo_local, @handler_local
far_call r3, r4, @foo_local
call r1, @foo_local, @handler_local
callf r3, r4, @foo_local
jump @label_local
ret.ok.to_label r1, @label_local
ret.revert.to_label r1, @label_local
ret.panic.to_label @label_local
retl r1, @label_local
revl r1, @label_local
pncl @label_local
.local label_local
label_local:
jump code[@jump_table_local + 1]
ret

; INPUT-LABEL: <caller_l>:
; INPUT-NEXT: 00 00 00 00 00 01 04 0f near_call r1, 0, 0
; INPUT-NEXT: 00 00 00 00 00 01 04 0f call r1, 0, 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0x10
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0x18
; INPUT-NEXT: 00 00 00 00 00 43 04 21 far_call r3, r4, 0
; INPUT-NEXT: 00 00 00 00 00 43 04 21 callf r3, r4, 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0x18
; INPUT-NEXT: 00 00 00 00 00 00 01 3d jump 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0xa0
; INPUT-NEXT: 00 00 00 00 00 01 04 2e ret.ok.to_label r1, 0
; INPUT-NEXT: 00 00 00 00 00 01 04 2e retl 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0xa0
; INPUT-NEXT: 00 00 00 00 00 01 04 30 ret.revert.to_label r1, 0
; INPUT-NEXT: 00 00 00 00 00 01 04 30 revl 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0xa0
; INPUT-NEXT: 00 00 00 00 00 00 04 32 ret.panic.to_label 0
; INPUT-NEXT: 00 00 00 00 00 00 04 32 pncl 0
; INPUT-NEXT: R_ERAVM_16_SCALE_8 .text+0xa0
; INPUT-LABEL: <label_local>:
; INPUT-NEXT: 00 00 00 01 00 00 01 3e jump code[1]
; INPUT-NEXT: R_ERAVM_16_SCALE_32 .rodata+0x20
; INPUT-NEXT: 00 00 00 00 00 01 04 2d ret

; OUTPUT-LABEL: <caller_l>:
; OUTPUT-NEXT: 00 12 00 13 00 01 04 0f near_call r1, 19, 18
; OUTPUT-NEXT: 00 00 00 13 00 43 04 21 far_call r3, r4, 19
; OUTPUT-NEXT: 00 12 00 13 00 01 04 0f call r1, 19, 18
; OUTPUT-NEXT: 00 00 00 13 00 43 04 21 callf r3, r4, 19
; OUTPUT-NEXT: 00 00 00 24 00 00 01 3d jump 36
; OUTPUT-NEXT: 00 00 00 24 00 01 04 2e ret.ok.to_label r1, 36
; OUTPUT-NEXT: 00 00 00 24 00 01 04 30 ret.revert.to_label r1, 36
; OUTPUT-NEXT: 00 00 00 24 00 00 04 32 ret.panic.to_label 36
; OUTPUT-NEXT: 00 00 00 24 00 01 04 2e retl 36
; OUTPUT-NEXT: 00 00 00 24 00 01 04 30 revl 36
; OUTPUT-NEXT: 00 00 00 24 00 00 04 32 pncl 36
; OUTPUT-LABEL: <label_local>:
; OUTPUT-NEXT: 00 00 00 02 00 00 01 3e jump code[2]
; OUTPUT-NEXT: 00 00 00 00 00 01 04 2d ret
36 changes: 36 additions & 0 deletions llvm/lib/Target/EraVM/AsmParser/EraVMAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class EraVMAsmParser : public MCTargetAsmParser {
OperandMatchResultTy tryParseStackOperand(OperandVector &Operands);
OperandMatchResultTy tryParseCodeOperand(OperandVector &Operands);

bool parseAdjSP(OperandVector &Operands);

bool ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
SMLoc NameLoc, OperandVector &Operands) override;

Expand Down Expand Up @@ -682,6 +684,36 @@ EraVMAsmParser::tryParseCodeOperand(OperandVector &Operands) {
return MatchOperand_Success;
}

bool EraVMAsmParser::parseAdjSP(OperandVector &Operands) {
SMLoc S, E;
MCRegister Reg;
int Addend = 0;

while (!parseOptionalToken(AsmToken::EndOfStatement)) {
switch (getTok().getKind()) {
default:
return TokError("unexpected token");
case AsmToken::Identifier:
if (tryParseRegister(Reg, S, E))
return Error(getTok().getLoc(), "cannot parse register");
Operands.push_back(EraVMOperand::CreateReg(Reg, S, E));
break;
case AsmToken::Plus:
Operands.push_back(EraVMOperand::CreateToken("+", getTok().getLoc()));
Lex(); // eat "+" token
break;
case AsmToken::Integer:
Addend = getTok().getIntVal();
S = getTok().getLoc();
E = getTok().getEndLoc();
Operands.push_back(EraVMOperand::CreateImm(createConstant(Addend), S, E));
Lex(); // eat integer token
break;
}
}
return false;
}

bool EraVMAsmParser::ParseInstruction(ParseInstructionInfo &Info,
StringRef Name, SMLoc NameLoc,
OperandVector &Operands) {
Expand All @@ -690,6 +722,10 @@ bool EraVMAsmParser::ParseInstruction(ParseInstructionInfo &Info,

StringRef Mnemonic = static_cast<EraVMOperand &>(*Operands[0]).getToken();
applyMnemonicAliases(Mnemonic, getAvailableFeatures(), /*VariantID=*/0);

if (Mnemonic == "incsp" || Mnemonic == "decsp")
return parseAdjSP(Operands);

auto ParseOne = [this, Mnemonic, &Operands]() {
return parseOperand(Mnemonic, Operands);
};
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/EraVM/EraVMInstrFormats.td
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ class IFarCall<EraVMOpcode opcode,

string Modifiers =
!cond(!eq({is_static, is_shard}, {0, 0}): "",
!eq({is_static, is_shard}, {1, 0}): ".static",
!eq({is_static, is_shard}, {0, 1}): ".shard",
!eq({is_static, is_shard}, {1, 0}): ".st",
!eq({is_static, is_shard}, {0, 1}): ".sh",
!eq({is_static, is_shard}, {1, 1}): ".st.sh",
true: ".INVALID");
let AsmString = !strconcat(opcode.Name, Modifiers, "${cc}", "\t", asmstr);
Expand Down
25 changes: 14 additions & 11 deletions llvm/lib/Target/EraVM/EraVMInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,15 @@ def NOPsrs : Isr_s<OpNoOp, NoSwap, PreserveFlags, []>;

def : Pat<(EraVMadd_to_sp GR256:$reg), (NOPrrs R0, R0, R0, $reg, 0, 0)>;

def : InstAlias<"nop${cc}\t${dst0}", (NOPrrs R0, R0, stackout:$dst0, pred:$cc)>;
def : InstAlias<"nop${cc}\t${src0}", (NOPsrr R0, stackin:$src0, R0, pred:$cc)>;
def : InstAlias<"nop${cc}", (NOPrrr R0, R0, R0, pred:$cc)>;
def : InstAlias<"incsp${cc}\t${reg}", (NOPrrs R0, R0, R0, GR256:$reg, 0, pred:$cc)>;
def : InstAlias<"incsp${cc}\t${imm}", (NOPrrs R0, R0, R0, R0, i16imm:$imm, pred:$cc)>;
def : InstAlias<"incsp${cc}\t${reg}+${imm}", (NOPrrs R0, R0, R0, GR256:$reg, i16imm:$imm, pred:$cc)>;

def : InstAlias<"decsp${cc}\t${reg}", (NOPsrr R0, R0, GR256:$reg, 0, R0, pred:$cc)>;
def : InstAlias<"decsp${cc}\t${imm}", (NOPsrr R0, R0, R0, i16imm:$imm, R0, pred:$cc)>;
def : InstAlias<"decsp${cc}\t${reg}+${imm}", (NOPsrr R0, R0, GR256:$reg, i16imm:$imm, R0, pred:$cc)>;

def : InstAlias<"nop${cc}", (NOPrrr R0, R0, R0, pred:$cc)>;

// Note that while technically commutative arithmetic instructions are not swappable,
// it is not a problem as there will be no corresponding instruction defined with SwapOperand = 1
Expand Down Expand Up @@ -945,13 +951,10 @@ def THROW : Pseudo<(outs), (ins GR256:$rs0, pred:$cc), [(EraVMthrow GR256:$rs0)]
PseudoInstExpansion<(REVERTr GR256:$rs0, pred:$cc)>;

def : InstAlias<"ret${cc}", (RETr R1, pred:$cc)>;
def : InstAlias<"revert${cc}", (REVERTr R1, pred:$cc)>;
def : InstAlias<"rev${cc}", (REVERTr R1, pred:$cc)>;

// TODO Make these aliases preferred for printing after switching to the new syntax.
let EmitPriority = 0 in {
def : InstAlias<"ret.ok.to_label${cc} $dest", (RETrl R1, jmptarget:$dest, pred:$cc)>;
def : InstAlias<"ret.revert.to_label${cc} $dest", (REVERTrl R1, jmptarget:$dest, pred:$cc)>;
}
def : InstAlias<"retl${cc} $dest", (RETrl R1, jmptarget:$dest, pred:$cc)>;
def : InstAlias<"revl${cc} $dest", (REVERTrl R1, jmptarget:$dest, pred:$cc)>;

def : Pat<(EraVMreturn GR256:$rs0), (RETrl GR256:$rs0, (default_far_return 0))>;
def : Pat<(EraVMrevert GR256:$rs0), (REVERTrl GR256:$rs0, (default_far_revert 0))>;
Expand Down Expand Up @@ -1034,7 +1037,7 @@ let Defs = [R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, Fl

// Unfortunately, we cannot encode @DEFAULT_UNWIND_DEST here, so we have to alias to pseudo
def NEAR_CALL_default_unwind : AsmParserPseudo<(outs), (ins GR256:$in1, jmptarget:$callee),
"near_call", "${in1} ${callee}">;
"call", "${in1} ${callee}">;

defm FAR_CALL : FarCallInst<OpFarcall>;
defm DELEGATE_CALL : FarCallInst<OpDelegate>;
Expand All @@ -1049,7 +1052,7 @@ foreach Op = [OpFarcall, OpDelegate, OpMimic] in {
!strconcat(Op.Name, ".st.sh")>;
}

def : InstAlias<"near_call${cc} ${callee}",
def : InstAlias<"call${cc} ${callee}",
(NEAR_CALL_default_unwind R0, jmptarget:$callee, pred:$cc)>;

def : Pat<(EraVMfarcall bb:$unwind), (FAR_CALLrrl R1, R2, bb:$unwind)>;
Expand Down
105 changes: 54 additions & 51 deletions llvm/lib/Target/EraVM/EraVMOpcodes.td
Original file line number Diff line number Diff line change
Expand Up @@ -145,61 +145,64 @@ def OpShl : EraVMOpcode<"shl", 463, ArithNCommEncoding>;
def OpShr : EraVMOpcode<"shr", 559, ArithNCommEncoding>;
def OpRol : EraVMOpcode<"rol", 655, ArithNCommEncoding>;
def OpRor : EraVMOpcode<"ror", 751, ArithNCommEncoding>;
def OpPtrAdd : EraVMOpcode<"ptr.add", 847, ArithPtrEncoding>;
def OpPtrSub : EraVMOpcode<"ptr.sub", 895, ArithPtrEncoding>;
def OpPtrPack : EraVMOpcode<"ptr.pack", 943, ArithPtrEncoding>;
def OpPtrShrink : EraVMOpcode<"ptr.shrink", 991, ArithPtrEncoding>;
def OpCall : EraVMOpcode<"near_call", 1039, DirectEncoding>;

def OpContextThis : EraVMOpcode<"context.this", 1040, DirectEncoding>;
def OpContextCaller : EraVMOpcode<"context.caller", 1041, DirectEncoding>;
def OpContextCodeAddress : EraVMOpcode<"context.code_source", 1042, DirectEncoding>;
def OpContextMeta : EraVMOpcode<"context.meta", 1043, DirectEncoding>;
def OpContextErgsLeft : EraVMOpcode<"context.gas_left", 1044, DirectEncoding>;
def OpContextSp : EraVMOpcode<"context.sp", 1045, DirectEncoding>;
def OpContextGetContextU128 : EraVMOpcode<"context.get_context_u128", 1046, DirectEncoding>;
def OpContextSetContextU128 : EraVMOpcode<"context.set_context_u128", 1047, DirectEncoding>;
def OpContextSetErgsPerPubdataByte : EraVMOpcode<"context.set_gas_per_pubdata", 1048, DirectEncoding>;
def OpContextIncrementTxNumber : EraVMOpcode<"context.inc_tx_num", 1049, DirectEncoding>;

def OpSload : EraVMOpcode<"sload", 1050, DirectEncoding>;
def OpSstore : EraVMOpcode<"sstore", 1051, DirectEncoding>;

def OpLogToL1 : EraVMOpcode<"to_l1", 1052, DirectEncoding>; // is_first ⇒ 1052 + is_first
def OpLogToL1Initial : EraVMOpcode<"to_l1.first", 1053, DirectEncoding>;
def OpLogEvent : EraVMOpcode<"event", 1054, DirectEncoding>; // is_first ⇒ 1054 + is_first
def OpLogEventInitial : EraVMOpcode<"event.first", 1055, DirectEncoding>;
def OpLogPrecompile : EraVMOpcode<"precompile", 1056, DirectEncoding>;

def OpFarcall : EraVMOpcode<"far_call", 1057, FarCallEncoding>; // is_shard is_static ⇒ 1057 + 2 × is_static + is_shard
def OpDelegate : EraVMOpcode<"far_call.delegate", 1061, FarCallEncoding>; // is_shard is_static ⇒ 1061 + 2 × is_static + is_shard
def OpMimic : EraVMOpcode<"far_call.mimic", 1065, FarCallEncoding>; // is_shard is_static ⇒ 1065 + 2 × is_static + is_shard

def OpRet : EraVMOpcode<"ret.ok", 1069, DirectEncoding>; // to_label ⇒ 1069 + to_label
def OpRetToLabel : EraVMOpcode<"ret.ok.to_label", 1070, DirectEncoding>;
def OpRevert : EraVMOpcode<"ret.revert", 1071, DirectEncoding>; // to_label ⇒ 1071 + to_label
def OpRevertToLabel : EraVMOpcode<"ret.revert.to_label", 1072, DirectEncoding>;
def OpPanic : EraVMOpcode<"panic", 1073, DirectEncoding>; // to_label ⇒ 1073 + to_label
def OpPanicToLabel : EraVMOpcode<"ret.panic.to_label", 1074, DirectEncoding>;

def OpLoadHeap : EraVMOpcode<"ld.1", 1075, HeapOpEncoding>; // src inc ⇒ 1075 + 10 × src + inc
def OpLoadHeapInc : EraVMOpcode<"ld.1.inc", 1076, HeapOpEncoding>;
def OpStoreHeap : EraVMOpcode<"st.1", 1077, HeapOpEncoding>; // src inc ⇒ 1077 + 10 × src + inc
def OpStoreHeapInc : EraVMOpcode<"st.1.inc", 1078, HeapOpEncoding>;

def OpLoadAuxHeap : EraVMOpcode<"ld.2", 1079, HeapOpEncoding>; // src inc ⇒ 1079 + 10 × src + inc
def OpLoadAuxHeapInc : EraVMOpcode<"ld.2.inc", 1080, HeapOpEncoding>;
def OpStoreAuxHeap : EraVMOpcode<"st.2", 1081, HeapOpEncoding>; // src inc ⇒ 1081 + 10 × src + inc
def OpStoreAuxHeapInc : EraVMOpcode<"st.2.inc", 1082, HeapOpEncoding>;

def OpPtrAdd : EraVMOpcode<"addp", 847, ArithPtrEncoding>;
def OpPtrSub : EraVMOpcode<"subp", 895, ArithPtrEncoding>;
def OpPtrPack : EraVMOpcode<"pack", 943, ArithPtrEncoding>;
def OpPtrShrink : EraVMOpcode<"shrnk", 991, ArithPtrEncoding>;
def OpCall : EraVMOpcode<"call", 1039, DirectEncoding>;

def OpContextThis : EraVMOpcode<"this", 1040, DirectEncoding>;
def OpContextCaller : EraVMOpcode<"par", 1041, DirectEncoding>;
def OpContextCodeAddress : EraVMOpcode<"code", 1042, DirectEncoding>;
def OpContextMeta : EraVMOpcode<"meta", 1043, DirectEncoding>;
def OpContextErgsLeft : EraVMOpcode<"ergs", 1044, DirectEncoding>;
def OpContextSp : EraVMOpcode<"sp", 1045, DirectEncoding>;
def OpContextGetContextU128 : EraVMOpcode<"ldvl", 1046, DirectEncoding>;
def OpContextSetContextU128 : EraVMOpcode<"stvl", 1047, DirectEncoding>;
def OpContextIncrementTxNumber : EraVMOpcode<"inctx", 1049, DirectEncoding>;

// Removed in VM 1.5.0
def OpContextSetErgsPerPubdataByte : EraVMOpcode<"stpub", 1048, DirectEncoding>;

def OpSload : EraVMOpcode<"lds", 1050, DirectEncoding>;
def OpSstore : EraVMOpcode<"sts", 1051, DirectEncoding>;

def OpLogToL1 : EraVMOpcode<"logL1", 1052, DirectEncoding>; // is_initializer ⇒ 1052 + is_initializer
def OpLogToL1Initial : EraVMOpcode<"logL1.i", 1053, DirectEncoding>;
def OpLogEvent : EraVMOpcode<"log", 1054, DirectEncoding>; // is_initializer ⇒ 1054 + is_initializer
def OpLogEventInitial : EraVMOpcode<"log.i", 1055, DirectEncoding>;
def OpLogPrecompile : EraVMOpcode<"callp", 1056, DirectEncoding>;

def OpFarcall : EraVMOpcode<"callf", 1057, FarCallEncoding>; // is_shard is_static ⇒ 1057 + 2 × is_static + is_shard
def OpDelegate : EraVMOpcode<"calld", 1061, FarCallEncoding>; // is_shard is_static ⇒ 1061 + 2 × is_static + is_shard
def OpMimic : EraVMOpcode<"callm", 1065, FarCallEncoding>; // is_shard is_static ⇒ 1065 + 2 × is_static + is_shard

def OpRet : EraVMOpcode<"ret", 1069, DirectEncoding>; // to_label ⇒ 1069 + to_label
def OpRetToLabel : EraVMOpcode<"retl", 1070, DirectEncoding>;
def OpRevert : EraVMOpcode<"rev", 1071, DirectEncoding>; // to_label ⇒ 1071 + to_label
def OpRevertToLabel : EraVMOpcode<"revl", 1072, DirectEncoding>;
def OpPanic : EraVMOpcode<"pnc", 1073, DirectEncoding>; // to_label ⇒ 1073 + to_label
def OpPanicToLabel : EraVMOpcode<"pncl", 1074, DirectEncoding>;

def OpLoadHeap : EraVMOpcode<"ldm.h", 1075, HeapOpEncoding>; // src inc ⇒ 1075 + 10 × src + inc
def OpLoadHeapInc : EraVMOpcode<"ldmi.h", 1076, HeapOpEncoding>;
def OpStoreHeap : EraVMOpcode<"stm.h", 1077, HeapOpEncoding>; // src inc ⇒ 1077 + 10 × src + inc
def OpStoreHeapInc : EraVMOpcode<"stmi.h", 1078, HeapOpEncoding>;

def OpLoadAuxHeap : EraVMOpcode<"ldm.ah", 1079, HeapOpEncoding>; // src inc ⇒ 1079 + 10 × src + inc
def OpLoadAuxHeapInc : EraVMOpcode<"ldmi.ah", 1080, HeapOpEncoding>;
def OpStoreAuxHeap : EraVMOpcode<"stm.ah", 1081, HeapOpEncoding>; // src inc ⇒ 1081 + 10 × src + inc
def OpStoreAuxHeapInc : EraVMOpcode<"stmi.ah", 1082, HeapOpEncoding>;

def OpStaticRead : EraVMOpcode<"ldm.st", 1096, StaticOpEncoding>; // src inc ⇒ 1096 + 2 × src + inc
def OpStaticReadInc : EraVMOpcode<"ldmi.st", 1097, StaticOpEncoding>;
def OpStaticWrite : EraVMOpcode<"stm.st", 1100, StaticOpEncoding>; // src inc ⇒ 1100 + 2 × src + inc
def OpStaticWriteInc : EraVMOpcode<"stmi.st", 1101, StaticOpEncoding>;

def OpLoadPtr : EraVMOpcode<"ld", 1083, DirectEncoding>; // inc ⇒ 1083 + inc
def OpLoadPtrInc : EraVMOpcode<"ld.inc", 1084, DirectEncoding>;
def OpLoadPtr : EraVMOpcode<"ldp", 1083, DirectEncoding>; // inc ⇒ 1083 + inc
def OpLoadPtrInc : EraVMOpcode<"ldpi", 1084, DirectEncoding>;

def OpDecommit : EraVMOpcode<"log.decommit", 1093, DirectEncoding>;
def OpTransientLoad : EraVMOpcode<"tload", 1094, DirectEncoding>;
def OpTransientStore : EraVMOpcode<"tstore", 1095, DirectEncoding>;
def OpDecommit : EraVMOpcode<"dcmt", 1093, DirectEncoding>;
def OpTransientLoad : EraVMOpcode<"ldt", 1094, DirectEncoding>;
def OpTransientStore : EraVMOpcode<"stt", 1095, DirectEncoding>;
Loading

0 comments on commit 52aa478

Please sign in to comment.