From 7c997bd9519fbba0bd28dff29f3302b29d08d2b5 Mon Sep 17 00:00:00 2001
From: Aaron Councilman <aaronjc4@illinois.edu>
Date: Thu, 20 Feb 2025 15:51:57 -0600
Subject: [PATCH] Fixes

---
 hercules_cg/src/cpu.rs | 4 +---
 hercules_cg/src/gpu.rs | 5 ++---
 hercules_cg/src/rt.rs  | 1 -
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/hercules_cg/src/cpu.rs b/hercules_cg/src/cpu.rs
index 509b98c5..1f3ab0a4 100644
--- a/hercules_cg/src/cpu.rs
+++ b/hercules_cg/src/cpu.rs
@@ -131,9 +131,7 @@ impl<'a> CPUContext<'a> {
         }
         // Lastly, if the function has multiple returns, is a pointer to the return struct
         if self.function.return_types.len() != 1 {
-            if first_param {
-                first_param = false;
-            } else {
+            if !first_param {
                 write!(w, ", ")?;
             }
             write!(
diff --git a/hercules_cg/src/gpu.rs b/hercules_cg/src/gpu.rs
index 17f0f893..4390e25c 100644
--- a/hercules_cg/src/gpu.rs
+++ b/hercules_cg/src/gpu.rs
@@ -4,7 +4,6 @@ extern crate hercules_ir;
 use std::collections::{BTreeMap, HashMap, HashSet};
 use std::fmt::{Error, Write};
 use std::fs::{File, OpenOptions};
-use std::io::Write as _;
 
 use self::hercules_ir::*;
 
@@ -1516,7 +1515,7 @@ extern \"C\" {} {}(",
         let tabs = match &self.function.nodes[id.idx()] {
             Node::Start
             | Node::Region { preds: _ }
-            | Node::Projection {
+            | Node::ControlProjection {
                 control: _,
                 selection: _,
             } => {
@@ -1528,7 +1527,7 @@ extern \"C\" {} {}(",
                 let mut succs = self.control_subgraph.succs(id);
                 let succ1 = succs.next().unwrap();
                 let succ2 = succs.next().unwrap();
-                let succ1_is_true = self.function.nodes[succ1.idx()].try_projection(1).is_some();
+                let succ1_is_true = self.function.nodes[succ1.idx()].try_control_projection(1).is_some();
                 let succ1_block_name = self.get_block_name(succ1, false);
                 let succ2_block_name = self.get_block_name(succ2, false);
                 write!(
diff --git a/hercules_cg/src/rt.rs b/hercules_cg/src/rt.rs
index cffed48a..a943cb4d 100644
--- a/hercules_cg/src/rt.rs
+++ b/hercules_cg/src/rt.rs
@@ -235,7 +235,6 @@ impl<'a> RTContext<'a> {
                 // Call the device function
                 write!(w, "{}(", callee.name)?;
                 if self.backing_allocations[&callee_id].contains_key(&self.devices[callee_id.idx()]) {
-                    first_param = false;
                     write!(w, "backing, ")?;
                 }
                 for idx in 0..callee.num_dynamic_constants {
-- 
GitLab