Skip to content

Commit

Permalink
Merge pull request #1576 from hylo-lang/remove-dead-code
Browse files Browse the repository at this point in the history
Remove some dead code
  • Loading branch information
kyouko-taiga authored Aug 31, 2024
2 parents 0bbf994 + 414bfb0 commit e2af44c
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 117 deletions.
16 changes: 3 additions & 13 deletions Sources/CodeGen/LLVM/TypeLowering.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,9 @@ extension IR.Program {
boundGenericType t: BoundGenericType, in module: inout SwiftyLLVM.Module
) -> SwiftyLLVM.IRType {
precondition(t[.isCanonical])

switch t.base.base {
case is ProductType:
return demandStruct(named: base.mangled(t), in: &module) { (m) in
llvm(fields: base.storage(of: t), in: &m)
}

case is TupleType:
let fs = llvm(fields: base.storage(of: t), in: &module)
return SwiftyLLVM.StructType(fs, in: &module)

default:
unreachable()
precondition(t.base.base is ProductType)
return demandStruct(named: base.mangled(t), in: &module) { (m) in
llvm(fields: base.storage(of: t), in: &m)
}
}

Expand Down
23 changes: 0 additions & 23 deletions Sources/IR/Analysis/Module+NormalizeObjectStates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ extension Module {
pc = successor(of: user)
case is EndProject:
pc = interpret(endProject: user, in: &context)
case is EndProjectWitness:
pc = interpret(endProjectWitness: user, in: &context)
case is GenericParameter:
pc = interpret(genericParameter: user, in: &context)
case is GlobalAddr:
Expand All @@ -78,8 +76,6 @@ extension Module {
pc = interpret(pointerToAddress: user, in: &context)
case is Project:
pc = interpret(project: user, in: &context)
case is ProjectWitness:
pc = interpret(projectWitness: user, in: &context)
case is ReleaseCaptures:
pc = successor(of: user)
case is Return:
Expand Down Expand Up @@ -326,18 +322,6 @@ extension Module {
return successor(of: i)
}

/// Interprets `i` in `context`, reporting violations into `diagnostics`.
func interpret(endProjectWitness i: InstructionID, in context: inout Context) -> PC? {
let s = self[i] as! EndProjectWitness
let r = self[s.start.instruction!] as! ProjectWitness

let sources = context.locals[r.container]!.unwrapLocations()!
finalize(
region: s.start, projecting: r.projection.access, from: sources,
exitedWith: i, in: &context)
return successor(of: i)
}

/// Interprets `i` in `context`, reporting violations into `diagnostics`.
func interpret(genericParameter i: InstructionID, in context: inout Context) -> PC? {
context.declareStorage(assignedTo: i, in: self, initially: .initialized)
Expand Down Expand Up @@ -445,13 +429,6 @@ extension Module {
return successor(of: i)
}

/// Interprets `i` in `context`, reporting violations into `diagnostics`.
func interpret(projectWitness i: InstructionID, in context: inout Context) -> PC? {
let s = self[i] as! ProjectWitness
initializeRegister(createdBy: i, projecting: s.projection, in: &context)
return successor(of: i)
}

/// Interprets `i` in `context`, reporting violations into `diagnostics`.
func interpret(return i: InstructionID, in context: inout Context) -> PC? {
// Make sure that all non-sink parameters are initialized on exit.
Expand Down
11 changes: 0 additions & 11 deletions Sources/IR/Analysis/Module+Ownership.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ extension Module {
interpret(endBorrow: user, in: &context)
case is EndProject:
interpret(endProject: user, in: &context)
case is EndProject:
interpret(endProjectWitness: user, in: &context)
case is GenericParameter:
interpret(genericParameter: user, in: &context)
case is GlobalAddr:
Expand All @@ -47,8 +45,6 @@ extension Module {
interpret(pointerToAddress: user, in: &context)
case is Project:
interpret(project: user, in: &context)
case is ProjectWitness:
interpret(projectWitness: user, in: &context)
case is SubfieldView:
interpret(subfieldView: user, in: &context)
case is WrapExistentialAddr:
Expand Down Expand Up @@ -224,13 +220,6 @@ extension Module {
finalize(region: s.start, projecting: r.projection.access, exitedWith: i, in: &context)
}

/// Interprets `i` in `context`, reporting violations into `diagnostics`.
func interpret(endProjectWitness i: InstructionID, in context: inout Context) {
let s = self[i] as! EndProjectWitness
let r = self[s.start.instruction!] as! Project
finalize(region: s.start, projecting: r.projection.access, exitedWith: i, in: &context)
}

/// Interprets `i` in `context`, reporting violations into `diagnostics`.
func interpret(genericParameter i: InstructionID, in context: inout Context) {
context.declareStorage(assignedTo: i, in: self, initially: .unique)
Expand Down
13 changes: 0 additions & 13 deletions Sources/IR/Operands/Instruction/EndProjectWitness.swift

This file was deleted.

55 changes: 0 additions & 55 deletions Sources/IR/Operands/Instruction/ProjectWitness.swift

This file was deleted.

2 changes: 0 additions & 2 deletions Sources/IR/Operands/Instruction/RegionExit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ extension RegionExit: CustomStringConvertible {
return "close_union \(start)"
case let s where s == Project.self:
return "end_project \(start)"
case let s where s == ProjectWitness.self:
return "end_project_witness \(start)"
default:
return "end_region \(start)"
}
Expand Down

0 comments on commit e2af44c

Please sign in to comment.