mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-14 22:38:46 +00:00
HW7 (5)
This commit is contained in:
@@ -57,7 +57,7 @@ impl Asmgen {
|
|||||||
if *size != directives.len() {
|
if *size != directives.len() {
|
||||||
directives.push(asm::Directive::Zero(
|
directives.push(asm::Directive::Zero(
|
||||||
(size - directives.len())
|
(size - directives.len())
|
||||||
* (get_dtype_size(&inner, structs) as usize),
|
* (get_dtype_size(inner, structs) as usize),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -610,7 +610,7 @@ impl Asmgen {
|
|||||||
rid: ptr_rid,
|
rid: ptr_rid,
|
||||||
dtype: ptr_dtype,
|
dtype: ptr_dtype,
|
||||||
} => match ptr_rid {
|
} => match ptr_rid {
|
||||||
ir::RegisterId::Temp { .. } => {
|
ir::RegisterId::Temp { .. } | ir::RegisterId::Arg { .. } => {
|
||||||
if let Some(size) = is_struct(&value_dtype, structs) {
|
if let Some(size) = is_struct(&value_dtype, structs) {
|
||||||
let rs1 = get_lhs_register(ptr_dtype);
|
let rs1 = get_lhs_register(ptr_dtype);
|
||||||
self.translate_load_operand(ptr, rs1, context);
|
self.translate_load_operand(ptr, rs1, context);
|
||||||
@@ -1058,7 +1058,7 @@ impl Asmgen {
|
|||||||
rid: ptr_rid,
|
rid: ptr_rid,
|
||||||
dtype: ptr_dtype,
|
dtype: ptr_dtype,
|
||||||
} => match ptr_rid {
|
} => match ptr_rid {
|
||||||
ir::RegisterId::Temp { .. } => {
|
ir::RegisterId::Temp { .. } | ir::RegisterId::Arg { .. } => {
|
||||||
let rs1 = get_lhs_register(ptr_dtype);
|
let rs1 = get_lhs_register(ptr_dtype);
|
||||||
let rs2 = get_rhs_register(&offset_dtype);
|
let rs2 = get_rhs_register(&offset_dtype);
|
||||||
self.translate_load_operand(ptr, rs1, context);
|
self.translate_load_operand(ptr, rs1, context);
|
||||||
@@ -1629,7 +1629,7 @@ fn ceil_to_multiple_of_16(x: u64) -> u64 {
|
|||||||
|
|
||||||
fn get_dtype_size(dtype: &ir::Dtype, structs: &HashMap<String, Option<ir::Dtype>>) -> u64 {
|
fn get_dtype_size(dtype: &ir::Dtype, structs: &HashMap<String, Option<ir::Dtype>>) -> u64 {
|
||||||
let (size, _) = dtype.size_align_of(structs).unwrap();
|
let (size, _) = dtype.size_align_of(structs).unwrap();
|
||||||
return size as u64;
|
size as u64
|
||||||
}
|
}
|
||||||
|
|
||||||
fn upgrade_dtype(dtype: &ir::Dtype) -> ir::Dtype {
|
fn upgrade_dtype(dtype: &ir::Dtype) -> ir::Dtype {
|
||||||
|
|||||||
Reference in New Issue
Block a user