Add call pseudo instruction

This commit is contained in:
2024-09-15 23:03:25 +02:00
parent d29012d30e
commit c9ff4f0a2a
11 changed files with 255 additions and 191 deletions

View File

@ -150,6 +150,7 @@ data RelocationType
data Instruction
= Instruction BaseOpcode Type
| RelocatableInstruction BaseOpcode RelocationType
| CallInstruction Text
deriving Eq
xRegister :: XRegister -> Word8
@ -306,6 +307,10 @@ instruction :: Instruction -> ByteString.Builder.Builder
instruction = \case
(Instruction base instructionType) -> go base $ type' instructionType
(RelocatableInstruction base instructionType) -> go base $ relocationType instructionType
(CallInstruction _) -> foldMap instruction
[ Instruction Auipc $ U RA 0
, Instruction Jalr $ I RA JALR RA 0
]
where
go base instructionType
= ByteString.Builder.word32LE