diff --git a/src/Lean/Compiler/ExternAttr.lean b/src/Lean/Compiler/ExternAttr.lean index 3c117c5aa4..c33838e525 100644 --- a/src/Lean/Compiler/ExternAttr.lean +++ b/src/Lean/Compiler/ExternAttr.lean @@ -18,7 +18,7 @@ inductive ExternEntry where | inline (backend : Name) (pattern : String) | standard (backend : Name) (fn : String) /-- Call to a Lean function without exported IR. -/ - | opaque (fn : Name) + | opaque deriving BEq, Hashable /-- diff --git a/src/Lean/Compiler/IR/CompilerM.lean b/src/Lean/Compiler/IR/CompilerM.lean index 2b8b9633c3..998bbdbcf4 100644 --- a/src/Lean/Compiler/IR/CompilerM.lean +++ b/src/Lean/Compiler/IR/CompilerM.lean @@ -132,7 +132,7 @@ builtin_initialize declMapExt : SimplePersistentEnvExtension Decl DeclMap ← if let some (.str _ s) := getExportNameFor? env f then return .extern f xs ty { entries := [.standard `all s] } else - return .extern f xs ty { entries := [.opaque f] } + return .extern f xs ty { entries := [.opaque] } | d => some d else entries -- Written to on codegen environment branch but accessed from other elaboration branches when diff --git a/src/Lean/Compiler/IR/EmitC.lean b/src/Lean/Compiler/IR/EmitC.lean index 03bc22778d..5095802060 100644 --- a/src/Lean/Compiler/IR/EmitC.lean +++ b/src/Lean/Compiler/IR/EmitC.lean @@ -433,7 +433,7 @@ def emitFullApp (z : VarId) (f : FunId) (ys : Array Arg) : M Unit := do emitLhs z let decl ← getDecl f match decl with - | .fdecl (xs := ps) .. | .extern (xs := ps) (ext := { entries := [.opaque _], .. }) .. => + | .fdecl (xs := ps) .. | .extern (xs := ps) (ext := { entries := [.opaque], .. }) .. => emitCName f if ys.size > 0 then let (ys, _) := ys.zip ps |>.filter (fun (_, p) => !p.ty.isVoid) |>.unzip diff --git a/src/Lean/Compiler/IR/EmitLLVM.lean b/src/Lean/Compiler/IR/EmitLLVM.lean index 0a30d8587e..900f6e9e22 100644 --- a/src/Lean/Compiler/IR/EmitLLVM.lean +++ b/src/Lean/Compiler/IR/EmitLLVM.lean @@ -679,7 +679,7 @@ def emitExternCall (builder : LLVM.Builder llvmctx) | some (ExternEntry.standard _ extFn) => emitSimpleExternalCall builder extFn ps ys retty name | some (ExternEntry.inline `llvm _pat) => throw "Unimplemented codegen of inline LLVM" | some (ExternEntry.inline _ pat) => throw s!"Cannot codegen non-LLVM inline code '{pat}'." - | some (ExternEntry.opaque _) => unreachable! + | some ExternEntry.opaque => unreachable! | _ => throw s!"Failed to emit extern application '{f}'." def getFunIdTy (f : FunId) : M llvmctx (LLVM.LLVMType llvmctx) := do @@ -754,7 +754,7 @@ def emitFullApp (builder : LLVM.Builder llvmctx) let (__zty, zslot) ← emitLhsSlot_ z let decl ← getDecl f match decl with - | .fdecl .. | .extern _ _ _ { entries := [.opaque _] } => + | .fdecl .. | .extern _ _ _ { entries := [.opaque] } => if ys.size > 0 then let fv ← getOrAddFunIdValue builder f let ys ← ys.mapM (fun y => do diff --git a/src/Lean/Compiler/LCNF/PhaseExt.lean b/src/Lean/Compiler/LCNF/PhaseExt.lean index 0e6139fe92..34a84cabb6 100644 --- a/src/Lean/Compiler/LCNF/PhaseExt.lean +++ b/src/Lean/Compiler/LCNF/PhaseExt.lean @@ -114,7 +114,7 @@ def mkDeclExt (phase : Phase) (name : Name := by exact decl_name%) : IO DeclExt if isDeclTransparent env phase decl.name then some decl else - some { decl with value := .extern { entries := [.opaque decl.name] } } + some { decl with value := .extern { entries := [.opaque] } } return entries statsFn := fun s => let numEntries := s.foldl (init := 0) (fun count _ _ => count + 1)