feat(library/init/lean/compiler/inline): implement tester functions and export them
This commit is contained in:
parent
dbe38b054d
commit
9b457cc77c
8 changed files with 726 additions and 86 deletions
|
|
@ -5,8 +5,10 @@ Authors: Leonardo de Moura
|
|||
-/
|
||||
prelude
|
||||
import init.lean.attributes
|
||||
import init.lean.compiler.util
|
||||
|
||||
namespace Lean
|
||||
namespace Compiler
|
||||
|
||||
private def checkIsDefinition (env : Environment) (n : Name) : Except String Unit :=
|
||||
match env.find n with
|
||||
|
|
@ -30,4 +32,29 @@ def mkMacroInlineAttribute : IO TagAttribute :=
|
|||
registerTagAttribute `macroInline "mark definition to always be inlined before ANF conversion" checkIsDefinition
|
||||
@[init mkMacroInlineAttribute] constant macroInlineAttribute : TagAttribute := default _
|
||||
|
||||
private partial def hasInlineAttrAux (env : Environment) (attr : TagAttribute) : Name → Bool
|
||||
| n :=
|
||||
/- We never inline auxiliary declarations created by eager lambda lifting -/
|
||||
if isEagerLambdaLiftingName n then false
|
||||
else if attr.hasTag env n then true
|
||||
else if n.isInternal then hasInlineAttrAux n.getPrefix
|
||||
else false
|
||||
|
||||
@[export lean.has_inline_attribute_core]
|
||||
def hasInlineAttribure (env : Environment) (n : Name) : Bool :=
|
||||
hasInlineAttrAux env inlineAttribute n
|
||||
|
||||
@[export lean.has_inline_if_reduce_attribute_core]
|
||||
def hasInlineIfReduceAttribure (env : Environment) (n : Name) : Bool :=
|
||||
hasInlineAttrAux env inlineIfReduceAttribute n
|
||||
|
||||
@[export lean.has_no_inline_attribute_core]
|
||||
def hasNoInlineAttribure (env : Environment) (n : Name) : Bool :=
|
||||
hasInlineAttrAux env noInlineAttribute n
|
||||
|
||||
@[export lean.has_macro_inline_attribute_core]
|
||||
def hasMacroInlineAttribure (env : Environment) (n : Name) : Bool :=
|
||||
hasInlineAttrAux env macroInlineAttribute n
|
||||
|
||||
end Compiler
|
||||
end Lean
|
||||
|
|
|
|||
|
|
@ -55,5 +55,17 @@ def atMostOnce (e : Expr) (x : Name) : Bool :=
|
|||
let {result := result, ..} := atMostOnce.visit x e {found := false, result := true} in
|
||||
result
|
||||
|
||||
/- Helper functions for creating auxiliary names used in compiler passes. -/
|
||||
|
||||
@[export lean.mk_eager_lambda_lifting_name_core]
|
||||
def mkEagerLambdaLiftingName (n : Name) (idx : Nat) : Name :=
|
||||
Name.mkString n ("_elambda_" ++ toString idx)
|
||||
|
||||
@[export lean.is_eager_lambda_lifting_name_core]
|
||||
def isEagerLambdaLiftingName : Name → Bool
|
||||
| (Name.mkString p s) := "_elambda".isPrefixOf s || isEagerLambdaLiftingName p
|
||||
| (Name.mkNumeral p _) := isEagerLambdaLiftingName p
|
||||
| _ := false
|
||||
|
||||
end Compiler
|
||||
end Lean
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ def appendIndexAfter : Name → Nat → Name
|
|||
| (mkString p s) idx := mkString p (s ++ "_" ++ toString idx)
|
||||
| n idx := mkString n ("_" ++ toString idx)
|
||||
|
||||
/- The frontend does not allow user declarations to start with `_` in any of its parts.
|
||||
We use name parts starting with `_` internally to create auxiliary names (e.g., `_private`). -/
|
||||
def isInternal : Name → Bool
|
||||
| (mkString p s) := s.get 0 == '_' || isInternal p
|
||||
| (mkNumeral p _) := isInternal p
|
||||
| _ := false
|
||||
|
||||
theorem mkStringNeMkStringOfNePrefix {p₁ : Name} (s₁ : String) {p₂ : Name} (s₂ : String) : p₁ ≠ p₂ → mkString p₁ s₁ ≠ mkString p₂ s₂ :=
|
||||
λ h₁ h₂, Name.noConfusion h₂ (λ h _, absurd h h₁)
|
||||
|
||||
|
|
|
|||
107
src/stage0/init/data/string/basic.cpp
generated
107
src/stage0/init/data/string/basic.cpp
generated
|
|
@ -80,6 +80,8 @@ uint8 l_String_Iterator_hasPrev___main(obj*);
|
|||
obj* l_Char_toString___boxed(obj*);
|
||||
obj* l_String_push___boxed(obj*, obj*);
|
||||
obj* l_Substring_takeRightWhileAux___main___boxed(obj*, obj*, obj*, obj*);
|
||||
uint8 l_String_isPrefixOf(obj*, obj*);
|
||||
obj* l_String_isPrefixOfAux___main___boxed(obj*, obj*, obj*);
|
||||
obj* l_String_foldrAux___rarg(obj*, obj*, obj*, obj*, obj*);
|
||||
obj* l_String_dropRight___boxed(obj*, obj*);
|
||||
obj* l___private_init_data_string_basic_4__utf8SetAux___main(uint32, obj*, obj*, obj*);
|
||||
|
|
@ -139,6 +141,7 @@ obj* l_String_takeRight___boxed(obj*, obj*);
|
|||
obj* l_Substring_drop___main(obj*, obj*);
|
||||
obj* l_String_Iterator_toString(obj*);
|
||||
obj* l_Substring_drop(obj*, obj*);
|
||||
obj* l_String_isPrefixOfAux___boxed(obj*, obj*, obj*);
|
||||
obj* l___private_init_data_string_basic_6__utf8ExtractAux_u2082___main(obj*, obj*, obj*);
|
||||
obj* l_Substring_trim___main(obj*);
|
||||
obj* l_Char_toString(uint32);
|
||||
|
|
@ -157,6 +160,7 @@ obj* l_String_contains___boxed(obj*, obj*);
|
|||
obj* l___private_init_data_string_basic_5__utf8PrevAux___main(obj*, obj*, obj*);
|
||||
obj* l_Substring_posOf(obj*, uint32);
|
||||
uint8 l_String_anyAux___main___at_Substring_contains___spec__1(uint32, obj*, obj*, obj*);
|
||||
obj* l_String_isPrefixOf___boxed(obj*, obj*);
|
||||
obj* l_String_offsetOfPosAux___main___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_String_offsetOfPosAux(obj*, obj*, obj*, obj*);
|
||||
obj* l_String_Iterator_next___main(obj*);
|
||||
|
|
@ -219,6 +223,7 @@ obj* l_Substring_takeRight___main(obj*, obj*);
|
|||
obj* l_Substring_takeRightWhileAux___main(obj*, obj*, obj*, obj*);
|
||||
obj* l_String_join(obj*);
|
||||
obj* l_String_Iterator_remainingBytes___main___boxed(obj*);
|
||||
uint8 l_String_isPrefixOfAux___main(obj*, obj*, obj*);
|
||||
namespace lean {
|
||||
uint8 nat_dec_eq(obj*, obj*);
|
||||
}
|
||||
|
|
@ -300,6 +305,7 @@ obj* l_Substring_toString___boxed(obj*);
|
|||
obj* l_String_HasSizeof;
|
||||
uint32 l_String_front(obj*);
|
||||
uint8 l_String_anyAux___main___at_String_all___spec__1(obj*, obj*, obj*, obj*);
|
||||
uint8 l_String_isPrefixOfAux(obj*, obj*, obj*);
|
||||
obj* l_Substring_get___main___boxed(obj*, obj*);
|
||||
obj* l_String_anyAux___main___boxed(obj*, obj*, obj*, obj*);
|
||||
uint32 l___private_init_data_string_basic_3__utf8GetAux___main(obj*, obj*, obj*);
|
||||
|
|
@ -3098,6 +3104,107 @@ x_3 = lean::box(x_2);
|
|||
return x_3;
|
||||
}
|
||||
}
|
||||
uint8 l_String_isPrefixOfAux___main(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4;
|
||||
x_4 = lean::string_utf8_at_end(x_1, x_3);
|
||||
if (x_4 == 0)
|
||||
{
|
||||
uint32 x_5; uint32 x_6; uint8 x_7;
|
||||
x_5 = lean::string_utf8_get(x_1, x_3);
|
||||
x_6 = lean::string_utf8_get(x_2, x_3);
|
||||
x_7 = x_5 == x_6;
|
||||
if (x_7 == 0)
|
||||
{
|
||||
uint8 x_8;
|
||||
lean::dec(x_3);
|
||||
x_8 = 0;
|
||||
return x_8;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_9;
|
||||
x_9 = lean::string_utf8_next(x_2, x_3);
|
||||
lean::dec(x_3);
|
||||
x_3 = x_9;
|
||||
goto _start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_11;
|
||||
lean::dec(x_3);
|
||||
x_11 = 1;
|
||||
return x_11;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_String_isPrefixOfAux___main___boxed(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4; obj* x_5;
|
||||
x_4 = l_String_isPrefixOfAux___main(x_1, x_2, x_3);
|
||||
lean::dec(x_2);
|
||||
lean::dec(x_1);
|
||||
x_5 = lean::box(x_4);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
uint8 l_String_isPrefixOfAux(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4;
|
||||
x_4 = l_String_isPrefixOfAux___main(x_1, x_2, x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* l_String_isPrefixOfAux___boxed(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4; obj* x_5;
|
||||
x_4 = l_String_isPrefixOfAux(x_1, x_2, x_3);
|
||||
lean::dec(x_2);
|
||||
lean::dec(x_1);
|
||||
x_5 = lean::box(x_4);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
uint8 l_String_isPrefixOf(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; obj* x_4; uint8 x_5;
|
||||
x_3 = lean::string_length(x_1);
|
||||
x_4 = lean::string_length(x_2);
|
||||
x_5 = lean::nat_dec_le(x_3, x_4);
|
||||
lean::dec(x_4);
|
||||
lean::dec(x_3);
|
||||
if (x_5 == 0)
|
||||
{
|
||||
uint8 x_6;
|
||||
x_6 = 0;
|
||||
return x_6;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_7; uint8 x_8;
|
||||
x_7 = lean::mk_nat_obj(0u);
|
||||
x_8 = l_String_isPrefixOfAux___main(x_1, x_2, x_7);
|
||||
return x_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_String_isPrefixOf___boxed(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_3; obj* x_4;
|
||||
x_3 = l_String_isPrefixOf(x_1, x_2);
|
||||
lean::dec(x_2);
|
||||
lean::dec(x_1);
|
||||
x_4 = lean::box(x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* l_Substring_toString___main(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
|
|
|
|||
335
src/stage0/init/lean/compiler/inline.cpp
generated
335
src/stage0/init/lean/compiler/inline.cpp
generated
|
|
@ -1,6 +1,6 @@
|
|||
// Lean compiler output
|
||||
// Module: init.lean.compiler.inline
|
||||
// Imports: init.lean.attributes
|
||||
// Imports: init.lean.attributes init.lean.compiler.util
|
||||
#include "runtime/object.h"
|
||||
#include "runtime/apply.h"
|
||||
typedef lean::object obj; typedef lean::usize usize;
|
||||
|
|
@ -14,41 +14,65 @@ typedef lean::uint32 uint32; typedef lean::uint64 uint64;
|
|||
#pragma GCC diagnostic ignored "-Wunused-label"
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif
|
||||
obj* l_Lean_mkMacroInlineAttribute___closed__1;
|
||||
obj* l_Lean_mkInlineIfReduceAttribute___closed__2;
|
||||
obj* l_Lean_Compiler_mkInlineIfReduceAttribute___closed__1;
|
||||
obj* l_Lean_Compiler_hasInlineIfReduceAttribure___boxed(obj*, obj*);
|
||||
obj* l_Lean_Compiler_mkMacroInlineAttribute___closed__2;
|
||||
obj* l_Lean_AttributeImpl_inhabited___lambda__4___boxed(obj*, obj*, obj*);
|
||||
obj* l_Lean_mkNoInlineAttribute___closed__1;
|
||||
obj* l_Lean_mkInlineAttribute___closed__3;
|
||||
obj* l_Lean_Compiler_mkNoInlineAttribute(obj*);
|
||||
obj* l_Lean_Compiler_mkMacroInlineAttribute(obj*);
|
||||
obj* l_Lean_AttributeImpl_inhabited___lambda__3___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_PersistentEnvExtension_inhabited___rarg___lambda__1___boxed(obj*);
|
||||
obj* l_Lean_macroInlineAttribute;
|
||||
obj* l_Lean_inlineIfReduceAttribute;
|
||||
obj* l_Lean_mkMacroInlineAttribute___closed__2;
|
||||
obj* l_Lean_mkNoInlineAttribute___closed__2;
|
||||
obj* l_Lean_mkInlineIfReduceAttribute(obj*);
|
||||
obj* l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main___boxed(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_noInlineAttribute;
|
||||
obj* l_Lean_Compiler_mkInlineAttribute___closed__1;
|
||||
obj* l___private_init_lean_compiler_inline_2__hasInlineAttrAux___boxed(obj*, obj*, obj*);
|
||||
uint8 l_Lean_Compiler_isEagerLambdaLiftingName___main(obj*);
|
||||
obj* l_Lean_Compiler_inlineAttribute;
|
||||
obj* l_Lean_Compiler_inlineIfReduceAttribute;
|
||||
obj* l_Array_mkEmpty(obj*, obj*);
|
||||
namespace lean {
|
||||
uint8 has_macro_inline_attribute_core(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_registerTagAttribute(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_mkInlineIfReduceAttribute___closed__1;
|
||||
obj* l_Lean_AttributeImpl_inhabited___lambda__5(obj*, obj*);
|
||||
obj* l_Lean_Compiler_mkInlineAttribute(obj*);
|
||||
namespace lean {
|
||||
uint8 has_inline_if_reduce_attribute_core(obj*, obj*);
|
||||
}
|
||||
obj* l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__1;
|
||||
obj* l_Lean_Compiler_hasInlineAttribure___boxed(obj*, obj*);
|
||||
namespace lean {
|
||||
uint8 has_no_inline_attribute_core(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_Compiler_mkInlineAttribute___closed__2;
|
||||
obj* l_Lean_AttributeImpl_inhabited___lambda__1___boxed(obj*, obj*, obj*, obj*, obj*);
|
||||
obj* l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__2;
|
||||
extern "C" obj* lean_name_mk_string(obj*, obj*);
|
||||
obj* l_Lean_Compiler_hasNoInlineAttribure___boxed(obj*, obj*);
|
||||
uint8 l___private_init_lean_compiler_inline_2__hasInlineAttrAux(obj*, obj*, obj*);
|
||||
obj* l_ExceptT_Monad___rarg___lambda__8___boxed(obj*, obj*);
|
||||
obj* l_Lean_mkInlineAttribute___closed__2;
|
||||
obj* l_Lean_mkMacroInlineAttribute(obj*);
|
||||
obj* l_Lean_Compiler_hasMacroInlineAttribure___boxed(obj*, obj*);
|
||||
obj* l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__3;
|
||||
obj* l_Lean_inlineAttribute;
|
||||
uint8 l_Lean_TagAttribute_hasTag(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_macroInlineAttribute;
|
||||
obj* l___private_init_lean_compiler_inline_1__checkIsDefinition(obj*, obj*);
|
||||
namespace lean {
|
||||
obj* environment_find_core(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_PersistentEnvExtension_inhabited___rarg___lambda__2___boxed(obj*);
|
||||
obj* l_Lean_noInlineAttribute;
|
||||
obj* l_Lean_mkInlineAttribute(obj*);
|
||||
obj* l_Lean_mkNoInlineAttribute(obj*);
|
||||
obj* l_Lean_Compiler_mkMacroInlineAttribute___closed__1;
|
||||
obj* l_Lean_Name_getPrefix___main(obj*);
|
||||
obj* l_Lean_Compiler_mkInlineIfReduceAttribute(obj*);
|
||||
obj* l_Lean_Compiler_mkInlineAttribute___closed__3;
|
||||
obj* l_Lean_Compiler_mkNoInlineAttribute___closed__2;
|
||||
obj* l_Lean_AttributeImpl_inhabited___lambda__2___boxed(obj*, obj*, obj*, obj*);
|
||||
obj* l_Lean_mkInlineAttribute___closed__1;
|
||||
obj* l_Lean_Compiler_mkNoInlineAttribute___closed__1;
|
||||
uint8 l_Lean_Name_isInternal___main(obj*);
|
||||
uint8 l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_mkInlineIfReduceAttribute___closed__2;
|
||||
namespace lean {
|
||||
uint8 has_inline_attribute_core(obj*, obj*);
|
||||
}
|
||||
obj* _init_l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__1() {
|
||||
_start:
|
||||
{
|
||||
|
|
@ -113,7 +137,7 @@ return x_7;
|
|||
}
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkInlineAttribute___closed__1() {
|
||||
obj* _init_l_Lean_Compiler_mkInlineAttribute___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
|
|
@ -123,7 +147,7 @@ x_3 = lean_name_mk_string(x_1, x_2);
|
|||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkInlineAttribute___closed__2() {
|
||||
obj* _init_l_Lean_Compiler_mkInlineAttribute___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
|
|
@ -131,7 +155,7 @@ x_1 = lean::mk_string("mark definition to always be inlined");
|
|||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkInlineAttribute___closed__3() {
|
||||
obj* _init_l_Lean_Compiler_mkInlineAttribute___closed__3() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
|
|
@ -139,18 +163,18 @@ x_1 = lean::alloc_closure(reinterpret_cast<void*>(l___private_init_lean_compiler
|
|||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkInlineAttribute(obj* x_1) {
|
||||
obj* l_Lean_Compiler_mkInlineAttribute(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3; obj* x_4; obj* x_5;
|
||||
x_2 = l_Lean_mkInlineAttribute___closed__1;
|
||||
x_3 = l_Lean_mkInlineAttribute___closed__2;
|
||||
x_4 = l_Lean_mkInlineAttribute___closed__3;
|
||||
x_2 = l_Lean_Compiler_mkInlineAttribute___closed__1;
|
||||
x_3 = l_Lean_Compiler_mkInlineAttribute___closed__2;
|
||||
x_4 = l_Lean_Compiler_mkInlineAttribute___closed__3;
|
||||
x_5 = l_Lean_registerTagAttribute(x_2, x_3, x_4, x_1);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkInlineIfReduceAttribute___closed__1() {
|
||||
obj* _init_l_Lean_Compiler_mkInlineIfReduceAttribute___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
|
|
@ -160,7 +184,7 @@ x_3 = lean_name_mk_string(x_1, x_2);
|
|||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkInlineIfReduceAttribute___closed__2() {
|
||||
obj* _init_l_Lean_Compiler_mkInlineIfReduceAttribute___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
|
|
@ -168,18 +192,18 @@ x_1 = lean::mk_string("mark definition to be inlined when resultant term after r
|
|||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkInlineIfReduceAttribute(obj* x_1) {
|
||||
obj* l_Lean_Compiler_mkInlineIfReduceAttribute(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3; obj* x_4; obj* x_5;
|
||||
x_2 = l_Lean_mkInlineIfReduceAttribute___closed__1;
|
||||
x_3 = l_Lean_mkInlineIfReduceAttribute___closed__2;
|
||||
x_4 = l_Lean_mkInlineAttribute___closed__3;
|
||||
x_2 = l_Lean_Compiler_mkInlineIfReduceAttribute___closed__1;
|
||||
x_3 = l_Lean_Compiler_mkInlineIfReduceAttribute___closed__2;
|
||||
x_4 = l_Lean_Compiler_mkInlineAttribute___closed__3;
|
||||
x_5 = l_Lean_registerTagAttribute(x_2, x_3, x_4, x_1);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkNoInlineAttribute___closed__1() {
|
||||
obj* _init_l_Lean_Compiler_mkNoInlineAttribute___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
|
|
@ -189,7 +213,7 @@ x_3 = lean_name_mk_string(x_1, x_2);
|
|||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkNoInlineAttribute___closed__2() {
|
||||
obj* _init_l_Lean_Compiler_mkNoInlineAttribute___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
|
|
@ -197,18 +221,18 @@ x_1 = lean::mk_string("mark definition to never be inlined");
|
|||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkNoInlineAttribute(obj* x_1) {
|
||||
obj* l_Lean_Compiler_mkNoInlineAttribute(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3; obj* x_4; obj* x_5;
|
||||
x_2 = l_Lean_mkNoInlineAttribute___closed__1;
|
||||
x_3 = l_Lean_mkNoInlineAttribute___closed__2;
|
||||
x_4 = l_Lean_mkInlineAttribute___closed__3;
|
||||
x_2 = l_Lean_Compiler_mkNoInlineAttribute___closed__1;
|
||||
x_3 = l_Lean_Compiler_mkNoInlineAttribute___closed__2;
|
||||
x_4 = l_Lean_Compiler_mkInlineAttribute___closed__3;
|
||||
x_5 = l_Lean_registerTagAttribute(x_2, x_3, x_4, x_1);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkMacroInlineAttribute___closed__1() {
|
||||
obj* _init_l_Lean_Compiler_mkMacroInlineAttribute___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1; obj* x_2; obj* x_3;
|
||||
|
|
@ -218,7 +242,7 @@ x_3 = lean_name_mk_string(x_1, x_2);
|
|||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_mkMacroInlineAttribute___closed__2() {
|
||||
obj* _init_l_Lean_Compiler_mkMacroInlineAttribute___closed__2() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
|
|
@ -226,18 +250,181 @@ x_1 = lean::mk_string("mark definition to always be inlined before ANF conversio
|
|||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkMacroInlineAttribute(obj* x_1) {
|
||||
obj* l_Lean_Compiler_mkMacroInlineAttribute(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
obj* x_2; obj* x_3; obj* x_4; obj* x_5;
|
||||
x_2 = l_Lean_mkMacroInlineAttribute___closed__1;
|
||||
x_3 = l_Lean_mkMacroInlineAttribute___closed__2;
|
||||
x_4 = l_Lean_mkInlineAttribute___closed__3;
|
||||
x_2 = l_Lean_Compiler_mkMacroInlineAttribute___closed__1;
|
||||
x_3 = l_Lean_Compiler_mkMacroInlineAttribute___closed__2;
|
||||
x_4 = l_Lean_Compiler_mkInlineAttribute___closed__3;
|
||||
x_5 = l_Lean_registerTagAttribute(x_2, x_3, x_4, x_1);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
uint8 l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4;
|
||||
x_4 = l_Lean_Compiler_isEagerLambdaLiftingName___main(x_3);
|
||||
if (x_4 == 0)
|
||||
{
|
||||
uint8 x_5;
|
||||
lean::inc(x_2);
|
||||
x_5 = l_Lean_TagAttribute_hasTag(x_2, x_1, x_3);
|
||||
if (x_5 == 0)
|
||||
{
|
||||
uint8 x_6;
|
||||
x_6 = l_Lean_Name_isInternal___main(x_3);
|
||||
if (x_6 == 0)
|
||||
{
|
||||
uint8 x_7;
|
||||
lean::dec(x_3);
|
||||
lean::dec(x_2);
|
||||
x_7 = 0;
|
||||
return x_7;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj* x_8;
|
||||
x_8 = l_Lean_Name_getPrefix___main(x_3);
|
||||
lean::dec(x_3);
|
||||
x_3 = x_8;
|
||||
goto _start;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_10;
|
||||
lean::dec(x_3);
|
||||
lean::dec(x_2);
|
||||
x_10 = 1;
|
||||
return x_10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_11;
|
||||
lean::dec(x_3);
|
||||
lean::dec(x_2);
|
||||
x_11 = 0;
|
||||
return x_11;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main___boxed(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4; obj* x_5;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(x_1, x_2, x_3);
|
||||
lean::dec(x_1);
|
||||
x_5 = lean::box(x_4);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
uint8 l___private_init_lean_compiler_inline_2__hasInlineAttrAux(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(x_1, x_2, x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* l___private_init_lean_compiler_inline_2__hasInlineAttrAux___boxed(obj* x_1, obj* x_2, obj* x_3) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_4; obj* x_5;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux(x_1, x_2, x_3);
|
||||
lean::dec(x_1);
|
||||
x_5 = lean::box(x_4);
|
||||
return x_5;
|
||||
}
|
||||
}
|
||||
namespace lean {
|
||||
uint8 has_inline_attribute_core(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; uint8 x_4;
|
||||
x_3 = l_Lean_Compiler_inlineAttribute;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(x_1, x_3, x_2);
|
||||
lean::dec(x_1);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Compiler_hasInlineAttribure___boxed(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_3; obj* x_4;
|
||||
x_3 = lean::has_inline_attribute_core(x_1, x_2);
|
||||
x_4 = lean::box(x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
namespace lean {
|
||||
uint8 has_inline_if_reduce_attribute_core(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; uint8 x_4;
|
||||
x_3 = l_Lean_Compiler_inlineIfReduceAttribute;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(x_1, x_3, x_2);
|
||||
lean::dec(x_1);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Compiler_hasInlineIfReduceAttribure___boxed(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_3; obj* x_4;
|
||||
x_3 = lean::has_inline_if_reduce_attribute_core(x_1, x_2);
|
||||
x_4 = lean::box(x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
namespace lean {
|
||||
uint8 has_no_inline_attribute_core(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; uint8 x_4;
|
||||
x_3 = l_Lean_Compiler_noInlineAttribute;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(x_1, x_3, x_2);
|
||||
lean::dec(x_1);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Compiler_hasNoInlineAttribure___boxed(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_3; obj* x_4;
|
||||
x_3 = lean::has_no_inline_attribute_core(x_1, x_2);
|
||||
x_4 = lean::box(x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
namespace lean {
|
||||
uint8 has_macro_inline_attribute_core(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; uint8 x_4;
|
||||
x_3 = l_Lean_Compiler_macroInlineAttribute;
|
||||
x_4 = l___private_init_lean_compiler_inline_2__hasInlineAttrAux___main(x_1, x_3, x_2);
|
||||
lean::dec(x_1);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Compiler_hasMacroInlineAttribure___boxed(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_3; obj* x_4;
|
||||
x_3 = lean::has_macro_inline_attribute_core(x_1, x_2);
|
||||
x_4 = lean::box(x_3);
|
||||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* initialize_init_lean_attributes(obj*);
|
||||
obj* initialize_init_lean_compiler_util(obj*);
|
||||
static bool _G_initialized = false;
|
||||
obj* initialize_init_lean_compiler_inline(obj* w) {
|
||||
if (_G_initialized) return w;
|
||||
|
|
@ -245,45 +432,47 @@ _G_initialized = true;
|
|||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_attributes(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
w = initialize_init_lean_compiler_util(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__1 = _init_l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__1();
|
||||
lean::mark_persistent(l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__1);
|
||||
l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__2 = _init_l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__2();
|
||||
lean::mark_persistent(l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__2);
|
||||
l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__3 = _init_l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__3();
|
||||
lean::mark_persistent(l___private_init_lean_compiler_inline_1__checkIsDefinition___closed__3);
|
||||
l_Lean_mkInlineAttribute___closed__1 = _init_l_Lean_mkInlineAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_mkInlineAttribute___closed__1);
|
||||
l_Lean_mkInlineAttribute___closed__2 = _init_l_Lean_mkInlineAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_mkInlineAttribute___closed__2);
|
||||
l_Lean_mkInlineAttribute___closed__3 = _init_l_Lean_mkInlineAttribute___closed__3();
|
||||
lean::mark_persistent(l_Lean_mkInlineAttribute___closed__3);
|
||||
w = l_Lean_mkInlineAttribute(w);
|
||||
l_Lean_Compiler_mkInlineAttribute___closed__1 = _init_l_Lean_Compiler_mkInlineAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkInlineAttribute___closed__1);
|
||||
l_Lean_Compiler_mkInlineAttribute___closed__2 = _init_l_Lean_Compiler_mkInlineAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkInlineAttribute___closed__2);
|
||||
l_Lean_Compiler_mkInlineAttribute___closed__3 = _init_l_Lean_Compiler_mkInlineAttribute___closed__3();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkInlineAttribute___closed__3);
|
||||
w = l_Lean_Compiler_mkInlineAttribute(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_inlineAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_inlineAttribute);
|
||||
l_Lean_mkInlineIfReduceAttribute___closed__1 = _init_l_Lean_mkInlineIfReduceAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_mkInlineIfReduceAttribute___closed__1);
|
||||
l_Lean_mkInlineIfReduceAttribute___closed__2 = _init_l_Lean_mkInlineIfReduceAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_mkInlineIfReduceAttribute___closed__2);
|
||||
w = l_Lean_mkInlineIfReduceAttribute(w);
|
||||
l_Lean_Compiler_inlineAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_Compiler_inlineAttribute);
|
||||
l_Lean_Compiler_mkInlineIfReduceAttribute___closed__1 = _init_l_Lean_Compiler_mkInlineIfReduceAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkInlineIfReduceAttribute___closed__1);
|
||||
l_Lean_Compiler_mkInlineIfReduceAttribute___closed__2 = _init_l_Lean_Compiler_mkInlineIfReduceAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkInlineIfReduceAttribute___closed__2);
|
||||
w = l_Lean_Compiler_mkInlineIfReduceAttribute(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_inlineIfReduceAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_inlineIfReduceAttribute);
|
||||
l_Lean_mkNoInlineAttribute___closed__1 = _init_l_Lean_mkNoInlineAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_mkNoInlineAttribute___closed__1);
|
||||
l_Lean_mkNoInlineAttribute___closed__2 = _init_l_Lean_mkNoInlineAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_mkNoInlineAttribute___closed__2);
|
||||
w = l_Lean_mkNoInlineAttribute(w);
|
||||
l_Lean_Compiler_inlineIfReduceAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_Compiler_inlineIfReduceAttribute);
|
||||
l_Lean_Compiler_mkNoInlineAttribute___closed__1 = _init_l_Lean_Compiler_mkNoInlineAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkNoInlineAttribute___closed__1);
|
||||
l_Lean_Compiler_mkNoInlineAttribute___closed__2 = _init_l_Lean_Compiler_mkNoInlineAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkNoInlineAttribute___closed__2);
|
||||
w = l_Lean_Compiler_mkNoInlineAttribute(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_noInlineAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_noInlineAttribute);
|
||||
l_Lean_mkMacroInlineAttribute___closed__1 = _init_l_Lean_mkMacroInlineAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_mkMacroInlineAttribute___closed__1);
|
||||
l_Lean_mkMacroInlineAttribute___closed__2 = _init_l_Lean_mkMacroInlineAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_mkMacroInlineAttribute___closed__2);
|
||||
w = l_Lean_mkMacroInlineAttribute(w);
|
||||
l_Lean_Compiler_noInlineAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_Compiler_noInlineAttribute);
|
||||
l_Lean_Compiler_mkMacroInlineAttribute___closed__1 = _init_l_Lean_Compiler_mkMacroInlineAttribute___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkMacroInlineAttribute___closed__1);
|
||||
l_Lean_Compiler_mkMacroInlineAttribute___closed__2 = _init_l_Lean_Compiler_mkMacroInlineAttribute___closed__2();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkMacroInlineAttribute___closed__2);
|
||||
w = l_Lean_Compiler_mkMacroInlineAttribute(w);
|
||||
if (io_result_is_error(w)) return w;
|
||||
l_Lean_macroInlineAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_macroInlineAttribute);
|
||||
l_Lean_Compiler_macroInlineAttribute = io_result_get_value(w);
|
||||
lean::mark_persistent(l_Lean_Compiler_macroInlineAttribute);
|
||||
return w;
|
||||
}
|
||||
|
|
|
|||
119
src/stage0/init/lean/compiler/util.cpp
generated
119
src/stage0/init/lean/compiler/util.cpp
generated
|
|
@ -17,30 +17,46 @@ typedef lean::uint32 uint32; typedef lean::uint64 uint64;
|
|||
extern "C" uint8 lean_name_dec_eq(obj*, obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce_HasAndthen;
|
||||
obj* l_Lean_Compiler_atMostOnce_seq(obj*, obj*, obj*);
|
||||
uint8 l_String_isPrefixOf(obj*, obj*);
|
||||
extern "C" obj* lean_expr_mk_app(obj*, obj*);
|
||||
namespace lean {
|
||||
uint8 at_most_once_core(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_Compiler_atMostOnce_visit___boxed(obj*, obj*, obj*);
|
||||
uint8 l_Lean_Compiler_isEagerLambdaLiftingName___main(obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce_visit___main___boxed(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce_visitFVar___main(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_mkLcProof(obj*);
|
||||
obj* l_Nat_repr(obj*);
|
||||
extern "C" obj* lean_expr_mk_const(obj*, obj*);
|
||||
obj* l_Lean_Compiler_objectType;
|
||||
namespace lean {
|
||||
obj* string_append(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_Compiler_atMostOnce___closed__1;
|
||||
extern "C" obj* lean_name_mk_string(obj*, obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce_visit___main(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce___boxed(obj*, obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce_visit(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_isEagerLambdaLiftingName___main___closed__1;
|
||||
obj* l_Lean_Compiler_atMostOnce_visitFVar(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_mkEagerLambdaLiftingName___closed__1;
|
||||
obj* l_Lean_Compiler_voidType;
|
||||
obj* l_Lean_Compiler_atMostOnce_skip(obj*);
|
||||
obj* l_Lean_Compiler_atMostOnce_skip___boxed(obj*);
|
||||
namespace lean {
|
||||
uint8 is_eager_lambda_lifting_name_core(obj*);
|
||||
}
|
||||
obj* l_Lean_Compiler_mkLcProof___closed__1;
|
||||
obj* l_Lean_Compiler_isEagerLambdaLiftingName___boxed(obj*);
|
||||
namespace lean {
|
||||
obj* mk_eager_lambda_lifting_name_core(obj*, obj*);
|
||||
}
|
||||
obj* l_Lean_Compiler_neutralExpr;
|
||||
obj* l_Lean_Compiler_atMostOnce_visitFVar___boxed(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_unreachableExpr;
|
||||
obj* l_Lean_Compiler_atMostOnce_visitFVar___main___boxed(obj*, obj*, obj*);
|
||||
obj* l_Lean_Compiler_isEagerLambdaLiftingName___main___boxed(obj*);
|
||||
obj* _init_l_Lean_Compiler_neutralExpr() {
|
||||
_start:
|
||||
{
|
||||
|
|
@ -680,6 +696,105 @@ x_4 = lean::box(x_3);
|
|||
return x_4;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_Compiler_mkEagerLambdaLiftingName___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("_elambda_");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
namespace lean {
|
||||
obj* mk_eager_lambda_lifting_name_core(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3; obj* x_4; obj* x_5; obj* x_6;
|
||||
x_3 = l_Nat_repr(x_2);
|
||||
x_4 = l_Lean_Compiler_mkEagerLambdaLiftingName___closed__1;
|
||||
x_5 = lean::string_append(x_4, x_3);
|
||||
lean::dec(x_3);
|
||||
x_6 = lean_name_mk_string(x_1, x_5);
|
||||
return x_6;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_Compiler_isEagerLambdaLiftingName___main___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("_elambda");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
uint8 l_Lean_Compiler_isEagerLambdaLiftingName___main(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
switch (lean::obj_tag(x_1)) {
|
||||
case 0:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = 0;
|
||||
return x_2;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
obj* x_3; obj* x_4; obj* x_5; uint8 x_6;
|
||||
x_3 = lean::cnstr_get(x_1, 0);
|
||||
x_4 = lean::cnstr_get(x_1, 1);
|
||||
x_5 = l_Lean_Compiler_isEagerLambdaLiftingName___main___closed__1;
|
||||
x_6 = l_String_isPrefixOf(x_5, x_4);
|
||||
if (x_6 == 0)
|
||||
{
|
||||
x_1 = x_3;
|
||||
goto _start;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_8;
|
||||
x_8 = 1;
|
||||
return x_8;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
obj* x_9;
|
||||
x_9 = lean::cnstr_get(x_1, 0);
|
||||
x_1 = x_9;
|
||||
goto _start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Compiler_isEagerLambdaLiftingName___main___boxed(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2; obj* x_3;
|
||||
x_2 = l_Lean_Compiler_isEagerLambdaLiftingName___main(x_1);
|
||||
lean::dec(x_1);
|
||||
x_3 = lean::box(x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
namespace lean {
|
||||
uint8 is_eager_lambda_lifting_name_core(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = l_Lean_Compiler_isEagerLambdaLiftingName___main(x_1);
|
||||
lean::dec(x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Compiler_isEagerLambdaLiftingName___boxed(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2; obj* x_3;
|
||||
x_2 = lean::is_eager_lambda_lifting_name_core(x_1);
|
||||
x_3 = lean::box(x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* initialize_init_lean_expr(obj*);
|
||||
static bool _G_initialized = false;
|
||||
obj* initialize_init_lean_compiler_util(obj* w) {
|
||||
|
|
@ -702,5 +817,9 @@ l_Lean_Compiler_atMostOnce_HasAndthen = _init_l_Lean_Compiler_atMostOnce_HasAndt
|
|||
lean::mark_persistent(l_Lean_Compiler_atMostOnce_HasAndthen);
|
||||
l_Lean_Compiler_atMostOnce___closed__1 = _init_l_Lean_Compiler_atMostOnce___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_atMostOnce___closed__1);
|
||||
l_Lean_Compiler_mkEagerLambdaLiftingName___closed__1 = _init_l_Lean_Compiler_mkEagerLambdaLiftingName___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_mkEagerLambdaLiftingName___closed__1);
|
||||
l_Lean_Compiler_isEagerLambdaLiftingName___main___closed__1 = _init_l_Lean_Compiler_isEagerLambdaLiftingName___main___closed__1();
|
||||
lean::mark_persistent(l_Lean_Compiler_isEagerLambdaLiftingName___main___closed__1);
|
||||
return w;
|
||||
}
|
||||
|
|
|
|||
189
src/stage0/init/lean/name.cpp
generated
189
src/stage0/init/lean/name.cpp
generated
|
|
@ -42,6 +42,7 @@ obj* l_Lean_mkSimpleName(obj*);
|
|||
obj* l_Lean_NameMap_find___rarg(obj*, obj*);
|
||||
obj* l_Lean_mkStrName(obj*, obj*);
|
||||
obj* l_Lean_Name_DecidableEq;
|
||||
obj* l_Lean_Name_appendIndexAfter___main___closed__1;
|
||||
uint8 l_Lean_NameSet_contains(obj*, obj*);
|
||||
obj* l_Nat_repr(obj*);
|
||||
obj* l_Lean_Name_append(obj*, obj*);
|
||||
|
|
@ -66,6 +67,7 @@ uint8 nat_dec_lt(obj*, obj*);
|
|||
obj* l_Lean_NameSet_contains___boxed(obj*, obj*);
|
||||
obj* l_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(obj*, obj*, obj*);
|
||||
obj* l_Lean_Name_getPrefix(obj*);
|
||||
obj* l_Lean_Name_appendIndexAfter(obj*, obj*);
|
||||
extern "C" obj* lean_name_mk_string(obj*, obj*);
|
||||
obj* l_Lean_mkNameSet;
|
||||
uint8 l_Lean_NameMap_contains___rarg(obj*, obj*);
|
||||
|
|
@ -77,10 +79,14 @@ uint8 l_RBNode_isRed___main___rarg(obj*);
|
|||
obj* l_Lean_Name_isPrefixOf___main___boxed(obj*, obj*);
|
||||
obj* l_Lean_NameMap_insert___rarg(obj*, obj*, obj*);
|
||||
obj* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__3(obj*);
|
||||
namespace lean {
|
||||
uint32 string_utf8_get(obj*, obj*);
|
||||
}
|
||||
obj* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__2(obj*);
|
||||
namespace lean {
|
||||
uint8 string_dec_eq(obj*, obj*);
|
||||
}
|
||||
uint8 l_UInt32_decEq(uint32, uint32);
|
||||
obj* l_Lean_mkNameMap(obj*);
|
||||
obj* l_Lean_Name_getPrefix___boxed(obj*);
|
||||
obj* l_Lean_NameMap_contains(obj*);
|
||||
|
|
@ -93,12 +99,17 @@ obj* l_String_split(obj*, obj*);
|
|||
obj* l_RBNode_find___main___at_Lean_NameSet_contains___spec__1___boxed(obj*, obj*);
|
||||
obj* l_Lean_Name_toStringWithSep(obj*, obj*);
|
||||
obj* l_Lean_Name_append___boxed(obj*, obj*);
|
||||
obj* l_Lean_Name_isInternal___boxed(obj*);
|
||||
obj* l_Lean_Name_isInternal___main___boxed(obj*);
|
||||
obj* l_RBNode_find___main___at_Lean_NameMap_find___spec__1___rarg(obj*, obj*);
|
||||
uint8 l_Lean_Name_quickLt(obj*, obj*);
|
||||
obj* l_Lean_Name_appendAfter(obj*, obj*);
|
||||
extern "C" obj* lean_name_mk_numeral(obj*, obj*);
|
||||
obj* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__2___rarg(obj*, obj*, obj*);
|
||||
obj* l_String_toName(obj*);
|
||||
obj* l_Lean_Name_appendIndexAfter___main(obj*, obj*);
|
||||
obj* l_Lean_NameMap_Inhabited(obj*);
|
||||
obj* l_Lean_Name_appendAfter___main(obj*, obj*);
|
||||
obj* l_RBNode_find___main___at_Lean_NameSet_contains___spec__1(obj*, obj*);
|
||||
obj* l_Lean_NameSet_Inhabited;
|
||||
obj* l_Lean_Name_getPrefix___main(obj*);
|
||||
|
|
@ -115,12 +126,14 @@ obj* l_Lean_Name_HasAppend;
|
|||
obj* l_Lean_Name_mkString___boxed(obj*, obj*);
|
||||
obj* l_Lean_NameSet_insert(obj*, obj*);
|
||||
obj* l_RBNode_find___main___at_Lean_NameMap_contains___spec__1___rarg___boxed(obj*, obj*);
|
||||
uint8 l_Lean_Name_isInternal___main(obj*);
|
||||
obj* l_Lean_NameMap_contains___rarg___boxed(obj*, obj*);
|
||||
obj* l_Lean_Name_append___main(obj*, obj*);
|
||||
obj* l_Lean_Name_quickLtCore___main___boxed(obj*, obj*);
|
||||
obj* l_RBNode_insert___at_Lean_NameMap_insert___spec__1(obj*);
|
||||
obj* l_Lean_Name_toStringWithSep___boxed(obj*, obj*);
|
||||
obj* l_Lean_mkNumName(obj*, obj*);
|
||||
uint8 l_Lean_Name_isInternal(obj*);
|
||||
obj* l_Lean_Name_toString(obj*);
|
||||
obj* l_RBNode_ins___main___at_Lean_NameSet_insert___spec__2(obj*, obj*, obj*);
|
||||
obj* l_RBNode_ins___main___at_Lean_NameMap_insert___spec__3___rarg(obj*, obj*, obj*);
|
||||
|
|
@ -938,6 +951,180 @@ x_1 = lean::alloc_closure(reinterpret_cast<void*>(l_Lean_Name_toString), 1, 0);
|
|||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Name_appendAfter___main(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
switch (lean::obj_tag(x_1)) {
|
||||
case 0:
|
||||
{
|
||||
obj* x_3;
|
||||
x_3 = lean_name_mk_string(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
obj* x_4; obj* x_5; obj* x_6; obj* x_7;
|
||||
x_4 = lean::cnstr_get(x_1, 0);
|
||||
lean::inc(x_4);
|
||||
x_5 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_5);
|
||||
lean::dec(x_1);
|
||||
x_6 = lean::string_append(x_5, x_2);
|
||||
lean::dec(x_2);
|
||||
x_7 = lean_name_mk_string(x_4, x_6);
|
||||
return x_7;
|
||||
}
|
||||
default:
|
||||
{
|
||||
obj* x_8;
|
||||
x_8 = lean_name_mk_string(x_1, x_2);
|
||||
return x_8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Name_appendAfter(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3;
|
||||
x_3 = l_Lean_Name_appendAfter___main(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* _init_l_Lean_Name_appendIndexAfter___main___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("_");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Name_appendIndexAfter___main(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3;
|
||||
switch (lean::obj_tag(x_1)) {
|
||||
case 0:
|
||||
{
|
||||
obj* x_9;
|
||||
x_9 = lean::box(0);
|
||||
x_3 = x_9;
|
||||
goto block_8;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
obj* x_10; obj* x_11; obj* x_12; obj* x_13; obj* x_14; obj* x_15; obj* x_16;
|
||||
x_10 = lean::cnstr_get(x_1, 0);
|
||||
lean::inc(x_10);
|
||||
x_11 = lean::cnstr_get(x_1, 1);
|
||||
lean::inc(x_11);
|
||||
lean::dec(x_1);
|
||||
x_12 = l_Lean_Name_appendIndexAfter___main___closed__1;
|
||||
x_13 = lean::string_append(x_11, x_12);
|
||||
x_14 = l_Nat_repr(x_2);
|
||||
x_15 = lean::string_append(x_13, x_14);
|
||||
lean::dec(x_14);
|
||||
x_16 = lean_name_mk_string(x_10, x_15);
|
||||
return x_16;
|
||||
}
|
||||
default:
|
||||
{
|
||||
obj* x_17;
|
||||
x_17 = lean::box(0);
|
||||
x_3 = x_17;
|
||||
goto block_8;
|
||||
}
|
||||
}
|
||||
block_8:
|
||||
{
|
||||
obj* x_4; obj* x_5; obj* x_6; obj* x_7;
|
||||
lean::dec(x_3);
|
||||
x_4 = l_Nat_repr(x_2);
|
||||
x_5 = l_Lean_Name_appendIndexAfter___main___closed__1;
|
||||
x_6 = lean::string_append(x_5, x_4);
|
||||
lean::dec(x_4);
|
||||
x_7 = lean_name_mk_string(x_1, x_6);
|
||||
return x_7;
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Name_appendIndexAfter(obj* x_1, obj* x_2) {
|
||||
_start:
|
||||
{
|
||||
obj* x_3;
|
||||
x_3 = l_Lean_Name_appendIndexAfter___main(x_1, x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
uint8 l_Lean_Name_isInternal___main(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
switch (lean::obj_tag(x_1)) {
|
||||
case 0:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = 0;
|
||||
return x_2;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
obj* x_3; obj* x_4; obj* x_5; uint32 x_6; uint32 x_7; uint8 x_8;
|
||||
x_3 = lean::cnstr_get(x_1, 0);
|
||||
x_4 = lean::cnstr_get(x_1, 1);
|
||||
x_5 = lean::mk_nat_obj(0u);
|
||||
x_6 = lean::string_utf8_get(x_4, x_5);
|
||||
x_7 = 95;
|
||||
x_8 = x_6 == x_7;
|
||||
if (x_8 == 0)
|
||||
{
|
||||
x_1 = x_3;
|
||||
goto _start;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8 x_10;
|
||||
x_10 = 1;
|
||||
return x_10;
|
||||
}
|
||||
}
|
||||
default:
|
||||
{
|
||||
obj* x_11;
|
||||
x_11 = lean::cnstr_get(x_1, 0);
|
||||
x_1 = x_11;
|
||||
goto _start;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Name_isInternal___main___boxed(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2; obj* x_3;
|
||||
x_2 = l_Lean_Name_isInternal___main(x_1);
|
||||
lean::dec(x_1);
|
||||
x_3 = lean::box(x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
uint8 l_Lean_Name_isInternal(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2;
|
||||
x_2 = l_Lean_Name_isInternal___main(x_1);
|
||||
return x_2;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_Name_isInternal___boxed(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
uint8 x_2; obj* x_3;
|
||||
x_2 = l_Lean_Name_isInternal(x_1);
|
||||
lean::dec(x_1);
|
||||
x_3 = lean::box(x_2);
|
||||
return x_3;
|
||||
}
|
||||
}
|
||||
obj* l_Lean_mkNameMap(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
|
|
@ -8724,6 +8911,8 @@ l_Lean_Name_toString___closed__1 = _init_l_Lean_Name_toString___closed__1();
|
|||
lean::mark_persistent(l_Lean_Name_toString___closed__1);
|
||||
l_Lean_Name_HasToString = _init_l_Lean_Name_HasToString();
|
||||
lean::mark_persistent(l_Lean_Name_HasToString);
|
||||
l_Lean_Name_appendIndexAfter___main___closed__1 = _init_l_Lean_Name_appendIndexAfter___main___closed__1();
|
||||
lean::mark_persistent(l_Lean_Name_appendIndexAfter___main___closed__1);
|
||||
l_Lean_mkNameSet = _init_l_Lean_mkNameSet();
|
||||
lean::mark_persistent(l_Lean_mkNameSet);
|
||||
l_Lean_NameSet_HasEmptyc = _init_l_Lean_NameSet_HasEmptyc();
|
||||
|
|
|
|||
16
src/stage0/init/lean/name_mangling.cpp
generated
16
src/stage0/init/lean/name_mangling.cpp
generated
|
|
@ -27,6 +27,7 @@ obj* l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__3
|
|||
namespace lean {
|
||||
obj* string_push(obj*, uint32);
|
||||
}
|
||||
extern obj* l_Lean_Name_appendIndexAfter___main___closed__1;
|
||||
obj* l_Nat_repr(obj*);
|
||||
obj* l_String_Iterator_next___main(obj*);
|
||||
namespace lean {
|
||||
|
|
@ -43,7 +44,6 @@ uint8 nat_dec_eq(obj*, obj*);
|
|||
}
|
||||
obj* l_Lean_String_mangle(obj*);
|
||||
uint8 l_UInt32_decEq(uint32, uint32);
|
||||
obj* l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1;
|
||||
uint8 l_Char_isDigit(uint32);
|
||||
obj* l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__2;
|
||||
obj* l___private_init_lean_name__mangling_1__String_mangleAux(obj*, obj*, obj*);
|
||||
|
|
@ -234,14 +234,6 @@ x_6 = l___private_init_lean_name__mangling_1__String_mangleAux___main(x_2, x_4,
|
|||
return x_6;
|
||||
}
|
||||
}
|
||||
obj* _init_l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1() {
|
||||
_start:
|
||||
{
|
||||
obj* x_1;
|
||||
x_1 = lean::mk_string("_");
|
||||
return x_1;
|
||||
}
|
||||
}
|
||||
obj* l___private_init_lean_name__mangling_2__Name_mangleAux___main(obj* x_1) {
|
||||
_start:
|
||||
{
|
||||
|
|
@ -267,7 +259,7 @@ if (x_7 == 0)
|
|||
{
|
||||
obj* x_8; obj* x_9; obj* x_10; obj* x_11;
|
||||
x_8 = l___private_init_lean_name__mangling_2__Name_mangleAux___main(x_3);
|
||||
x_9 = l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1;
|
||||
x_9 = l_Lean_Name_appendIndexAfter___main___closed__1;
|
||||
x_10 = lean::string_append(x_8, x_9);
|
||||
x_11 = lean::string_append(x_10, x_5);
|
||||
lean::dec(x_5);
|
||||
|
|
@ -288,7 +280,7 @@ x_13 = lean::cnstr_get(x_1, 1);
|
|||
lean::inc(x_13);
|
||||
lean::dec(x_1);
|
||||
x_14 = l___private_init_lean_name__mangling_2__Name_mangleAux___main(x_12);
|
||||
x_15 = l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1;
|
||||
x_15 = l_Lean_Name_appendIndexAfter___main___closed__1;
|
||||
x_16 = lean::string_append(x_14, x_15);
|
||||
x_17 = l_Nat_repr(x_13);
|
||||
x_18 = lean::string_append(x_16, x_17);
|
||||
|
|
@ -331,7 +323,5 @@ l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__2 = _i
|
|||
lean::mark_persistent(l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__2);
|
||||
l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__3 = _init_l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__3();
|
||||
lean::mark_persistent(l___private_init_lean_name__mangling_1__String_mangleAux___main___closed__3);
|
||||
l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1 = _init_l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1();
|
||||
lean::mark_persistent(l___private_init_lean_name__mangling_2__Name_mangleAux___main___closed__1);
|
||||
return w;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue