Skip to content

Commit b633e49

Browse files
author
Arnaud Riess
committed
refactor: remove block labels from IR block structure and related tests
1 parent a7c9077 commit b633e49

3 files changed

Lines changed: 0 additions & 18 deletions

File tree

crates/herkos/src/codegen/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ mod tests {
183183
locals: vec![],
184184
blocks: vec![IrBlock {
185185
id: BlockId(0),
186-
label: "block0".to_string(),
187186
instructions: vec![IrInstr::BinOp {
188187
dest: VarId(2),
189188
op: BinOp::I32Add,
@@ -241,7 +240,6 @@ mod tests {
241240
locals: vec![],
242241
blocks: vec![IrBlock {
243242
id: BlockId(0),
244-
label: "block0".to_string(),
245243
instructions: vec![],
246244
terminator: IrTerminator::Return { value: None },
247245
}],
@@ -340,7 +338,6 @@ mod tests {
340338
locals: vec![],
341339
blocks: vec![IrBlock {
342340
id: BlockId(0),
343-
label: "block0".to_string(),
344341
instructions: vec![IrInstr::BinOp {
345342
dest: VarId(2),
346343
op: BinOp::I64Add,
@@ -397,7 +394,6 @@ mod tests {
397394
locals: vec![],
398395
blocks: vec![IrBlock {
399396
id: BlockId(0),
400-
label: "block0".to_string(),
401397
instructions: vec![
402398
IrInstr::Const {
403399
dest: VarId(1),
@@ -459,7 +455,6 @@ mod tests {
459455
locals: vec![],
460456
blocks: vec![IrBlock {
461457
id: BlockId(0),
462-
label: "block0".to_string(),
463458
instructions: vec![IrInstr::GlobalGet {
464459
dest: VarId(0),
465460
index: 0,
@@ -521,7 +516,6 @@ mod tests {
521516
locals: vec![],
522517
blocks: vec![IrBlock {
523518
id: BlockId(0),
524-
label: "block0".to_string(),
525519
instructions: vec![IrInstr::Load {
526520
dest: VarId(1),
527521
ty: WasmType::I32,
@@ -591,7 +585,6 @@ mod tests {
591585
locals: vec![],
592586
blocks: vec![IrBlock {
593587
id: BlockId(0),
594-
label: "block0".to_string(),
595588
instructions: vec![IrInstr::GlobalGet {
596589
dest: VarId(0),
597590
index: 0,

crates/herkos/src/ir/builder/core.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ impl IrBuilder {
145145
// Current block doesn't exist yet, create it
146146
self.blocks.push(IrBlock {
147147
id: self.current_block,
148-
label: format!("block_{}", self.current_block.0),
149148
instructions: vec![instr],
150149
terminator: IrTerminator::Unreachable, // Will be set later
151150
});
@@ -214,7 +213,6 @@ impl IrBuilder {
214213
self.current_block = entry;
215214
self.blocks.push(IrBlock {
216215
id: entry,
217-
label: format!("block_{}", entry.0), // "block_0"
218216
instructions: Vec::new(),
219217
terminator: IrTerminator::Unreachable,
220218
});
@@ -307,7 +305,6 @@ impl IrBuilder {
307305
self.current_block = block_id;
308306
self.blocks.push(IrBlock {
309307
id: block_id,
310-
label: format!("block_{}", block_id.0),
311308
instructions: Vec::new(),
312309
terminator: IrTerminator::Unreachable,
313310
});

crates/herkos/src/ir/types.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ pub struct IrBlock {
113113
/// Unique identifier for this block
114114
pub id: BlockId,
115115

116-
/// Label for Rust codegen ('block_0, 'block_1, etc.)
117-
pub label: String,
118-
119116
/// Instructions in this block (no control flow within)
120117
pub instructions: Vec<IrInstr>,
121118

@@ -1249,7 +1246,6 @@ mod tests {
12491246
locals: vec![],
12501247
blocks: vec![IrBlock {
12511248
id: BlockId(0),
1252-
label: "block_0".to_string(),
12531249
instructions: vec![IrInstr::Const {
12541250
dest: VarId(0),
12551251
value: IrValue::I32(42),
@@ -1269,7 +1265,6 @@ mod tests {
12691265
locals: vec![],
12701266
blocks: vec![IrBlock {
12711267
id: BlockId(0),
1272-
label: "block_0".to_string(),
12731268
instructions: vec![
12741269
IrInstr::Const {
12751270
dest: VarId(0),
@@ -1300,7 +1295,6 @@ mod tests {
13001295
locals: vec![],
13011296
blocks: vec![IrBlock {
13021297
id: BlockId(0),
1303-
label: "block_0".to_string(),
13041298
instructions: vec![IrInstr::Const {
13051299
dest: VarId(0),
13061300
value: IrValue::I32(42),
@@ -1325,7 +1319,6 @@ mod tests {
13251319
locals: vec![],
13261320
blocks: vec![IrBlock {
13271321
id: BlockId(0),
1328-
label: "block_0".to_string(),
13291322
instructions: vec![
13301323
IrInstr::Const {
13311324
dest: VarId(0),
@@ -1353,7 +1346,6 @@ mod tests {
13531346
locals: vec![],
13541347
blocks: vec![IrBlock {
13551348
id: BlockId(0),
1356-
label: "block_0".to_string(),
13571349
instructions: vec![IrInstr::GlobalSet {
13581350
index: 1, // Second imported global
13591351
value: VarId(0),

0 commit comments

Comments
 (0)