diff --git a/include/pareas/compiler/futhark_interop.hpp b/include/pareas/compiler/futhark_interop.hpp index aa33854..ab4bad5 100644 --- a/include/pareas/compiler/futhark_interop.hpp +++ b/include/pareas/compiler/futhark_interop.hpp @@ -230,6 +230,15 @@ namespace futhark { constexpr static const auto shape_fn = futhark_shape_i32_2d; constexpr static const auto values_fn = futhark_values_i32_2d; }; + + template<> + struct ArrayTraits { + using Array = futhark_i64_1d; + constexpr static const auto new_fn = futhark_new_i64_1d; + constexpr static const auto free_fn = futhark_free_i64_1d; + constexpr static const auto shape_fn = futhark_shape_i64_1d; + constexpr static const auto values_fn = futhark_values_i64_1d; + }; } #endif diff --git a/src/compiler/backend.cpp b/src/compiler/backend.cpp index 2d990c7..38718cf 100644 --- a/src/compiler/backend.cpp +++ b/src/compiler/backend.cpp @@ -81,6 +81,23 @@ namespace backend { throw futhark::Error(ctx); }); + //Print instr gen + auto instr_gen_opcodes = futhark::UniqueArray(ctx); + auto instr_gen_rd = futhark::UniqueArray(ctx); + auto instr_gen_rs1 = futhark::UniqueArray(ctx); + auto instr_gen_rs2 = futhark::UniqueArray(ctx); + auto instr_gen_jt = futhark::UniqueArray(ctx); + int err = futhark_entry_backend_split_instr( + ctx, + &instr_gen_opcodes, + &instr_gen_rd, + &instr_gen_rs1, + &instr_gen_rs2, + &instr_gen_jt, + instr + ); + + // Stage 4, optimizer auto optimize = futhark::UniqueArray(ctx); p.measure("optimize", [&] { diff --git a/src/compiler/backend.fut b/src/compiler/backend.fut index d614b8c..02c832b 100644 --- a/src/compiler/backend.fut +++ b/src/compiler/backend.fut @@ -2,23 +2,15 @@ import "codegen/tree" import "codegen/datatypes" import "codegen/instr" import "codegen/instr_count" -import "codegen/symtab" import "codegen/register" import "codegen/preprocess" import "codegen/optimizer" import "codegen/postprocess" type Tree [n] = Tree [n] -type Symtab [n] = Symtab [n] type FuncInfo = FuncInfo type Instr = Instr -let make_variable (data_type: u8) (offset: u32) : Variable = - { - decl_type = i32.u8 data_type, - offset = offset - } - let make_node (node_type: u8) (data_type: u8, parent: i32, depth: i32, child_idx: i32, node_data: u32) : Node = { node_type = i32.u8 node_type, @@ -37,11 +29,6 @@ let make_functab (id: u32) (start: u32) (size: u32) = } -- Data structure rewrite functions -entry make_symtab [m] (data_types: [m]u8) (offsets: [m]u32) : Symtab[m] = - { - variables = map2 make_variable data_types offsets - } - entry make_tree [n] (max_depth: i32) (node_types: [n]u8) (data_types: [n]u8) (parents: [n]i32) (depth: [n]i32) (child_idx: [n]i32) (node_data: [n]u32): Tree[n] = { diff --git a/src/compiler/main.fut b/src/compiler/main.fut index a9e4254..b62e0bb 100644 --- a/src/compiler/main.fut +++ b/src/compiler/main.fut @@ -151,3 +151,6 @@ entry backend_fix_jumps [n] [m] (instrs: [n]Instr) (func_tab: [m]FuncInfo): ([]I entry backend_postprocess [n] (instrs: [n]Instr) = backend.stage_postprocess instrs + +entry backend_split_instr [n] (instrs: [n]Instr) = + map backend.split_instr instrs |> unzip5 \ No newline at end of file