Skip to content

Commit

Permalink
[DSLX:frontend][NFC] Factor out Module/Proc from ast.h monolithic file.
Browse files Browse the repository at this point in the history
These are some of the leaf-most AST node types so they're more easily split out
than some of the more interior nodes without creating circular deps.

PiperOrigin-RevId: 586113553
  • Loading branch information
cdleary authored and copybara-github committed Nov 28, 2023
1 parent 4044968 commit 40bcfc6
Show file tree
Hide file tree
Showing 39 changed files with 1,116 additions and 846 deletions.
14 changes: 14 additions & 0 deletions xls/dslx/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ cc_test(
"//xls/common:xls_gunit_main",
"//xls/common/status:matchers",
"//xls/dslx/frontend:ast",
"//xls/dslx/frontend:module",
"//xls/dslx/frontend:pos",
"//xls/dslx/type_system:concrete_type",
"//xls/ir:bits",
Expand Down Expand Up @@ -272,6 +273,7 @@ cc_library(
"//xls/common/status:ret_check",
"//xls/dslx/bytecode:bytecode_cache_interface",
"//xls/dslx/frontend:ast",
"//xls/dslx/frontend:module",
"//xls/dslx/frontend:pos",
"//xls/dslx/type_system:type_info",
"@com_google_absl//absl/container:flat_hash_map",
Expand Down Expand Up @@ -404,11 +406,23 @@ cc_library(
srcs = ["run_comparator.cc"],
hdrs = ["run_comparator.h"],
deps = [
":interp_value",
":mangle",
":run_routines",
"//xls/common:test_macros",
"//xls/common/logging",
"//xls/common/status:ret_check",
"//xls/common/status:status_macros",
"//xls/dslx/frontend:ast",
"//xls/dslx/frontend:module",
"//xls/dslx/type_system:parametric_env",
"//xls/interpreter:ir_interpreter",
"//xls/ir",
"//xls/ir:value",
"//xls/jit:function_jit",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/types:span",
],
)

Expand Down
1 change: 1 addition & 0 deletions xls/dslx/fmt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ cc_library(
"//xls/dslx:channel_direction",
"//xls/dslx/frontend:ast",
"//xls/dslx/frontend:comment_data",
"//xls/dslx/frontend:module",
"//xls/dslx/frontend:pos",
"//xls/dslx/frontend:token",
"//xls/dslx/frontend:token_utils",
Expand Down
1 change: 1 addition & 0 deletions xls/dslx/fmt/ast_fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "xls/dslx/fmt/pretty_print.h"
#include "xls/dslx/frontend/ast.h"
#include "xls/dslx/frontend/comment_data.h"
#include "xls/dslx/frontend/module.h"
#include "xls/dslx/frontend/pos.h"
#include "xls/dslx/frontend/token.h"
#include "xls/dslx/frontend/token_utils.h"
Expand Down
45 changes: 44 additions & 1 deletion xls/dslx/frontend/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ cc_library(
deps = [
":ast",
":ast_utils",
":module",
":proc",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/status",
Expand All @@ -47,6 +49,7 @@ cc_test(
deps = [
":ast",
":ast_cloner",
":module",
"//xls/common:xls_gunit",
"//xls/common:xls_gunit_main",
"//xls/common/status:matchers",
Expand Down Expand Up @@ -84,6 +87,7 @@ cc_library(
":ast_utils",
":bindings",
":builtins_metadata",
":module",
":pos",
":scanner",
":token",
Expand Down Expand Up @@ -134,6 +138,7 @@ cc_test(
],
)

# Note: ast_utils layers on top of the AST implementation.
cc_library(
name = "ast_utils",
srcs = ["ast_utils.cc"],
Expand Down Expand Up @@ -386,13 +391,51 @@ cc_library(
],
)

cc_library(
name = "proc",
srcs = ["proc.cc"],
hdrs = ["proc.h"],
deps = [
":ast",
":pos",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"//xls/common:indent",
],
)

cc_library(
name = "module",
srcs = ["module.cc"],
hdrs = ["module.h"],
deps = [
":ast",
":pos",
":proc",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@com_google_absl//absl/types:span",
"@com_google_absl//absl/types:variant",
"//xls/common:casts",
"//xls/common:visitor",
"//xls/common/logging",
"//xls/common/status:ret_check",
],
)

cc_library(
name = "ast_test_utils",
testonly = True,
srcs = ["ast_test_utils.cc"],
hdrs = ["ast_test_utils.h"],
deps = [
":ast",
":module",
":pos",
"@com_google_absl//absl/strings:str_format",
"//xls/common/logging",
Expand All @@ -405,8 +448,8 @@ cc_test(
deps = [
":ast",
":ast_test_utils",
":module",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"//xls/common:xls_gunit",
"//xls/common:xls_gunit_main",
"//xls/common/status:matchers",
Expand Down
Loading

0 comments on commit 40bcfc6

Please sign in to comment.