refactor: change LowerCtx::get_immediate to return a DataValue

This change abstracts away (from the perspective of the new backend) how immediate values are stored in InstructionData. It gathers large immediates from necessary places (e.g. constant pool) and delegates to `InstructionData::imm_value` for the rest. This refactor only touches original users of `LowerCtx::get_immediate` but a future change could do the same for any place the new backend is accessing InstructionData directly to retrieve immediates.
This commit is contained in:
Andrew Brown
2020-10-01 10:33:49 -07:00
parent 3a2025fdc7
commit ce44719e1f
4 changed files with 38 additions and 28 deletions

View File

@@ -63,6 +63,11 @@ impl ConstantData {
self.0.is_empty()
}
/// Return the data as a slice.
pub fn as_slice(&self) -> &[u8] {
self.0.as_slice()
}
/// Convert the data to a vector.
pub fn into_vec(self) -> Vec<u8> {
self.0