mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-10 22:00:54 +01:00
Add Luau.EqSat project with some barebones.
I have to comment out the `add_subdirectory(fuzz)` in order to allow cmake to finish the configuring step on Windows.
This commit is contained in:
parent
aea86e5542
commit
ab0d7c0387
5 changed files with 84 additions and 4 deletions
|
@ -28,6 +28,7 @@ add_library(Luau.Ast STATIC)
|
||||||
add_library(Luau.Compiler STATIC)
|
add_library(Luau.Compiler STATIC)
|
||||||
add_library(Luau.Config STATIC)
|
add_library(Luau.Config STATIC)
|
||||||
add_library(Luau.Analysis STATIC)
|
add_library(Luau.Analysis STATIC)
|
||||||
|
add_library(Luau.EqSat STATIC)
|
||||||
add_library(Luau.CodeGen STATIC)
|
add_library(Luau.CodeGen STATIC)
|
||||||
add_library(Luau.VM STATIC)
|
add_library(Luau.VM STATIC)
|
||||||
add_library(isocline STATIC)
|
add_library(isocline STATIC)
|
||||||
|
@ -83,7 +84,12 @@ target_link_libraries(Luau.Config PUBLIC Luau.Ast)
|
||||||
|
|
||||||
target_compile_features(Luau.Analysis PUBLIC cxx_std_17)
|
target_compile_features(Luau.Analysis PUBLIC cxx_std_17)
|
||||||
target_include_directories(Luau.Analysis PUBLIC Analysis/include)
|
target_include_directories(Luau.Analysis PUBLIC Analysis/include)
|
||||||
target_link_libraries(Luau.Analysis PUBLIC Luau.Ast Luau.Config)
|
target_link_libraries(Luau.Analysis PUBLIC Luau.Ast Luau.EqSat Luau.Config)
|
||||||
|
|
||||||
|
target_compile_features(Luau.EqSat PUBLIC cxx_std_17)
|
||||||
|
target_include_directories(Luau.EqSat PUBLIC EqSat/include)
|
||||||
|
target_link_libraries(Luau.EqSat PUBLIC Luau.Common)
|
||||||
|
set_target_properties(Luau.EqSat PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
target_compile_features(Luau.CodeGen PRIVATE cxx_std_17)
|
target_compile_features(Luau.CodeGen PRIVATE cxx_std_17)
|
||||||
target_include_directories(Luau.CodeGen PUBLIC CodeGen/include)
|
target_include_directories(Luau.CodeGen PUBLIC CodeGen/include)
|
||||||
|
@ -141,6 +147,7 @@ endif()
|
||||||
|
|
||||||
target_compile_options(Luau.Ast PRIVATE ${LUAU_OPTIONS})
|
target_compile_options(Luau.Ast PRIVATE ${LUAU_OPTIONS})
|
||||||
target_compile_options(Luau.Analysis PRIVATE ${LUAU_OPTIONS})
|
target_compile_options(Luau.Analysis PRIVATE ${LUAU_OPTIONS})
|
||||||
|
target_compile_options(Luau.EqSat PRIVATE ${LUAU_OPTIONS})
|
||||||
target_compile_options(Luau.CLI.lib PRIVATE ${LUAU_OPTIONS})
|
target_compile_options(Luau.CLI.lib PRIVATE ${LUAU_OPTIONS})
|
||||||
target_compile_options(Luau.CodeGen PRIVATE ${LUAU_OPTIONS})
|
target_compile_options(Luau.CodeGen PRIVATE ${LUAU_OPTIONS})
|
||||||
target_compile_options(Luau.VM PRIVATE ${LUAU_OPTIONS})
|
target_compile_options(Luau.VM PRIVATE ${LUAU_OPTIONS})
|
||||||
|
@ -260,16 +267,16 @@ if(LUAU_BUILD_WEB)
|
||||||
target_link_options(Luau.Web PRIVATE -sSINGLE_FILE=1)
|
target_link_options(Luau.Web PRIVATE -sSINGLE_FILE=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(fuzz)
|
# add_subdirectory(fuzz)
|
||||||
|
|
||||||
# validate dependencies for internal libraries
|
# validate dependencies for internal libraries
|
||||||
foreach(LIB Luau.Ast Luau.Compiler Luau.Config Luau.Analysis Luau.CodeGen Luau.VM)
|
foreach(LIB Luau.Ast Luau.Compiler Luau.Config Luau.Analysis Luau.EqSat Luau.CodeGen Luau.VM)
|
||||||
if(TARGET ${LIB})
|
if(TARGET ${LIB})
|
||||||
get_target_property(DEPENDS ${LIB} LINK_LIBRARIES)
|
get_target_property(DEPENDS ${LIB} LINK_LIBRARIES)
|
||||||
if(LIB MATCHES "CodeGen|VM" AND DEPENDS MATCHES "Ast|Analysis|Config|Compiler")
|
if(LIB MATCHES "CodeGen|VM" AND DEPENDS MATCHES "Ast|Analysis|Config|Compiler")
|
||||||
message(FATAL_ERROR ${LIB} " is a runtime component but it depends on one of the offline components")
|
message(FATAL_ERROR ${LIB} " is a runtime component but it depends on one of the offline components")
|
||||||
endif()
|
endif()
|
||||||
if(LIB MATCHES "Ast|Analysis|Compiler" AND DEPENDS MATCHES "CodeGen|VM")
|
if(LIB MATCHES "Ast|Analysis|EqSat|Compiler" AND DEPENDS MATCHES "CodeGen|VM")
|
||||||
message(FATAL_ERROR ${LIB} " is an offline component but it depends on one of the runtime components")
|
message(FATAL_ERROR ${LIB} " is an offline component but it depends on one of the runtime components")
|
||||||
endif()
|
endif()
|
||||||
if(LIB MATCHES "Ast|Compiler" AND DEPENDS MATCHES "Analysis|Config")
|
if(LIB MATCHES "Ast|Compiler" AND DEPENDS MATCHES "Analysis|Config")
|
||||||
|
|
20
EqSat/include/Luau/Id.h
Normal file
20
EqSat/include/Luau/Id.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Luau::EqSat
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Id final
|
||||||
|
{
|
||||||
|
explicit Id(size_t id);
|
||||||
|
|
||||||
|
explicit operator size_t() const;
|
||||||
|
|
||||||
|
bool operator==(Id rhs) const;
|
||||||
|
bool operator!=(Id rhs) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
size_t id;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Luau::EqSat
|
38
EqSat/src/Id.cpp
Normal file
38
EqSat/src/Id.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
||||||
|
#include "Luau/Id.h"
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace Luau::EqSat
|
||||||
|
{
|
||||||
|
|
||||||
|
Id::Id(size_t id)
|
||||||
|
: id(id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Id::operator size_t() const
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Id::operator==(Id rhs) const
|
||||||
|
{
|
||||||
|
return id == rhs.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Id::operator!=(Id rhs) const
|
||||||
|
{
|
||||||
|
return id != rhs.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Luau::EqSat
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct std::hash<Luau::EqSat::Id>
|
||||||
|
{
|
||||||
|
size_t operator()(Luau::EqSat::Id id) const
|
||||||
|
{
|
||||||
|
return std::hash<size_t>()(size_t(id));
|
||||||
|
}
|
||||||
|
};
|
|
@ -295,6 +295,13 @@ target_sources(Luau.Analysis PRIVATE
|
||||||
Analysis/src/Unifier2.cpp
|
Analysis/src/Unifier2.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Luau.Analysis Sources
|
||||||
|
target_sources(Luau.EqSat PRIVATE
|
||||||
|
EqSat/include/Luau/Id.h
|
||||||
|
|
||||||
|
EqSat/src/Id.cpp
|
||||||
|
)
|
||||||
|
|
||||||
# Luau.VM Sources
|
# Luau.VM Sources
|
||||||
target_sources(Luau.VM PRIVATE
|
target_sources(Luau.VM PRIVATE
|
||||||
VM/include/lua.h
|
VM/include/lua.h
|
||||||
|
|
8
tests/EqSat.propositional.test.cpp
Normal file
8
tests/EqSat.propositional.test.cpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
||||||
|
#include <doctest.h>
|
||||||
|
|
||||||
|
// Var, Bool, And, Or, Not, Implies
|
||||||
|
|
||||||
|
TEST_SUITE_BEGIN("EqSatPropositionalLogic");
|
||||||
|
|
||||||
|
TEST_SUITE_END();
|
Loading…
Add table
Reference in a new issue