Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ jobs:
-DCMAKE_CXX_COMPILER="$(which clang++-${LLVM_VER})" \
-DClang_DIR=${LLVM_PREFIX_DIR}/lib/cmake/clang \
-DLLVM_DIR=${LLVM_PREFIX_DIR}/lib/cmake/llvm \
-DMLIR_DIR=${LLVM_PREFIX_DIR}/lib/cmake/mlir \
-DMX_USE_VENDORED_CLANG=OFF \
-GNinja \
./
Expand Down
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,9 @@ find_package(glog CONFIG REQUIRED GLOBAL)
find_package(reproc++ CONFIG REQUIRED GLOBAL)
find_package(RocksDB CONFIG REQUIRED GLOBAL)
find_package(LLVM CONFIG REQUIRED GLOBAL)
find_package(MLIR CONFIG REQUIRED GLOBAL)
find_package(VAST CONFIG REQUIRED GLOBAL)
find_package(Clang CONFIG REQUIRED GLOBAL)
find_package(pasta CONFIG REQUIRED GLOBAL)

include("cmake/mlir.cmake")
include("cmake/vast.cmake")

if(MX_ENABLE_PYTHON_BINDINGS)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Embed)
endif(MX_ENABLE_PYTHON_BINDINGS)
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ RUN --mount=type=bind,source=.,target=/work/src/multiplier \
-DCMAKE_C_COMPILER="$(which clang-${CLANG_VERSION})" \
-DCMAKE_CXX_COMPILER="$(which clang++-${CLANG_VERSION})" \
-DLLVM_DIR="${INSTALL_DIR}/lib/cmake/llvm" \
-DMLIR_DIR="${INSTALL_DIR}/lib/cmake/mlir" \
-DClang_DIR="${INSTALL_DIR}/lib/cmake/clang" \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=TRUE \
-DMX_USE_VENDORED_CLANG=OFF \
Expand Down
30 changes: 0 additions & 30 deletions bin/Bootstrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
set(exe_name "mx-bootstrap-pasta")

option(MX_BOOTSTRAP_PASTA "Set to ON to bootstrap PASTA" ON)
option(MX_BOOTSTRAP_VAST "Set to ON to bootstrap VAST" ON)

add_library("mx-bootstrap" STATIC
"Bootstrap.cpp"
Expand Down Expand Up @@ -80,32 +79,3 @@ if(MX_BOOTSTRAP_PASTA)
"Bootstrapping Multiplier"
)
endif(MX_BOOTSTRAP_PASTA)

if(MX_BOOTSTRAP_VAST)
add_executable("mx-bootstrap-vast"
"VAST.cpp"
"${PROJECT_SOURCE_DIR}/bin/Index/Entity.h"
)

target_link_libraries("mx-bootstrap-vast"
PRIVATE
"mx-bootstrap"

${MLIR_LIBS}
${VAST_LIBS}
)

# Run `mx-bootstrap-vast` to auto-generate the files.
add_custom_command(
TARGET
"mx-bootstrap-vast"
POST_BUILD
COMMAND
"mx-bootstrap-vast"
"${install_include_dir}"
"${dependencies_include_dir}"
"${LLVM_INCLUDE_DIR}"
COMMENT
"Bootstrapping Multiplier"
)
endif(MX_BOOTSTRAP_VAST)
37 changes: 9 additions & 28 deletions bin/Bootstrap/PASTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2454,8 +2454,7 @@ MethodListPtr CodeGenerator::RunOnClass(
<< FriendOf(class_os, class_name, "TokenContext")
<< FriendOf(class_os, class_name, "Type")
<< FriendOf(class_os, class_name, class_name + "Impl")
<< " friend class ir::Operation;\n"
<< " friend class ir::Value;\n\n"
<< "\n\n"
<< " std::shared_ptr<const " << class_name << "Impl> impl;\n";

if (class_name == base_name) {
Expand Down Expand Up @@ -2837,35 +2836,25 @@ MethodListPtr CodeGenerator::RunOnClass(

if (is_declaration || is_statement) {
class_os
<< " static std::optional<" << class_name
<< "> from(const ir::Operation &op);\n"
<< " static gap::generator<std::pair<" << class_name
<< ", ir::Operation>> in(const Compilation &tu);\n";
<< " static gap::generator<" << class_name
<< "> in(const Compilation &tu);\n";

// The base class methods are all manually implemented.
if (class_name == base_name) {
class_os
<< " static gap::generator<std::pair<" << class_name
<< ", ir::Operation>> in(const Compilation &tu, std::span<const "
<< " static gap::generator<" << class_name
<< "> in(const Compilation &tu, std::span<const "
<< base_name << "Kind> kinds);\n\n";

} else {
lib_cpp_os
<< "std::optional<" << class_name
<< "> " << class_name << "::from(const ir::Operation &op) {\n"
<< " if (auto val = " << base_name << "::from(op)) {\n"
<< " return from_base(val.value());\n"
<< " }\n"
<< " return std::nullopt;\n"
<< "}\n\n"
<< "gap::generator<std::pair<" << class_name << ", ir::Operation>> "
<< "gap::generator<" << class_name << "> "
<< class_name << "::in(const Compilation &tu) {\n"
<< " for (std::pair<" << base_name << ", ir::Operation> res : "
<< " for (" << base_name << " res : "
<< base_name << "::in(tu, k" << class_name
<< "DerivedKinds)) {\n"
<< " if (auto val = from_base(res.first)) {\n"
<< " co_yield std::pair<" << class_name << ", ir::Operation>("
<< "std::move(val.value()), std::move(res.second));\n"
<< " if (auto val = from_base(res)) {\n"
<< " co_yield val.value();\n"
<< " }\n"
<< " }\n"
<< "}\n\n";
Expand Down Expand Up @@ -3939,10 +3928,6 @@ MethodListPtr CodeGenerator::RunOnClass(
}

os
<< "namespace ir {\n"
<< "class Operation;\n"
<< "class Value;\n"
<< "} // namespace ir\n\n"
<< "#if !defined(MX_DISABLE_API) || defined(MX_ENABLE_API)\n"
<< class_os.str()
<< late_class_os.str()
Expand Down Expand Up @@ -4335,10 +4320,6 @@ void CodeGenerator::RunOnClassHierarchies(void) {
}
}

if (gDeclNames.count(name) || gStmtNames.count(name)) {
fs << "\n#include <multiplier/IR/HighLevel/Operation.h>\n";
}

if (!is_enum) {
fs << "\n#include \"../EntityProvider.h\"\n";
}
Expand Down
1 change: 0 additions & 1 deletion bin/Bootstrap/Python.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

#include <multiplier/AST.h>
#include <multiplier/Frontend.h>
#include <multiplier/IR.h>
#include <multiplier/Index.h>

#include <multiplier/Re2.h>
Expand Down
23 changes: 0 additions & 23 deletions bin/Bootstrap/PythonBindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ class UserToken;
#include <multiplier/Fragment.h>
#include <multiplier/Frontend.h>
#include <multiplier/Index.h>
#include <multiplier/IR.h>
#include <multiplier/Re2.h>

#include <cassert>
Expand Down Expand Up @@ -496,12 +495,6 @@ class UserToken;
}} // namespace
"""


IR_TYPE_HASH = """[] (BorrowedPyObject *obj) -> Py_hash_t {{
return static_cast<Py_hash_t>(reinterpret_cast<uintptr_t>(T_cast(obj)->underlying_{}()));
}}"""


TYPE_HASH = """[] (BorrowedPyObject *obj) -> Py_hash_t {
return static_cast<Py_hash_t>(EntityId(T_cast(obj)->id()).Pack());
}"""
Expand Down Expand Up @@ -926,7 +919,6 @@ class UserToken;
#include <multiplier/Fragment.h>
#include <multiplier/Frontend.h>
#include <multiplier/Index.h>
#include <multiplier/IR.h>
#include <multiplier/Re2.h>
#include <multiplier/Reference.h>

Expand Down Expand Up @@ -1331,18 +1323,6 @@ def _strip_optional_const_ref(schema: Schema) -> Schema:
return schema


_IR_BASE_CLASSES = ("Operation", "Region", "Block", "Type",
"Attribute", "Value", "Operand")


def _is_mlir_base_class(schema: ClassSchema) -> bool:
if schema.name not in _IR_BASE_CLASSES:
return False

return schema.namespaces and len(schema.namespaces) and \
schema.namespaces[-1] == 'ir'


def wrap_class(schema: ClassSchema,
offsets: Dict[ClassSchema, Tuple[int, int]],
children: Dict[ClassSchema, List[ClassSchema]],
Expand Down Expand Up @@ -1413,9 +1393,6 @@ def wrap_class(schema: ClassSchema,
if _is_id_method(id_method):
type_hash = TYPE_HASH

elif _is_mlir_base_class(schema):
type_hash = IR_TYPE_HASH.format(schema.name.lower())

elif schema.name == "TokenTreeNode":
type_hash = HASH_CODE_TYPE_HASH

Expand Down
Loading