public string Visit(CIL_Allocate node) { string solve = ""; if (!node.Is_Type_Dir) { solve += $"\t la $t0, {node.Type}\n"; solve += $"\t lw $a0, 4($t0)\n"; solve += $"\t li $v0, 9\n"; solve += $"\t syscall\n"; solve += $"\t sw $v0 {context_function[node.Result]}\n"; solve += $"\t sw $a0, 0($v0)\n"; // set len solve += $"\t sw $t0, 4($v0)\n"; // set type } else { solve += $"\t sw $t0, {context_function[node.Type]}\n"; solve += $"\t lw $a0, 0($t0)\n"; solve += $"\t li $v0, 9\n"; solve += $"\t syscall\n"; solve += $"\t sw $v0 {context_function[node.Result]}\n"; solve += $"\t sw $a0, 0($v0)\n"; // set len solve += $"\t sw $t0, 4($v0)\n"; // set type } return(solve); }
public string Visit(CIL_Allocate node) { int idx = mem.Allocate(OffSetAttr[node.Type].Count + 3); int idxsalva = idx; mem.SetValue(idx, OffSetAttr[node.Type].Count + 1); mem.SetValue(++idx, mem.GetDirType(node.Type)); mem.SetValue(variableaddr.Peek()[node.Result], idx - 1); //PrintObject(idxsalva); return(""); }