Compile bitwise operations as well

This commit is contained in:
Sofia 2025-07-28 12:21:00 +03:00
parent 97948d8c38
commit 2709eb8749

View File

@ -975,11 +975,31 @@ impl InstructionHolder {
ty.as_llvm(module.context_ref, &module.types), ty.as_llvm(module.context_ref, &module.types),
name.as_ptr(), name.as_ptr(),
), ),
Or(instruction_value, instruction_value1) => todo!(), Or(lhs, rhs) => {
XOr(instruction_value, instruction_value1) => todo!(), let lhs_val = module.values.get(&lhs).unwrap().value_ref;
ShiftRightLogical(instruction_value, instruction_value1) => todo!(), let rhs_val = module.values.get(&rhs).unwrap().value_ref;
ShiftRightArithmetic(instruction_value, instruction_value1) => todo!(), LLVMBuildOr(module.builder_ref, lhs_val, rhs_val, name.as_ptr())
ShiftLeft(instruction_value, instruction_value1) => todo!(), }
XOr(lhs, rhs) => {
let lhs_val = module.values.get(&lhs).unwrap().value_ref;
let rhs_val = module.values.get(&rhs).unwrap().value_ref;
LLVMBuildXor(module.builder_ref, lhs_val, rhs_val, name.as_ptr())
}
ShiftRightLogical(lhs, rhs) => {
let lhs_val = module.values.get(&lhs).unwrap().value_ref;
let rhs_val = module.values.get(&rhs).unwrap().value_ref;
LLVMBuildLShr(module.builder_ref, lhs_val, rhs_val, name.as_ptr())
}
ShiftRightArithmetic(lhs, rhs) => {
let lhs_val = module.values.get(&lhs).unwrap().value_ref;
let rhs_val = module.values.get(&rhs).unwrap().value_ref;
LLVMBuildAShr(module.builder_ref, lhs_val, rhs_val, name.as_ptr())
}
ShiftLeft(lhs, rhs) => {
let lhs_val = module.values.get(&lhs).unwrap().value_ref;
let rhs_val = module.values.get(&rhs).unwrap().value_ref;
LLVMBuildShl(module.builder_ref, lhs_val, rhs_val, name.as_ptr())
}
} }
}; };
if let Some(record) = &self.record { if let Some(record) = &self.record {