Skip to content

Commit 22ba0f6

Browse files
committed
remove unit type now that we return int and never use it
1 parent 5910b01 commit 22ba0f6

3 files changed

Lines changed: 0 additions & 15 deletions

File tree

examples/lowering-structs/lower.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ impl<'a, 'f> FuncLower<'a, 'f> {
7575
F: FnMut(&mut Self, cl::Type) -> cl::Value,
7676
{
7777
match p {
78-
Type::Unit => VirtualValue::unit(),
7978
Type::Int => {
8079
let v = f(self, cl::types::I32);
8180
VirtualValue::Scalar(v)
@@ -226,7 +225,6 @@ impl<'a, 'f> FuncLower<'a, 'f> {
226225
let nptr = self.ins().iadd_imm(*ptr, offset as i64);
227226
VirtualValue::StackStruct { type_, ptr: nptr }
228227
}
229-
Type::Unit => VirtualValue::unit(),
230228
Type::Int => {
231229
let v = self
232230
.ins()
@@ -298,7 +296,6 @@ impl<'a, 'f> FuncLower<'a, 'f> {
298296
let offset = self.types.offset_of_field(type_, field) + src_offset;
299297
let fty = self.types.type_of_field(type_, field);
300298
match fty {
301-
Type::Unit => {}
302299
Type::Int => {
303300
let v = self
304301
.ins()
@@ -318,7 +315,6 @@ impl<'a, 'f> FuncLower<'a, 'f> {
318315
let offset = self.types.offset_of_field(type_, field);
319316

320317
match fty {
321-
Type::Unit => {}
322318
Type::Int => {
323319
let n = self
324320
.ins()

examples/lowering-structs/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ enum VirtualValue {
5656
}
5757

5858
impl VirtualValue {
59-
fn unit() -> Self {
60-
VirtualValue::UnstableStruct {
61-
type_: "unit",
62-
fields: vec![],
63-
}
64-
}
65-
6659
#[track_caller]
6760
fn as_scalar(&self) -> cl::Value {
6861
match self {

examples/lowering-structs/types.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ type Name = &'static str;
1010
#[derive(Clone, Copy, Debug)]
1111
pub enum Type {
1212
Int,
13-
Unit,
1413
Struct(Name),
1514
}
1615

@@ -50,7 +49,6 @@ impl LookupTable {
5049
// values directly, we use an out pointer as the first parameter. Return will then write
5150
// the result to that pointer, instead of returning directly through the return registers.
5251
match fret {
53-
Type::Unit => {}
5452
Type::Int => returns.push(cl::AbiParam::new(cl::types::I32)),
5553
Type::Struct(name) => match self.struct_passing_mode(name) {
5654
StructPassingMode::ByScalars => {
@@ -68,7 +66,6 @@ impl LookupTable {
6866

6967
for p in fparams {
7068
match p {
71-
Type::Unit => {}
7269
Type::Int => params.push(cl::AbiParam::new(cl::types::I32)),
7370
Type::Struct(name) => match self.struct_passing_mode(name) {
7471
StructPassingMode::ByScalars => {
@@ -130,7 +127,6 @@ impl LookupTable {
130127
F: FnMut(cl::Type),
131128
{
132129
match ty {
133-
Type::Unit => {}
134130
Type::Int => f(cl::types::I32),
135131
Type::Struct(name) => self.for_scalars_of_struct(f, name),
136132
}

0 commit comments

Comments
 (0)