Add RISC-V encodings for call_indirect.

This commit is contained in:
Jakob Stoklund Olesen
2017-06-14 16:14:16 -07:00
parent 3e1e2b6e5e
commit 4503306f0e
4 changed files with 22 additions and 2 deletions

View File

@@ -13,7 +13,8 @@ from cdsl.isa import EncRecipe
from cdsl.predicates import IsSignedInt
from cdsl.registers import Stack
from base.formats import Binary, BinaryImm, MultiAry, IntCompare, IntCompareImm
from base.formats import Unary, UnaryImm, BranchIcmp, Branch, Jump, Call
from base.formats import Unary, UnaryImm, BranchIcmp, Branch, Jump
from base.formats import Call, IndirectCall
from .registers import GPR
# The low 7 bits of a RISC-V instruction is the base opcode. All 32-bit
@@ -113,6 +114,9 @@ Iicmp = EncRecipe(
# The variable return values are not encoded.
Iret = EncRecipe('Iret', MultiAry, size=4, ins=(), outs=())
# I-type encoding for `jalr` as an indirect call.
Icall = EncRecipe('Icall', IndirectCall, size=4, ins=GPR, outs=())
# Copy of a GPR is implemented as addi x, 0.
Icopy = EncRecipe('Icopy', Unary, size=4, ins=GPR, outs=GPR)