mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-24 20:44:09 +00:00
Move SDBM infrastructure into a new SDBM dialect
We now have sufficient extensibility in dialects to move attribute components such as SDBM out of the core IR into a dedicated dialect and make them optional. Introduce an SDBM dialect and move the code. This is a mostly non-functional change. -- PiperOrigin-RevId: 249244802
This commit is contained in:
parent
e62a12316e
commit
6804cf2429
34
mlir/include/mlir/SDBM/SDBMDialect.h
Normal file
34
mlir/include/mlir/SDBM/SDBMDialect.h
Normal file
@ -0,0 +1,34 @@
|
||||
//===- SDBMDialect.h - Dialect for striped DBMs -----------------*- C++ -*-===//
|
||||
//
|
||||
// Copyright 2019 The MLIR Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
#ifndef MLIR_SDBM_SDBMDIALECT_H
|
||||
#define MLIR_SDBM_SDBMDIALECT_H
|
||||
|
||||
#include "mlir/IR/Dialect.h"
|
||||
|
||||
namespace mlir {
|
||||
class MLIRContext;
|
||||
|
||||
class SDBMDialect : public Dialect {
|
||||
public:
|
||||
SDBMDialect(MLIRContext *context) : Dialect(getDialectNamespace(), context) {}
|
||||
|
||||
static StringRef getDialectNamespace() { return "sdbm"; }
|
||||
};
|
||||
} // namespace mlir
|
||||
|
||||
#endif // MLIR_SDBM_SDBMDIALECT_H
|
@ -10,6 +10,7 @@ add_subdirectory(Linalg)
|
||||
add_subdirectory(Parser)
|
||||
add_subdirectory(Pass)
|
||||
add_subdirectory(Quantizer)
|
||||
add_subdirectory(SDBM)
|
||||
add_subdirectory(StandardOps)
|
||||
add_subdirectory(Support)
|
||||
add_subdirectory(TableGen)
|
||||
|
10
mlir/lib/SDBM/CMakeLists.txt
Normal file
10
mlir/lib/SDBM/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
add_llvm_library(MLIRSDBM
|
||||
SDBM.cpp
|
||||
SDBMExpr.cpp
|
||||
SDBMDialect.cpp
|
||||
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${MLIR_MAIN_INCLUDE_DIR}/mlir/SDBM
|
||||
)
|
||||
add_dependencies(MLIRSDBM MLIRIR)
|
||||
target_link_libraries(MLIRSDBM MLIRIR)
|
@ -20,8 +20,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/IR/SDBM.h"
|
||||
#include "mlir/IR/SDBMExpr.h"
|
||||
#include "mlir/SDBM/SDBM.h"
|
||||
#include "mlir/SDBM/SDBMExpr.h"
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SetVector.h"
|
20
mlir/lib/SDBM/SDBMDialect.cpp
Normal file
20
mlir/lib/SDBM/SDBMDialect.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
//===- SDBMDialect.cpp - Dialect for striped difference-bound matrices ----===//
|
||||
//
|
||||
// Copyright 2019 The MLIR Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
#include "mlir/SDBM/SDBMDialect.h"
|
||||
|
||||
static mlir::DialectRegistration<mlir::SDBMDialect> SDBMDialect;
|
@ -21,7 +21,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/IR/SDBMExpr.h"
|
||||
#include "mlir/SDBM/SDBMExpr.h"
|
||||
#include "SDBMExprDetail.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
#include "mlir/IR/AffineExprVisitor.h"
|
@ -25,7 +25,7 @@
|
||||
#define MLIR_IR_SDBMEXPRDETAIL_H
|
||||
|
||||
#include "mlir/IR/MLIRContext.h"
|
||||
#include "mlir/IR/SDBMExpr.h"
|
||||
#include "mlir/SDBM/SDBMExpr.h"
|
||||
#include "mlir/Support/StorageUniquer.h"
|
||||
|
||||
namespace mlir {
|
@ -1,5 +1,6 @@
|
||||
add_subdirectory(mlir-cpu-runner)
|
||||
add_subdirectory(EDSC)
|
||||
add_subdirectory(mlir-cpu-runner)
|
||||
add_subdirectory(SDBM)
|
||||
|
||||
llvm_canonicalize_cmake_booleans(
|
||||
LLVM_BUILD_EXAMPLES
|
||||
@ -27,6 +28,7 @@ set(MLIR_TEST_DEPENDS
|
||||
MLIRUnitTests
|
||||
mlir-cpu-runner
|
||||
mlir-opt
|
||||
mlir-sdbm-api-test
|
||||
mlir-tblgen
|
||||
mlir-translate
|
||||
sdot
|
||||
|
18
mlir/test/SDBM/CMakeLists.txt
Normal file
18
mlir/test/SDBM/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
add_executable(mlir-sdbm-api-test
|
||||
sdbm-api-test.cpp
|
||||
)
|
||||
|
||||
llvm_update_compile_flags(mlir-sdbm-api-test)
|
||||
|
||||
target_link_libraries(mlir-sdbm-api-test
|
||||
MLIRIR
|
||||
MLIRSDBM
|
||||
LLVMCore
|
||||
LLVMSupport
|
||||
)
|
||||
|
||||
target_include_directories(mlir-sdbm-api-test PRIVATE ..)
|
||||
|
||||
whole_archive_link(mlir-sdbm-api-test
|
||||
MLIRSDBM
|
||||
)
|
1
mlir/test/SDBM/lit.local.cfg
Normal file
1
mlir/test/SDBM/lit.local.cfg
Normal file
@ -0,0 +1 @@
|
||||
config.suffixes.add('.cpp')
|
@ -15,11 +15,11 @@
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
// RUN: %p/sdbm-api-test | FileCheck %s
|
||||
// RUN: mlir-sdbm-api-test | FileCheck %s
|
||||
|
||||
#include "mlir/IR/MLIRContext.h"
|
||||
#include "mlir/IR/SDBM.h"
|
||||
#include "mlir/IR/SDBMExpr.h"
|
||||
#include "mlir/SDBM/SDBM.h"
|
||||
#include "mlir/SDBM/SDBMExpr.h"
|
||||
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
@ -8,4 +8,5 @@ endfunction()
|
||||
add_subdirectory(Dialect)
|
||||
add_subdirectory(IR)
|
||||
add_subdirectory(Pass)
|
||||
add_subdirectory(SDBM)
|
||||
add_subdirectory(TableGen)
|
||||
|
@ -2,7 +2,6 @@ add_mlir_unittest(MLIRIRTests
|
||||
DialectTest.cpp
|
||||
OperationSupportTest.cpp
|
||||
OpDefinitionTest.cpp
|
||||
SDBMTest.cpp
|
||||
)
|
||||
target_link_libraries(MLIRIRTests
|
||||
PRIVATE
|
||||
|
7
mlir/unittests/SDBM/CMakeLists.txt
Normal file
7
mlir/unittests/SDBM/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
add_mlir_unittest(MLIRSDBMTests
|
||||
SDBMTest.cpp
|
||||
)
|
||||
target_link_libraries(MLIRSDBMTests
|
||||
PRIVATE
|
||||
MLIRSDBM
|
||||
)
|
@ -15,10 +15,10 @@
|
||||
// limitations under the License.
|
||||
// =============================================================================
|
||||
|
||||
#include "mlir/IR/SDBM.h"
|
||||
#include "mlir/SDBM/SDBM.h"
|
||||
#include "mlir/IR/AffineExpr.h"
|
||||
#include "mlir/IR/MLIRContext.h"
|
||||
#include "mlir/IR/SDBMExpr.h"
|
||||
#include "mlir/SDBM/SDBMExpr.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
@ -151,7 +151,7 @@ TEST(SDBMExpr, Constant) {
|
||||
TEST(SDBMExpr, Dim) {
|
||||
// We can create dimension expressions and query them.
|
||||
auto expr = SDBMDimExpr::get(ctx(), 0);
|
||||
EXPECT_EQ(expr.getPosition(), 0);
|
||||
EXPECT_EQ(expr.getPosition(), 0u);
|
||||
|
||||
// Two separately created dimensions with the same position are trivially
|
||||
// equal.
|
||||
@ -174,7 +174,7 @@ TEST(SDBMExpr, Dim) {
|
||||
TEST(SDBMExpr, Symbol) {
|
||||
// We can create symbol expressions and query them.
|
||||
auto expr = SDBMSymbolExpr::get(ctx(), 0);
|
||||
EXPECT_EQ(expr.getPosition(), 0);
|
||||
EXPECT_EQ(expr.getPosition(), 0u);
|
||||
|
||||
// Two separately created symbols with the same position are trivially equal.
|
||||
auto expr2 = SDBMSymbolExpr::get(ctx(), 0);
|
Loading…
x
Reference in New Issue
Block a user