Skip to content

Commit

Permalink
Finish tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Dec 17, 2024
1 parent f07c3ef commit 6d9a182
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion llvm/lib/Target/SBF/Disassembler/SBFDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class SBFDisassembler : public MCDisassembler {
uint8_t getInstMode(uint64_t Inst) const { return (Inst >> 61) & 0x7; };
bool isMov32(uint64_t Inst) const { return (Inst >> 56) == 0xb4; }
bool isNewMem(uint64_t Inst) const;
bool isSyscallOrExit(uint64_t Inst) const { return (Inst >> 56) == 0x95; }
};

} // end anonymous namespace
Expand Down Expand Up @@ -202,7 +203,8 @@ DecodeStatus SBFDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
Result =
decodeInstruction(DecoderTableSBFALU32MEMv264,
Instr, Insn, Address, this, STI);
else if (isNewMem(Insn) && STI.hasFeature(SBF::FeatureNewMemEncoding))
else if ((isNewMem(Insn) && STI.hasFeature(SBF::FeatureNewMemEncoding)) ||
(isSyscallOrExit(Insn) && STI.hasFeature(SBF::FeatureStaticSyscalls)))
Result =
decodeInstruction(DecoderTableSBFv264,
Instr, Insn, Address, this, STI);
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/MC/Disassembler/SBF/sbf-jmp.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# RUN: llvm-mc --disassemble %s -triple=sbf-solana-solana \
# RUN: | FileCheck %s --check-prefix=CHECK-NEW
# RUN: llvm-mc --disassemble %s -triple=sbf-solana-solana -mattr=+static-syscalls \
# RUN: | FileCheck %s --check-prefix=CHECK-V2

# TODO: Test immediate field ranges.

Expand Down Expand Up @@ -109,5 +111,9 @@
# CHECK-NEW: exit
0x95,0x00,0x00,0x00,0x00,0x00,0x00,0x00

# CHECK-V2: syscall 5
0x95,0x00,0x00,0x00,0x05,0x00,0x00,0x00


# CHECK-NEW: return
0x9d,0x00,0x00,0x00,0x00,0x00,0x00,0x00
2 changes: 1 addition & 1 deletion llvm/test/MC/SBF/sbf-return-syscall.s
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
syscall 9
return

// CHECK: 95 00 00 00 09 00 00 00 syscall 9
// CHECK: 95 00 00 00 09 00 00 00 syscall 0x9
// CHECK: 9d 00 00 00 00 00 00 00 return

0 comments on commit 6d9a182

Please sign in to comment.