Add fuzzy type matching for operands to Instruction#encode
/#initialize
#226
Labels
Milestone
Instruction#encode
/#initialize
#226
In order to support implicit typecasting of operands, the operand classes should support some kind of fuzzy type matching, if a specific size or type has not been specified. This would allow using unsized immediate or memory operands where a
imm32
ormem32
operand is required.This would also reduce the need for having to specify
byte(...)
orqword(...)
all of the type to specify an operands explicit size.Example
In the above example,
0xff
will be coerced toImmediate.new(0xff, size: 1)
since0xff
is 8 bits, but themov
instruction only supportsmov reg32, imm32
andmov reg8, imm8
. Thus we should treat0xff
as an unsizedImmediate
operand and try to fuzzy match it againstimm32
.The text was updated successfully, but these errors were encountered: