diff --git a/BE/CLOC.md b/BE/CLOC.md new file mode 100644 index 00000000..0cf73e63 --- /dev/null +++ b/BE/CLOC.md @@ -0,0 +1,295 @@ +## ISA Neutral Code +### Regular Code (Python) + +``` +File blank comment code +-------------------------------------------------------------------------------------- +BE/Elf/elfhelper.py 154 96 871 +BE/Base/ir.py 162 82 504 +BE/Base/lowering.py 115 143 428 +BE/Base/serialize.py 78 22 422 +BE/Base/reaching_defs.py 81 108 343 +BE/Base/liveness.py 70 83 296 +BE/Base/cfg.py 43 37 244 +BE/Base/reg_stats.py 46 51 189 +BE/Base/reg_alloc.py 49 65 180 +BE/Base/optimize.py 48 26 177 +BE/Base/sanity.py 28 29 170 +BE/Elf/elf_unit.py 21 17 97 +BE/Base/eval.py 26 7 84 +BE/Base/canonicalize.py 5 4 26 +-------------------------------------------------------------------------------------- +SUM: 926 770 4031 +-------------------------------------------------------------------------------------- +``` + +### Table Code (Python) + +``` +File blank comment code +----------------------------------------------------------------------------------- +BE/Elf/enum_tab.py 93 41 1031 +BE/Base/opcode_tab.py 237 210 773 +----------------------------------------------------------------------------------- +SUM: 330 251 1804 +----------------------------------------------------------------------------------- +``` +### Regular Code (C++) + +``` +File blank comment code +-------------------------------------------------------------------------------------- +BE/Base/ir.h 179 107 791 +BE/Base/serialize.cc 72 20 758 +BE/Base/lowering.cc 56 18 713 +BE/Elf/elfhelper.cc 66 45 536 +BE/Base/reaching_defs.cc 46 23 481 +BE/Base/ir.cc 71 39 469 +BE/Elf/elfhelper.h 82 33 419 +BE/Base/cfg.cc 44 23 411 +BE/Base/liveness.cc 35 44 358 +BE/Base/reg_stats.cc 35 6 296 +BE/Base/reg_alloc.cc 26 2 237 +BE/Base/optimize_tool.cc 37 7 205 +BE/Elf/elf_unit.h 28 5 196 +BE/Base/eval.cc 16 3 140 +BE/Base/sanity.cc 21 1 113 +BE/Elf/elf_tool.cc 8 3 71 +BE/Base/optimize.cc 13 1 52 +BE/Base/liveness.h 19 17 48 +BE/Base/serialize.h 14 1 41 +BE/Base/canonicalize.cc 3 1 40 +BE/Base/reg_alloc.h 15 8 38 +BE/Base/lowering.h 17 5 34 +BE/Base/reg_stats.h 17 4 27 +BE/Base/cfg.h 16 1 17 +BE/Base/reaching_defs.h 9 1 11 +BE/Base/eval.h 4 1 9 +BE/Base/optimize.h 7 1 9 +BE/Base/sanity.h 6 1 7 +BE/Base/canonicalize.h 4 1 5 +-------------------------------------------------------------------------------------- +SUM: 966 422 6532 +-------------------------------------------------------------------------------------- +``` + +### Generated Files (C++) + +``` +File blank comment code +----------------------------------------------------------------------------------- +BE/Elf/enum_gen.cc 41 4 1970 +BE/Base/opcode_gen.cc 40 3 993 +BE/Elf/enum_gen.h 22 4 641 +BE/Base/opcode_gen.h 31 5 234 +----------------------------------------------------------------------------------- +SUM: 134 16 3838 +----------------------------------------------------------------------------------- +``` +## A32 Code +### Regular Code (Python) + +``` +File blank comment code +--------------------------------------------------------------------------------- +BE/CodeGenA32/regs.py 83 67 377 +BE/CodeGenA32/legalize.py 73 78 263 +BE/CodeGenA32/codegen.py 59 19 228 +BE/CpuA32/assembler.py 42 12 180 +BE/CpuA32/symbolic.py 25 29 101 +BE/CodeGenA32/isel_tester.py 14 1 56 +BE/CpuA32/disassembler_tool.py 9 0 41 +BE/CpuA32/assembler_tool.py 14 12 39 +--------------------------------------------------------------------------------- +SUM: 319 218 1285 +--------------------------------------------------------------------------------- +``` + +### Table Code (Python) + +``` +File blank comment code +--------------------------------------------------------------------------------------- +BE/CpuA32/opcode_tab.py 237 144 1089 +BE/CodeGenA32/isel_tab.py 145 115 1042 +--------------------------------------------------------------------------------------- +SUM: 382 259 2131 +--------------------------------------------------------------------------------------- +``` +### Regular Code (C++) + +``` +File blank comment code +--------------------------------------------------------------------------------- +BE/CodeGenA32/regs.cc 55 10 506 +BE/CodeGenA32/legalize.cc 45 14 344 +BE/CpuA32/assembler.cc 32 6 261 +BE/CodeGenA32/codegen.cc 24 3 228 +BE/CpuA32/symbolic.cc 21 3 221 +BE/CodeGenA32/codegen_tool.cc 38 5 146 +BE/CpuA32/disassembler_tool.cc 6 5 101 +BE/CodeGenA32/isel_tester.cc 12 2 94 +BE/CodeGenA32/regs.h 22 7 52 +BE/CpuA32/assembler_tool.cc 10 1 50 +BE/CodeGenA32/legalize.h 7 1 16 +BE/CpuA32/assembler.h 10 2 13 +BE/CpuA32/symbolic.h 6 1 13 +BE/CodeGenA32/codegen.h 8 1 12 +--------------------------------------------------------------------------------- +SUM: 296 61 2057 +--------------------------------------------------------------------------------- +``` + +### Generated Files (C++) + +``` +File blank comment code +--------------------------------------------------------------------------------------- +BE/CodeGenA32/isel_gen.cc 32 20 6170 +BE/CpuA32/opcode_gen.cc 41 270 2493 +BE/CpuA32/opcode_gen.h 41 22 637 +BE/CodeGenA32/isel_gen.h 15 6 106 +--------------------------------------------------------------------------------------- +SUM: 129 318 9406 +--------------------------------------------------------------------------------------- +``` +## A64 Code +### Regular Code (Python) + +``` +File blank comment code +--------------------------------------------------------------------------------- +BE/CodeGenA64/regs.py 71 71 318 +BE/CodeGenA64/codegen.py 61 26 240 +BE/CodeGenA64/legalize.py 78 78 232 +BE/CpuA64/assembler.py 45 17 189 +BE/CpuA64/symbolic.py 18 23 97 +BE/CodeGenA64/isel_tester.py 13 1 54 +BE/CpuA64/assembler_tool.py 17 12 42 +BE/CpuA64/disassembler_tool.py 9 1 41 +--------------------------------------------------------------------------------- +SUM: 312 229 1213 +--------------------------------------------------------------------------------- +``` + +### Table Code (Python) + +``` +File blank comment code +--------------------------------------------------------------------------------------- +BE/CpuA64/opcode_tab.py 260 177 1353 +BE/CodeGenA64/isel_tab.py 165 125 1183 +--------------------------------------------------------------------------------------- +SUM: 425 302 2536 +--------------------------------------------------------------------------------------- +``` +### Regular Code (C++) + +``` +File blank comment code +--------------------------------------------------------------------------------- +BE/CodeGenA64/regs.cc 45 25 412 +BE/CodeGenA64/legalize.cc 44 13 340 +BE/CpuA64/assembler.cc 35 6 256 +BE/CodeGenA64/codegen.cc 20 3 196 +BE/CpuA64/symbolic.cc 16 3 187 +BE/CodeGenA64/codegen_tool.cc 38 5 147 +BE/CpuA64/disassembler_tool.cc 6 5 97 +BE/CodeGenA64/isel_tester.cc 12 2 94 +BE/CodeGenA64/regs.h 20 10 59 +BE/CpuA64/assembler_tool.cc 10 1 49 +BE/CodeGenA64/legalize.h 10 1 18 +BE/CpuA64/assembler.h 10 2 13 +BE/CpuA64/symbolic.h 7 2 11 +BE/CodeGenA64/codegen.h 5 1 9 +--------------------------------------------------------------------------------- +SUM: 278 79 1888 +--------------------------------------------------------------------------------- +``` + +### Generated Files (C++) + +``` +File blank comment code +--------------------------------------------------------------------------------------- +BE/CodeGenA64/isel_gen.cc 47 21 7053 +BE/CpuA64/opcode_gen.cc 290 285 4704 +BE/CpuA64/opcode_gen.h 33 20 1047 +BE/CodeGenA64/isel_gen.h 17 8 102 +--------------------------------------------------------------------------------------- +SUM: 387 334 12906 +--------------------------------------------------------------------------------------- +``` +## X64 Code +### Regular Code (Python) + +``` +File blank comment code +---------------------------------------------------------------------------------------- +BE/CodeGenX64/regs.py 69 54 327 +BE/CodeGenX64/legalize.py 89 86 323 +BE/CodeGenX64/codegen.py 60 23 240 +BE/CpuX64/assembler.py 43 17 193 +BE/CpuX64/symbolic.py 26 9 126 +BE/CpuX64/disassembler_tool.py 13 0 53 +BE/CpuX64/assembler_tool.py 16 12 42 +BE/CodeGenX64/isel_tester.py 13 1 41 +BE/CpuX64/TestData/objdump_extract.py 6 1 23 +---------------------------------------------------------------------------------------- +SUM: 335 203 1368 +---------------------------------------------------------------------------------------- +``` + +### Table Code (Python) + +``` +File blank comment code +--------------------------------------------------------------------------------------- +BE/CodeGenX64/isel_tab.py 150 121 1359 +BE/CpuX64/opcode_tab.py 180 104 1268 +--------------------------------------------------------------------------------------- +SUM: 330 225 2627 +--------------------------------------------------------------------------------------- +``` +### Regular Code (C++) + +``` +File blank comment code +--------------------------------------------------------------------------------- +BE/CodeGenX64/legalize.cc 52 18 495 +BE/CodeGenX64/regs.cc 45 18 414 +BE/CpuX64/symbolic.cc 24 1 349 +BE/CpuX64/assembler.cc 38 11 304 +BE/CodeGenX64/codegen.cc 24 3 226 +BE/CodeGenX64/codegen_tool.cc 39 5 149 +BE/CpuX64/disassembler_tool.cc 11 7 129 +BE/CodeGenX64/isel_tester.cc 12 2 78 +BE/CodeGenX64/regs.h 24 18 72 +BE/CpuX64/assembler_tool.cc 10 1 49 +BE/CodeGenX64/legalize.h 11 1 19 +BE/CpuX64/assembler.h 12 2 15 +BE/CpuX64/symbolic.h 7 2 12 +BE/CodeGenX64/codegen.h 5 1 9 +--------------------------------------------------------------------------------- +SUM: 314 90 2320 +--------------------------------------------------------------------------------- +``` + +### Generated Files (C++) + +``` +File blank comment code +------------------------------------------------------------------------------------ +BE/CodeGenX64/isel_gen_patterns.h 3 0 28033 +BE/CpuX64/opcode_gen_collisions.h 3 1 16880 +BE/CpuX64/opcode_gen_encodings.h 1 2 13607 +BE/CpuX64/opcode_gen_names.h 2 3 5455 +BE/CpuX64/opcode_gen_enum.h 1 1 3404 +BE/CpuX64/opcode_gen.cc 29 8 470 +BE/CodeGenX64/isel_gen.cc 35 18 438 +BE/CpuX64/opcode_gen.h 25 15 121 +BE/CodeGenX64/isel_gen.h 18 8 93 +------------------------------------------------------------------------------------ +SUM: 117 56 68501 +------------------------------------------------------------------------------------ +``` diff --git a/CLOC.txt b/CLOC.txt deleted file mode 100644 index 10683e9d..00000000 --- a/CLOC.txt +++ /dev/null @@ -1,264 +0,0 @@ - -## Regular Code - - -------------------------------------------------------------------------------- -Language files blank comment code -------------------------------------------------------------------------------- -C++ 53 1450 451 11820 -Python 44 2191 1821 8815 -C/C++ Header 42 832 394 2815 -------------------------------------------------------------------------------- -SUM: 139 4473 2666 23450 -------------------------------------------------------------------------------- - -## Tables - - -------------------------------------------------------------------------------- -Language files blank comment code -------------------------------------------------------------------------------- -Python 8 1462 1033 9041 -------------------------------------------------------------------------------- -SUM: 8 1462 1033 9041 -------------------------------------------------------------------------------- - -## Generated Code - - -------------------------------------------------------------------------------- -Language files blank comment code -------------------------------------------------------------------------------- -C/C++ Header 13 212 95 70360 -C++ 8 555 629 23581 -------------------------------------------------------------------------------- -SUM: 21 767 724 93941 -------------------------------------------------------------------------------- - -## Testing Code - - -------------------------------------------------------------------------------- -Language files blank comment code -------------------------------------------------------------------------------- -Python 10 283 305 1090 -C++ 8 141 27 633 -------------------------------------------------------------------------------- -SUM: 18 424 332 1723 -------------------------------------------------------------------------------- - -## Breakdown: Table Files - - --------------------------------------------------------------------------------------- -File blank comment code --------------------------------------------------------------------------------------- -./CpuA64/opcode_tab.py 260 177 1353 -./CodeGenX64/isel_tab.py 150 120 1350 -./CpuX64/opcode_tab.py 180 104 1268 -./CodeGenA64/isel_tab.py 160 123 1143 -./CpuA32/opcode_tab.py 237 144 1089 -./CodeGenA32/isel_tab.py 146 114 1038 -./Elf/enum_tab.py 93 41 1031 -./Base/opcode_tab.py 236 210 769 --------------------------------------------------------------------------------------- -SUM: 1462 1033 9041 --------------------------------------------------------------------------------------- - -## Breakdown: Generated Files - - ------------------------------------------------------------------------------------ -File blank comment code ------------------------------------------------------------------------------------ -./CodeGenX64/isel_gen_patterns.h 3 0 28033 -./CpuX64/opcode_gen_collisions.h 3 1 16880 -./CpuX64/opcode_gen_encodings.h 1 2 13607 -./CodeGenA64/isel_gen.cc 47 21 6363 -./CodeGenA32/isel_gen.cc 32 20 6150 -./CpuX64/opcode_gen_names.h 2 3 5455 -./CpuA64/opcode_gen.cc 290 285 4704 -./CpuX64/opcode_gen_enum.h 1 1 3404 -./CpuA32/opcode_gen.cc 41 270 2493 -./Elf/enum_gen.cc 41 4 1970 -./CpuA64/opcode_gen.h 33 20 1047 -./Base/opcode_gen.cc 40 3 993 -./Elf/enum_gen.h 22 4 641 -./CpuA32/opcode_gen.h 41 22 637 -./CpuX64/opcode_gen.cc 29 8 470 -./CodeGenX64/isel_gen.cc 35 18 438 -./Base/opcode_gen.h 31 5 234 -./CpuX64/opcode_gen.h 25 15 121 -./CodeGenA32/isel_gen.h 15 6 106 -./CodeGenA64/isel_gen.h 17 8 102 -./CodeGenX64/isel_gen.h 18 8 93 ------------------------------------------------------------------------------------ -SUM: 767 724 93941 ------------------------------------------------------------------------------------ - -## Breakdown: Regular Files - - ---------------------------------------------------------------------------------------- -File blank comment code ---------------------------------------------------------------------------------------- -./Elf/elfhelper.py 154 96 871 -./Base/ir.h 179 107 791 -./Base/serialize.cc 72 20 758 -./Base/lowering.cc 54 16 665 -./Elf/elfhelper.cc 66 45 536 -./CodeGenA32/regs.cc 55 10 506 -./Base/ir.py 162 82 504 -./CodeGenX64/legalize.cc 52 18 495 -./Base/reaching_defs.cc 46 23 481 -./Base/ir.cc 71 39 469 -./Base/serialize.py 78 22 422 -./Elf/elfhelper.h 82 33 419 -./Util/parse.cc 54 13 419 -./CodeGenX64/regs.cc 45 18 414 -./Base/cfg.cc 44 23 411 -./CodeGenA64/regs.cc 43 25 410 -./Base/lowering.py 111 141 408 -./CodeGenC/codegen.py 103 17 406 -./CodeGenA32/regs.py 83 67 377 -./Base/liveness.cc 35 44 357 -./CodeGenA64/legalize.cc 44 13 354 -./CpuX64/symbolic.cc 24 1 349 -./Base/reaching_defs.py 81 108 343 -./CodeGenA32/legalize.cc 45 14 338 -./CodeGenX64/legalize.py 93 85 335 -./CodeGenX64/regs.py 69 54 327 -./CodeGenA64/regs.py 70 69 316 -./CpuX64/assembler.cc 38 11 304 -./Base/liveness.py 70 74 296 -./Base/reg_stats.cc 35 6 296 -./CpuA64/opcode_test.py 31 26 270 -./CodeGenA32/legalize.py 73 78 263 -./CpuA32/assembler.cc 32 6 261 -./CpuA64/assembler.cc 35 6 256 -./CodeGenX64/codegen.py 61 23 245 -./Base/cfg.py 43 37 244 -./Base/reg_alloc.cc 26 2 237 -./CodeGenA64/codegen.py 58 26 233 -./CodeGenA64/legalize.py 77 73 231 -./CodeGenA32/codegen.cc 24 3 228 -./CodeGenA32/codegen.py 59 19 228 -./CodeGenX64/codegen.cc 24 3 226 -./CpuA32/symbolic.cc 21 3 221 -./Base/optimize_tool.cc 37 7 205 -./Util/bst.h 33 12 202 -./CodeGenA64/codegen.cc 20 3 196 -./Elf/elf_unit.h 28 5 196 -./CpuX64/assembler.py 43 17 193 -./Tools/inspector.py 86 235 192 -./Base/reg_stats.py 46 51 189 -./CpuA64/assembler.py 45 17 189 -./CpuA64/symbolic.cc 16 3 187 -./Elf/gen_elf_test.cc 39 9 184 -./Base/reg_alloc.py 49 65 180 -./CpuA32/assembler.py 42 12 180 -./Util/handle_test.cc 39 6 178 -./Base/optimize.py 48 26 177 -./Base/sanity.py 28 29 170 -./Util/parse.py 41 16 166 -./Util/webserver.cc 24 2 152 -./CodeGenX64/codegen_tool.cc 39 5 149 -./CodeGenA64/codegen_tool.cc 38 5 147 -./Base/liveness_test.py 46 101 146 -./CodeGenA32/codegen_tool.cc 38 5 146 -./Elf/gen_elf_test.py 36 10 144 -./Base/eval.cc 14 4 135 -./CpuX64/disassembler_tool.cc 11 7 129 -./CpuX64/symbolic.py 26 9 126 -./CpuA32/opcode_test.py 29 17 121 -./Util/list.h 21 7 115 -./Base/sanity.cc 21 1 113 -./Util/bitvec.cc 22 11 113 -./Base/reg_alloc_test.py 45 67 111 -./CpuX64/opcode_test.py 23 14 108 -./Util/stripe.cc 18 4 106 -./CpuA32/disassembler_tool.cc 6 5 101 -./CpuA32/symbolic.py 25 29 101 -./Tools/reg_alloc_explorer.py 59 152 101 -./CpuA64/disassembler_tool.cc 6 5 97 -./CpuA64/symbolic.py 18 23 97 -./Elf/elf_unit.py 21 17 97 -./CodeGenA32/isel_tester.cc 12 2 94 -./CodeGenA64/isel_tester.cc 12 2 94 -./Util/parse.h 29 16 85 -./Base/eval.py 25 6 82 -./Util/parse_test.cc 8 0 79 -./CodeGenX64/isel_tester.cc 12 2 78 -./CodeGenX64/regs.h 24 18 72 -./Elf/elf_tool.cc 8 3 71 -./Util/breakpoint.h 15 6 70 -./Base/reaching_defs_test.py 33 64 68 -./Util/cgen.py 15 1 68 -./Util/switch.h 25 5 64 -./Base/opcode_contraints_test.py 25 3 63 -./Util/switch.cc 11 1 60 -./CodeGenA64/regs.h 19 10 58 -./CodeGenA32/isel_tester.py 14 1 56 -./Util/bitvec_test.cc 17 3 56 -./Util/handlevec.cc 13 2 56 -./CodeGenA64/isel_tester.py 13 1 54 -./CpuX64/disassembler_tool.py 13 0 53 -./Base/optimize.cc 13 1 52 -./CodeGenA32/regs.h 22 7 52 -./Util/mem_pool.h 12 16 51 -./CpuA32/assembler_tool.cc 10 1 50 -./CpuA64/assembler_tool.cc 10 1 49 -./CpuX64/assembler_tool.cc 10 1 49 -./Util/stripe.h 32 40 49 -./Base/liveness.h 19 17 48 -./Util/parse_test.py 9 3 47 -./Util/webserver.h 15 0 47 -./Util/assert.cc 17 3 45 -./CpuA64/assembler_tool.py 17 12 42 -./CpuX64/assembler_tool.py 16 12 42 -./Base/serialize.h 14 1 41 -./CodeGenX64/isel_tester.py 13 1 41 -./CpuA32/disassembler_tool.py 9 0 41 -./CpuA64/disassembler_tool.py 9 1 41 -./Util/handlevec_test.cc 10 0 41 -./Base/canonicalize.cc 3 1 40 -./CpuA64/opcode_test.cc 10 9 40 -./CpuA32/assembler_tool.py 14 12 39 -./Base/reg_alloc.h 15 8 38 -./Util/breakpoint.cc 5 0 37 -./Util/handle.h 13 10 37 -./Base/lowering.h 17 5 34 -./Util/bitvec.h 23 10 31 -./Util/mem_pool_test.cc 12 0 30 -./Util/immutable.cc 7 1 28 -./Base/reg_stats.h 17 4 27 -./Base/canonicalize.py 5 4 26 -./Util/assert.h 10 1 25 -./Util/bst.cc 6 1 25 -./Util/handle.cc 6 0 25 -./Util/immutable_test.cc 6 0 25 -./Util/immutable.h 9 20 24 -./CpuX64/TestData/objdump_extract.py 6 1 23 -./Util/handlevec.h 15 13 21 -./CodeGenA64/legalize.h 11 1 19 -./CodeGenX64/legalize.h 11 1 19 -./Base/cfg.h 16 1 17 -./CodeGenA32/legalize.h 7 1 16 -./CpuX64/assembler.h 12 2 15 -./CpuA32/assembler.h 10 2 13 -./CpuA32/symbolic.h 6 1 13 -./CpuA64/assembler.h 10 2 13 -./CodeGenA32/codegen.h 8 1 12 -./CodeGenA32/isel_test.py 6 0 12 -./CpuX64/symbolic.h 7 2 12 -./Base/reaching_defs.h 9 1 11 -./CpuA64/symbolic.h 7 2 11 -./Base/optimize.h 7 1 9 -./CodeGenA64/codegen.h 5 1 9 -./CodeGenX64/codegen.h 5 1 9 -./Base/eval.h 3 1 8 -./Base/sanity.h 6 1 7 -./Base/canonicalize.h 4 1 5 ---------------------------------------------------------------------------------------- -SUM: 4897 2998 25173 ---------------------------------------------------------------------------------------- diff --git a/FE/CLOC.md b/FE/CLOC.md new file mode 100644 index 00000000..8b496dfa --- /dev/null +++ b/FE/CLOC.md @@ -0,0 +1,50 @@ +### Regular Code (Python) + +``` +File blank comment code +-------------------------------------------------------------------------------- +FE/emit_ir.py 147 60 1064 +FE/typify.py 195 91 1057 +FE/parse.py 165 122 972 +FE/pp.py 186 219 701 +FE/eval.py 101 64 595 +FE/canonicalize.py 118 94 503 +FE/symbolize.py 102 35 465 +FE/type_corpus.py 87 42 431 +FE/parse_sexpr.py 76 75 344 +FE/pp_sexpr.py 59 13 297 +FE/canonicalize_union.py 53 53 229 +FE/mod_pool.py 52 30 225 +FE/canonicalize_span.py 30 29 133 +FE/macros.py 21 11 132 +FE/pp_html.py 29 13 129 +FE/canonicalize_large_args.py 24 39 119 +FE/fmt_real.py 15 5 50 +FE/dead_code.py 10 4 49 +FE/identifier.py 10 11 19 +FE/xdump.py 5 0 13 +FE/cws2cw.py 9 2 12 +FE/cw2cws.py 9 3 11 +FE/string_re.py 4 4 10 +-------------------------------------------------------------------------------- +SUM: 1507 1019 7560 +-------------------------------------------------------------------------------- +``` + +### Table Code (Python) + +``` +File blank comment code +------------------------------------------------------------------------------- +FE/cwast.py 607 630 2241 +------------------------------------------------------------------------------- +``` +### Regular Code (C++) + +``` +``` + +### Generated Files (C++) + +``` +``` diff --git a/Makefile b/Makefile index 21b1e639..df825cab 100644 --- a/Makefile +++ b/Makefile @@ -60,46 +60,10 @@ lint: mypy . -# --by-file -CLOC_FLAGS = -quiet --hide-rate --match-d='Base|CodeGenA32|CodeGen.*|Cpu.*|Elf|Tools|Util' - -#@ cloc - print lines of code stats -#@ cloc: - @echo - @echo "## Regular Code" - @echo - @cloc ${CLOC_FLAGS} '--match-f=[.](py|cc|h)$$' '--not-match-f=(_test|_tab|_gen.*)[.](py|h|cc)$$' . - @echo - @echo "## Tables" - @echo - @cloc ${CLOC_FLAGS} '--match-f=_tab[.](py|cc|h)$$' . - @echo - @echo "## Generated Code" - @echo - @cloc ${CLOC_FLAGS} '--match-f=_gen.*[.](py|cc|h)$$' . - @echo - @echo "## Testing Code" - @echo - @cloc ${CLOC_FLAGS} '--match-f=_test[.](py|cc|h)$$' . - @echo - @echo "## Breakdown: Table Files" - @echo - @cloc ${CLOC_FLAGS} --by-file '--match-f=_tab[.](py|cc|h)$$' . - @echo - @echo "## Breakdown: Generated Files" - @echo - @cloc ${CLOC_FLAGS} --by-file '--match-f=_gen.*[.](py|cc|h)$$' . - @echo - @echo "## Breakdown: Regular Files" - @echo - @cloc ${CLOC_FLAGS} --by-file '--match-f=[.](py|cc|h)$$' '--not-match-f=(_tab|_gen.*)[.](py|cc|h)$$' . - - -#@ CLOC.txt - update line count stats -#@ -CLOC.txt: - make -s cloc | grep -v "github.com" > $@ + ./cloc.sh frontend > FE/CLOC.md + ./cloc.sh backend > BE/CLOC.md + #@ format - reformat python and c(++) files #@ @@ -115,8 +79,6 @@ TestData/nano_jpeg.64.asm:: $(PYPY) FrontEndC/translate.py --cpp_args=-IStdLib --mode=64 FrontEndC/TestData/nanojpeg.c > $@ - - include_stats: grep -h include */*.cc */*.h | sort | uniq -c diff --git a/README.md b/README.md index 219e28b7..58a6c8ce 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,9 @@ of state of the art compilers) in favor of a small code base that can be understood by a single developer and very fast translation times. Explicit line number targets are in place to prevent feature creep: * frontend: 10kLOC -* backend 10kLOC (target independent code) + 5kLOC (per target) + ([current counts](FE/CLOC.md)) +* backend 10kLOC (target independent code) + 5kLOC(per target + ([current counts](BE/CLOC.md)) ## Inspirations diff --git a/cloc.sh b/cloc.sh new file mode 100755 index 00000000..0589b3f5 --- /dev/null +++ b/cloc.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +set -o nounset +set -o errexit + +readonly CLOC_FLAGS="-quiet --hide-rate" + + + + +RunCloc() { + echo '```' + cloc ${CLOC_FLAGS} "$@" | tail -n +3 + echo '```' +} + + +ComputeStats() { + echo "### Regular Code (Python)" + echo + RunCloc --by-file '--match-f=[.](py)$$' '--not-match-f=(cwast|_test|_tab|_gen.*)[.](py)$$' --match-d="$2" $1 + + + echo + echo "### Table Code (Python)" + echo + RunCloc --by-file '--match-f=(cwast|_tab).*[.](py)$$' --match-d="$2" $1 + + echo "### Regular Code (C++)" + echo + RunCloc --by-file '--match-f=[.](cc|h)$$' '--not-match-f=(_test|_tab|_gen.*)[.](|h|cc)$$' --match-d="$2" $1 + + echo + echo "### Generated Files (C++)" + echo + RunCloc --by-file '--match-f=_gen.*[.](cc|h)$$' --match-d="$2" $1 + + +} + +backend() { + + echo "## ISA Neutral Code" + ComputeStats BE "Base|Elf" + + echo "## A32 Code" + ComputeStats BE "CpuA32|CodeGenA32" + + echo "## A64 Code" + ComputeStats BE "CpuA64|CodeGenA64" + + echo "## X64 Code" + ComputeStats BE "CpuX64|CodeGenX64" +} + + +frontend() { + + ComputeStats FE ".*" +} + +if [ $# = 0 ]; then + echo "ERROR: No command specified." >&2 + exit 1 + fi + + +if [ "$(type -t $1)" != "function" ]; then + echo "ERROR: unknown command '$1'." >&2 + exit 1 + fi + +"$@"