Skip to content

Commit 40bcfc6

Browse files
cdlearycopybara-github
authored andcommitted
[DSLX:frontend][NFC] Factor out Module/Proc from ast.h monolithic file.
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
1 parent 4044968 commit 40bcfc6

39 files changed

+1116
-846
lines changed

xls/dslx/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ cc_test(
156156
"//xls/common:xls_gunit_main",
157157
"//xls/common/status:matchers",
158158
"//xls/dslx/frontend:ast",
159+
"//xls/dslx/frontend:module",
159160
"//xls/dslx/frontend:pos",
160161
"//xls/dslx/type_system:concrete_type",
161162
"//xls/ir:bits",
@@ -272,6 +273,7 @@ cc_library(
272273
"//xls/common/status:ret_check",
273274
"//xls/dslx/bytecode:bytecode_cache_interface",
274275
"//xls/dslx/frontend:ast",
276+
"//xls/dslx/frontend:module",
275277
"//xls/dslx/frontend:pos",
276278
"//xls/dslx/type_system:type_info",
277279
"@com_google_absl//absl/container:flat_hash_map",
@@ -404,11 +406,23 @@ cc_library(
404406
srcs = ["run_comparator.cc"],
405407
hdrs = ["run_comparator.h"],
406408
deps = [
409+
":interp_value",
407410
":mangle",
408411
":run_routines",
409412
"//xls/common:test_macros",
413+
"//xls/common/logging",
414+
"//xls/common/status:ret_check",
415+
"//xls/common/status:status_macros",
416+
"//xls/dslx/frontend:ast",
417+
"//xls/dslx/frontend:module",
418+
"//xls/dslx/type_system:parametric_env",
410419
"//xls/interpreter:ir_interpreter",
420+
"//xls/ir",
421+
"//xls/ir:value",
411422
"//xls/jit:function_jit",
423+
"@com_google_absl//absl/status",
424+
"@com_google_absl//absl/status:statusor",
425+
"@com_google_absl//absl/types:span",
412426
],
413427
)
414428

xls/dslx/fmt/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ cc_library(
6464
"//xls/dslx:channel_direction",
6565
"//xls/dslx/frontend:ast",
6666
"//xls/dslx/frontend:comment_data",
67+
"//xls/dslx/frontend:module",
6768
"//xls/dslx/frontend:pos",
6869
"//xls/dslx/frontend:token",
6970
"//xls/dslx/frontend:token_utils",

xls/dslx/fmt/ast_fmt.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "xls/dslx/fmt/pretty_print.h"
4040
#include "xls/dslx/frontend/ast.h"
4141
#include "xls/dslx/frontend/comment_data.h"
42+
#include "xls/dslx/frontend/module.h"
4243
#include "xls/dslx/frontend/pos.h"
4344
#include "xls/dslx/frontend/token.h"
4445
#include "xls/dslx/frontend/token_utils.h"

xls/dslx/frontend/BUILD

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ cc_library(
2727
deps = [
2828
":ast",
2929
":ast_utils",
30+
":module",
31+
":proc",
3032
"@com_google_absl//absl/container:flat_hash_map",
3133
"@com_google_absl//absl/container:flat_hash_set",
3234
"@com_google_absl//absl/status",
@@ -47,6 +49,7 @@ cc_test(
4749
deps = [
4850
":ast",
4951
":ast_cloner",
52+
":module",
5053
"//xls/common:xls_gunit",
5154
"//xls/common:xls_gunit_main",
5255
"//xls/common/status:matchers",
@@ -84,6 +87,7 @@ cc_library(
8487
":ast_utils",
8588
":bindings",
8689
":builtins_metadata",
90+
":module",
8791
":pos",
8892
":scanner",
8993
":token",
@@ -134,6 +138,7 @@ cc_test(
134138
],
135139
)
136140

141+
# Note: ast_utils layers on top of the AST implementation.
137142
cc_library(
138143
name = "ast_utils",
139144
srcs = ["ast_utils.cc"],
@@ -386,13 +391,51 @@ cc_library(
386391
],
387392
)
388393

394+
cc_library(
395+
name = "proc",
396+
srcs = ["proc.cc"],
397+
hdrs = ["proc.h"],
398+
deps = [
399+
":ast",
400+
":pos",
401+
"@com_google_absl//absl/container:btree",
402+
"@com_google_absl//absl/status",
403+
"@com_google_absl//absl/strings",
404+
"@com_google_absl//absl/strings:str_format",
405+
"//xls/common:indent",
406+
],
407+
)
408+
409+
cc_library(
410+
name = "module",
411+
srcs = ["module.cc"],
412+
hdrs = ["module.h"],
413+
deps = [
414+
":ast",
415+
":pos",
416+
":proc",
417+
"@com_google_absl//absl/container:flat_hash_map",
418+
"@com_google_absl//absl/status",
419+
"@com_google_absl//absl/status:statusor",
420+
"@com_google_absl//absl/strings",
421+
"@com_google_absl//absl/strings:str_format",
422+
"@com_google_absl//absl/types:span",
423+
"@com_google_absl//absl/types:variant",
424+
"//xls/common:casts",
425+
"//xls/common:visitor",
426+
"//xls/common/logging",
427+
"//xls/common/status:ret_check",
428+
],
429+
)
430+
389431
cc_library(
390432
name = "ast_test_utils",
391433
testonly = True,
392434
srcs = ["ast_test_utils.cc"],
393435
hdrs = ["ast_test_utils.h"],
394436
deps = [
395437
":ast",
438+
":module",
396439
":pos",
397440
"@com_google_absl//absl/strings:str_format",
398441
"//xls/common/logging",
@@ -405,8 +448,8 @@ cc_test(
405448
deps = [
406449
":ast",
407450
":ast_test_utils",
451+
":module",
408452
"@com_google_absl//absl/status",
409-
"@com_google_absl//absl/status:statusor",
410453
"//xls/common:xls_gunit",
411454
"//xls/common:xls_gunit_main",
412455
"//xls/common/status:matchers",

0 commit comments

Comments
 (0)