Skip to content

Commit

Permalink
Move macro-like SPT_ names to CIRT_. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
lattner committed Apr 29, 2020
1 parent 7ff6ffd commit 5411096
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 81 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPT project.
set(SPT_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ) # --src-root
set(SPT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include ) # --includedir
set(CIRT_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ) # --src-root
set(CIRT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include ) # --includedir

set(SPT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SPT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CIRT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CIRT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

Expand All @@ -24,18 +24,18 @@ add_custom_target(spt-doc)

include_directories( ${MLIR_INCLUDE_DIR})
include_directories( ${MLIR_BINARY_INCLUDE_DIR})
include_directories( ${SPT_INCLUDE_DIR})
include_directories( ${SPT_MAIN_SRC_DIR})
include_directories( ${CIRT_INCLUDE_DIR})
include_directories( ${CIRT_MAIN_SRC_DIR})

add_subdirectory(include/cirt)
add_subdirectory(lib)
add_subdirectory(tools)
#add_subdirectory(unittests)
add_subdirectory(test)

#option(SPT_INCLUDE_DOCS "Generate build targets for the SPT docs."
#option(CIRT_INCLUDE_DOCS "Generate build targets for the SPT docs."
# ${LLVM_INCLUDE_DOCS} ${MLIR_INCLUDE_DOCS})
#if (SPT_INCLUDE_DOCS)
#if (CIRT_INCLUDE_DOCS)
# add_subdirectory(docs)
#endif()

Expand All @@ -50,7 +50,7 @@ install(DIRECTORY include/spt
PATTERN "LICENSE.TXT"
)

install(DIRECTORY ${SPT_INCLUDE_DIR}/spt
install(DIRECTORY ${CIRT_INCLUDE_DIR}/spt
DESTINATION include
COMPONENT spt-headers
FILES_MATCHING
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ This is a test repository, experimenting with an approach of building a modular
set of tools for verilog and other SiFive related projects.

"CIRT" stands for "Circuit IR and Tools" or perhaps "CIRCuiT +
IntermediateRepresenTation + Toolbox" (hat tip to Aliaksei Chapyzhenka). This
name can still be changed if a better one is suggested. :-)
IntermediateRepresenTation + Toolbox" (hat tip to Aliaksei Chapyzhenka). The
T can be further expanded as Tool, Translator, Team, Tech, Target, Tree, Type,
...

This name can still be changed if a better one is suggested. :-)

## Setting this up

Expand Down
58 changes: 29 additions & 29 deletions cmake/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
# Generate a list of CMake library targets so that other CMake projects can
# link against them. LLVM calls its version of this file LLVMExports.cmake, but
# the usual CMake convention seems to be ${Project}Targets.cmake.
set(SPT_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(spt_cmake_builddir "${CMAKE_BINARY_DIR}/${SPT_INSTALL_PACKAGE_DIR}")
set(CIRT_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(spt_cmake_builddir "${CMAKE_BINARY_DIR}/${CIRT_INSTALL_PACKAGE_DIR}")

# Keep this in sync with llvm/cmake/CMakeLists.txt!
set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")

get_property(SPT_EXPORTS GLOBAL PROPERTY SPT_EXPORTS)
export(TARGETS ${SPT_EXPORTS} FILE ${spt_cmake_builddir}/SptTargets.cmake)
get_property(CIRT_EXPORTS GLOBAL PROPERTY CIRT_EXPORTS)
export(TARGETS ${CIRT_EXPORTS} FILE ${spt_cmake_builddir}/SptTargets.cmake)

# Generate SptConfig.cmake for the build tree.
set(SPT_CONFIG_CMAKE_DIR "${spt_cmake_builddir}")
set(SPT_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
set(SPT_CONFIG_EXPORTS_FILE "${spt_cmake_builddir}/SptTargets.cmake")
set(SPT_CONFIG_INCLUDE_DIRS
"${SPT_SOURCE_DIR}/include"
"${SPT_BINARY_DIR}/include"
set(CIRT_CONFIG_CMAKE_DIR "${spt_cmake_builddir}")
set(CIRT_CONFIG_LLVM_CMAKE_DIR "${llvm_cmake_builddir}")
set(CIRT_CONFIG_EXPORTS_FILE "${spt_cmake_builddir}/SptTargets.cmake")
set(CIRT_CONFIG_INCLUDE_DIRS
"${CIRT_SOURCE_DIR}/include"
"${CIRT_BINARY_DIR}/include"
)
set(SPT_CONFIG_CMAKE_DIR)
set(SPT_CONFIG_LLVM_CMAKE_DIR)
set(SPT_CONFIG_EXPORTS_FILE)
set(CIRT_CONFIG_CMAKE_DIR)
set(CIRT_CONFIG_LLVM_CMAKE_DIR)
set(CIRT_CONFIG_EXPORTS_FILE)

# Generate SptConfig.cmake for the install tree.
set(SPT_CONFIG_CODE "
set(CIRT_CONFIG_CODE "
# Compute the installation prefix from this LLVMConfig.cmake file location.
get_filename_component(SPT_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
get_filename_component(CIRT_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
# Construct the proper number of get_filename_component(... PATH)
# calls to compute the installation prefix.
string(REGEX REPLACE "/" ";" _count "${SPT_INSTALL_PACKAGE_DIR}")
string(REGEX REPLACE "/" ";" _count "${CIRT_INSTALL_PACKAGE_DIR}")
foreach(p ${_count})
set(SPT_CONFIG_CODE "${SPT_CONFIG_CODE}
get_filename_component(SPT_INSTALL_PREFIX \"\${SPT_INSTALL_PREFIX}\" PATH)")
set(CIRT_CONFIG_CODE "${CIRT_CONFIG_CODE}
get_filename_component(CIRT_INSTALL_PREFIX \"\${CIRT_INSTALL_PREFIX}\" PATH)")
endforeach(p)
set(SPT_CONFIG_CMAKE_DIR "\${SPT_INSTALL_PREFIX}/${SPT_INSTALL_PACKAGE_DIR}")
set(SPT_CONFIG_LLVM_CMAKE_DIR "\${SPT_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(SPT_CONFIG_EXPORTS_FILE "\${SPT_CMAKE_DIR}/SptTargets.cmake")
set(SPT_CONFIG_INCLUDE_DIRS
"\${SPT_INSTALL_PREFIX}/include"
set(CIRT_CONFIG_CMAKE_DIR "\${CIRT_INSTALL_PREFIX}/${CIRT_INSTALL_PACKAGE_DIR}")
set(CIRT_CONFIG_LLVM_CMAKE_DIR "\${CIRT_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
set(CIRT_CONFIG_EXPORTS_FILE "\${CIRT_CMAKE_DIR}/SptTargets.cmake")
set(CIRT_CONFIG_INCLUDE_DIRS
"\${CIRT_INSTALL_PREFIX}/include"
)
set(SPT_CONFIG_CODE)
set(SPT_CONFIG_CMAKE_DIR)
set(SPT_CONFIG_EXPORTS_FILE)
set(CIRT_CONFIG_CODE)
set(CIRT_CONFIG_CMAKE_DIR)
set(CIRT_CONFIG_EXPORTS_FILE)

if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
# Not TOOLCHAIN ONLY, so install the SPT parts as well
# Include the cmake files so other tools can use spt-tblgen, etc.
get_property(spt_has_exports GLOBAL PROPERTY SPT_HAS_EXPORTS)
get_property(spt_has_exports GLOBAL PROPERTY CIRT_HAS_EXPORTS)
if(spt_has_exports)
install(EXPORT SptTargets DESTINATION ${SPT_INSTALL_PACKAGE_DIR}
install(EXPORT SptTargets DESTINATION ${CIRT_INSTALL_PACKAGE_DIR}
COMPONENT spt-cmake-exports)
endif()

install(FILES #${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/SptConfig.cmake
${CMAKE_CURRENT_SOURCE_DIR}/AddSPT.cmake
DESTINATION ${SPT_INSTALL_PACKAGE_DIR}
DESTINATION ${CIRT_INSTALL_PACKAGE_DIR}
COMPONENT spt-cmake-exports)

if(NOT LLVM_ENABLE_IDE)
Expand Down
6 changes: 3 additions & 3 deletions include/cirt/Dialect/FIRRTL/Dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_DIALECT_H
#define SPT_DIALECT_FIRRTL_IR_DIALECT_H
#ifndef CIRT_DIALECT_FIRRTL_IR_DIALECT_H
#define CIRT_DIALECT_FIRRTL_IR_DIALECT_H

#include "mlir/IR/Dialect.h"

Expand Down Expand Up @@ -39,4 +39,4 @@ StringAttr getFIRRTLNameAttr(ArrayRef<NamedAttribute> attrs);
// Pull in all enum type definitions and utility function declarations.
#include "cirt/Dialect/FIRRTL/FIRRTLEnums.h.inc"

#endif // SPT_DIALECT_FIRRTL_IR_DIALECT_H
#endif // CIRT_DIALECT_FIRRTL_IR_DIALECT_H
6 changes: 3 additions & 3 deletions include/cirt/Dialect/FIRRTL/Ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_OPS_H
#define SPT_DIALECT_FIRRTL_IR_OPS_H
#ifndef CIRT_DIALECT_FIRRTL_IR_OPS_H
#define CIRT_DIALECT_FIRRTL_IR_OPS_H

#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/FIRRTL/Types.h"
Expand Down Expand Up @@ -64,4 +64,4 @@ namespace firrtl {
} // namespace firrtl
} // namespace cirt

#endif // SPT_DIALECT_FIRRTL_IR_OPS_H
#endif // CIRT_DIALECT_FIRRTL_IR_OPS_H
6 changes: 3 additions & 3 deletions include/cirt/Dialect/FIRRTL/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_TYPES_H
#define SPT_DIALECT_FIRRTL_IR_TYPES_H
#ifndef CIRT_DIALECT_FIRRTL_IR_TYPES_H
#define CIRT_DIALECT_FIRRTL_IR_TYPES_H

#include "mlir/IR/Types.h"

Expand Down Expand Up @@ -274,4 +274,4 @@ struct DenseMapInfo<cirt::firrtl::FIRRTLType> {

} // namespace llvm

#endif // SPT_DIALECT_FIRRTL_IR_TYPES_H
#endif // CIRT_DIALECT_FIRRTL_IR_TYPES_H
6 changes: 3 additions & 3 deletions include/cirt/Dialect/FIRRTL/Visitors.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_VISITORS_H
#define SPT_DIALECT_FIRRTL_IR_VISITORS_H
#ifndef CIRT_DIALECT_FIRRTL_IR_VISITORS_H
#define CIRT_DIALECT_FIRRTL_IR_VISITORS_H

#include "cirt/Dialect/FIRRTL/Ops.h"
#include "llvm/ADT/TypeSwitch.h"
Expand Down Expand Up @@ -223,4 +223,4 @@ class DeclVisitor {
} // namespace firrtl
} // namespace cirt

#endif // SPT_DIALECT_FIRRTL_IR_VISITORS_H
#endif // CIRT_DIALECT_FIRRTL_IR_VISITORS_H
6 changes: 3 additions & 3 deletions include/cirt/EmitVerilog.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_EMIT_VERILOG_H
#define SPT_EMIT_VERILOG_H
#ifndef CIRT_EMIT_VERILOG_H
#define CIRT_EMIT_VERILOG_H

#include "cirt/Support/LLVM.h"

Expand All @@ -22,4 +22,4 @@ void registerVerilogEmitterTranslation();

} // namespace cirt

#endif // SPT_EMIT_VERILOG_H
#endif // CIRT_EMIT_VERILOG_H
6 changes: 3 additions & 3 deletions include/cirt/FIRParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRPARSER_H
#define SPT_DIALECT_FIRPARSER_H
#ifndef CIRT_DIALECT_FIRPARSER_H
#define CIRT_DIALECT_FIRPARSER_H

namespace llvm {
class SourceMgr;
Expand All @@ -31,4 +31,4 @@ void registerFIRParserTranslation();

} // namespace cirt

#endif // SPT_DIALECT_FIRPARSER_H
#endif // CIRT_DIALECT_FIRPARSER_H
8 changes: 4 additions & 4 deletions include/cirt/Support/LLVM.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// This file forward declares and imports various common LLVM and MLIR datatypes
// that we want to use unqualified.
//
// Note that most of these are forward declared and then imported into the SPT
// Note that most of these are forward declared and then imported into the cirt
// namespace with using decls, rather than being #included. This is because we
// want clients to explicitly #include the files they need.
//
//===----------------------------------------------------------------------===//

#ifndef SPT_SUPPORT_LLVM_H
#define SPT_SUPPORT_LLVM_H
#ifndef CIRT_SUPPORT_LLVM_H
#define CIRT_SUPPORT_LLVM_H

// MLIR includes a lot of forward declarations of LLVM types, use them.
#include "mlir/Support/LLVM.h"
Expand Down Expand Up @@ -57,4 +57,4 @@ using llvm::APInt;
using llvm::raw_ostream;
} // namespace cirt

#endif // SPT_SUPPORT_LLVM_H
#endif // CIRT_SUPPORT_LLVM_H
6 changes: 3 additions & 3 deletions include/spt/Dialect/FIRRTL/Dialect.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_DIALECT_H
#define SPT_DIALECT_FIRRTL_IR_DIALECT_H
#ifndef CIRT_DIALECT_FIRRTL_IR_DIALECT_H
#define CIRT_DIALECT_FIRRTL_IR_DIALECT_H

#include "mlir/IR/Dialect.h"

Expand Down Expand Up @@ -39,4 +39,4 @@ StringAttr getFIRRTLNameAttr(ArrayRef<NamedAttribute> attrs);
// Pull in all enum type definitions and utility function declarations.
#include "cirt/Dialect/FIRRTL/FIRRTLEnums.h.inc"

#endif // SPT_DIALECT_FIRRTL_IR_DIALECT_H
#endif // CIRT_DIALECT_FIRRTL_IR_DIALECT_H
10 changes: 5 additions & 5 deletions include/spt/Dialect/FIRRTL/Ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_OPS_H
#define SPT_DIALECT_FIRRTL_IR_OPS_H
#ifndef CIRT_DIALECT_FIRRTL_IR_OPS_H
#define CIRT_DIALECT_FIRRTL_IR_OPS_H

#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/FIRRTL/Types.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/FunctionSupport.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/SideEffects.h"
#include "cirt/Dialect/FIRRTL/Dialect.h"
#include "cirt/Dialect/FIRRTL/Types.h"

namespace cirt {
namespace firrtl {
Expand Down Expand Up @@ -64,4 +64,4 @@ namespace firrtl {
} // namespace firrtl
} // namespace cirt

#endif // SPT_DIALECT_FIRRTL_IR_OPS_H
#endif // CIRT_DIALECT_FIRRTL_IR_OPS_H
6 changes: 3 additions & 3 deletions include/spt/Dialect/FIRRTL/Visitors.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SPT_DIALECT_FIRRTL_IR_VISITORS_H
#define SPT_DIALECT_FIRRTL_IR_VISITORS_H
#ifndef CIRT_DIALECT_FIRRTL_IR_VISITORS_H
#define CIRT_DIALECT_FIRRTL_IR_VISITORS_H

#include "cirt/Dialect/FIRRTL/Ops.h"
#include "llvm/ADT/TypeSwitch.h"
Expand Down Expand Up @@ -223,4 +223,4 @@ class DeclVisitor {
} // namespace firrtl
} // namespace cirt

#endif // SPT_DIALECT_FIRRTL_IR_VISITORS_H
#endif // CIRT_DIALECT_FIRRTL_IR_VISITORS_H
2 changes: 1 addition & 1 deletion lib/Dialect/FIRRTL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ add_mlir_dialect_library(MLIRFIRRTL
${globbed}

ADDITIONAL_HEADER_DIRS
${SPT_MAIN_INCLUDE_DIR}/spt/Dialect/FIRRTL
${CIRT_MAIN_INCLUDE_DIR}/cirt/Dialect/FIRRTL
)
add_dependencies(MLIRFIRRTL MLIRFIRRTLIncGen MLIRFIRRTLEnumsIncGen LLVMSupport)
target_link_libraries(MLIRFIRRTL LLVMSupport)
6 changes: 3 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
)

set(SPT_TEST_DEPENDS
set(CIRT_TEST_DEPENDS
FileCheck count not
spt-opt
spt-translate
Expand All @@ -14,10 +14,10 @@ set(SPT_TEST_DEPENDS

add_lit_testsuite(check-spt "Running the SPT regression tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${SPT_TEST_DEPENDS}
DEPENDS ${CIRT_TEST_DEPENDS}
)
set_target_properties(check-spt PROPERTIES FOLDER "Tests")

add_lit_testsuites(SPT ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${SPT_TEST_DEPS}
DEPENDS ${CIRT_TEST_DEPS}
)
8 changes: 4 additions & 4 deletions test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ config.host_arch = "@HOST_ARCH@"
config.mlir_src_root = "@MLIR_SOURCE_DIR@"
config.mlir_obj_root = "@MLIR_BINARY_DIR@"
config.mlir_tools_dir = "@MLIR_TOOLS_DIR@"
config.spt_src_root = "@SPT_SOURCE_DIR@"
config.spt_obj_root = "@SPT_BINARY_DIR@"
config.spt_tools_dir = "@SPT_TOOLS_DIR@"
config.spt_src_root = "@CIRT_SOURCE_DIR@"
config.spt_obj_root = "@CIRT_BINARY_DIR@"
config.spt_tools_dir = "@CIRT_TOOLS_DIR@"

# Support substitution of the tools_dir with user parameters. This is
# used when we can't determine the tool dir at configuration time.
Expand All @@ -49,4 +49,4 @@ import lit.llvm
lit.llvm.initialize(lit_config, config)

# Let the main config do the real work.
lit_config.load_config(config, "@SPT_SOURCE_DIR@/test/lit.cfg.py")
lit_config.load_config(config, "@CIRT_SOURCE_DIR@/test/lit.cfg.py")

0 comments on commit 5411096

Please sign in to comment.