Add storeimm32 and storeimm64 syntax
These explicitly allow usage of storeimm32 and storeimm64 in the assembler syntax. It will also warn you if you try to store a value that's too large using the storeimm32 instruction Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -203,6 +203,22 @@ impl<'a> Assemble<'a> {
|
||||
}
|
||||
}
|
||||
.r1(*r1),
|
||||
Inst::StoreImm32(r1, imm) => {
|
||||
let imm = self.get_value(imm).expect("TODO : value label not found");
|
||||
let imm_truncated = (imm & 0xFFFFFFFF) as u32;
|
||||
// TODO compile-time warnings
|
||||
if imm != (imm_truncated as u64) {
|
||||
eprintln!(
|
||||
"WARNING: immediate 32 bit value being truncated ({:#x} to {:#x})",
|
||||
imm, imm_truncated
|
||||
)
|
||||
}
|
||||
builder.op(STOREIMM32).imm32(imm_truncated).r1(*r1)
|
||||
}
|
||||
Inst::StoreImm64(r1, imm) => {
|
||||
let imm = self.get_value(imm).expect("TODO : value label not found");
|
||||
builder.op(STOREIMM64).imm64(imm).r1(*r1)
|
||||
}
|
||||
Inst::MemCopy(r1, r2) => builder.op(MEMCOPY).r1(*r1).r2(*r2),
|
||||
Inst::RegCopy(r1, r2) => builder.op(REGCOPY).r1(*r1).r2(*r2),
|
||||
Inst::Nop => builder.op(NOP),
|
||||
|
||||
Reference in New Issue
Block a user