1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14module: 15 name: compiler 16 namespace: panda::compiler 17 18options: 19- name: compiler-non-optimizing 20 type: bool 21 default: false 22 description: Skip all optimizations 23 tags: [perf] 24 25- name: compiler-regex 26 type: std::string 27 default: ".*" 28 description: A regular expression that specifies methods to compile. The grammar used is ECMA-262 RegExp grammar. 29 tags: [perf] 30 31- name: compiler-visualizer-dump 32 type: bool 33 default: false 34 description: Enable visualizer dump ir 35 tags: [debug] 36 37- name: compiler-dump 38 description: Enable dump ir 39 tags: [debug] 40 sub_options: 41 - name: final 42 type: bool 43 default: false 44 description: Dump ir only after last (codegen) pass 45 - name: compact 46 type: bool 47 default: false 48 description: Suppress dumping of some data (bc, SaveState instructions, etc) 49 - name: life-intervals 50 type: bool 51 default: false 52 description: Dump life intervals from regalloc 53 - name: folder 54 type: std::string 55 default: ./ir_dump 56 description: Set folder for dump ir 57 - name: bytecode 58 type: bool 59 default: false 60 description: Enable printing byte code instruction after ir instruction in dump ir 61 - name: peepholes 62 type: bool 63 default: false 64 description: Enable dumps each time peephole applies 65 66- name: compiler-disasm-dump 67 description: Enable dump disasm to text files 68 tags: [debug] 69 sub_options: 70 - name: single-file 71 type: bool 72 default: false 73 description: Dump disasm files into single file, which is "disasm.txt" 74 - name: stdout 75 type: bool 76 default: false 77 description: Dump to the standard output 78 - name: code 79 type: bool 80 default: true 81 description: Dump generated assembly code. Default is true. 82 - name: code-info 83 type: bool 84 default: false 85 description: Dump code info 86 - name: file-name 87 type: std::string 88 default: "disasm.txt" 89 description: File name to dump. Used only when 'single-file' is set. 90 91- name: compiler-emit-asm 92 type: bool 93 default: false 94 description: Enable dump assembly to disasm.txt file (do not emit binary) 95 tags: [debug] 96 97- name: compiler-enable-tracing 98 type: bool 99 default: false 100 description: Enable tracing for passes 101 tags: [debug] 102 103- name: compiler-enable-tlab-events 104 type: bool 105 default: false 106 description: Enable events for tlab allocation 107 tags: [debug] 108 109- name: compiler-support-init-object-inst 110 type: bool 111 default: false 112 description: Compiler don't create InitObject and GraphChecker checks this. The options are needed for bytecode optimizer. 113 tags: [test] 114 115- name: compiler-log 116 type: arg_list_t 117 default: 118 - none 119 possible_values: 120 - none 121 - all 122 - alias-analysis 123 - balance-expr 124 - branch-elim 125 - checks-elim 126 - codegen 127 - code-sink 128 - cse-opt 129 - graph-cloner 130 - deoptimize-elim 131 - cleanup 132 - ifconversion 133 - inlining 134 - ir-builder 135 - licm-opt 136 - liveness-analyzer 137 - loop-transform 138 - lowering 139 - lse-opt 140 - memory-coalescing 141 - monitor-analysis 142 - peephole 143 - rle-opt 144 - regalloc 145 - split-resolver 146 - scheduler 147 - try-catch-resolving 148 - vn-opt 149 - pm 150 description: Set log compiler components 151 tags: [debug] 152 delimiter: "," 153 154- name: compiler-check-graph 155 type: bool 156 default: true 157 description: Enable Graph checking after each optimization 158 tags: [debug] 159 160- name: compiler-check-final 161 type: bool 162 default: false 163 description: Enable Graph checking only after last optimization(Codegen) 164 tags: [debug] 165 166- name: compiler-encode-intrinsics 167 type: bool 168 default: true 169 description: If false, we always call C impementation of an intrinsic 170 tags: [test] 171 172- name: compiler-lowering 173 type: bool 174 default: true 175 description: Enable Lowering Pass 176 tags: [perf] 177 178- name: compiler-code-sink 179 type: bool 180 default: true 181 description: Enable Code Sink Pass 182 tags: [perf] 183 184- name: compiler-balance-expressions 185 type: bool 186 default: true 187 description: Enable Balance Expressions Pass 188 tags: [perf] 189 190- name: compiler-branch-elimination 191 type: bool 192 default: true 193 description: Enable Branch Elimination Pass 194 tags: [perf] 195 196- name: compiler-checks-elimination 197 type: bool 198 default: true 199 description: Enable Checks Elimination Pass 200 tags: [perf] 201 202- name: compiler-enable-replacing-checks-on-deoptimization 203 type: bool 204 default: true 205 description: Enable replacing checks on deoptimization in checks elimination 206 tags: [perf] 207 208- name: compiler-deoptimize-elimination 209 type: bool 210 default: true 211 description: Enable Deoptimize Elimination Pass 212 tags: [perf] 213 214- name: compiler-safepoint-elimination-limit 215 type: uint64_t 216 default: 50 217 description: Set the instructions limit in deoptimize elimination for removing safe points. 218 recommended_values: [10,1000] 219 tags: [perf] 220 221- name: compiler-implicit-null-check 222 type: bool 223 default: true 224 description: Apply Implicit Null Check 225 tags: [perf] 226 227- name: compiler-licm 228 type: bool 229 default: true 230 description: Enable LICM Pass 231 tags: [perf] 232 233- name: compiler-licm-hoist-limit 234 type: uint32_t 235 default: 8 236 description: Set the instructions limit which are hoisted by LICM 237 recommended_values: [1,60] 238 tags: [perf] 239 240- name: compiler-loop-peeling 241 type: bool 242 default: true 243 description: Enable Loop peeling Pass 244 tags: [perf] 245 246- name: compiler-loop-unroll 247 type: bool 248 default: true 249 description: Enable Loop unroll Pass 250 tags: [perf] 251 252- name: compiler-loop-unroll-factor 253 type: uint32_t 254 default: 6 255 description: Set loop unrolling factor 256 recommended_values: [2,10] 257 tags: [perf] 258 259- name: compiler-loop-unroll-inst-limit 260 type: uint32_t 261 default: 100 262 description: Set the instructions limit for the unrolling loop body 263 recommended_values: [10,1000] 264 tags: [perf] 265 266- name: compiler-unroll-loop-with-calls 267 type: bool 268 default: false 269 description: Enable unroll for loops containing method calls 270 tags: [perf] 271 272- name: compiler-unroll-with-side-exits 273 type: bool 274 default: true 275 description: Enable unroll with side exits for not countable loop 276 tags: [perf] 277 278- name: compiler-lse 279 type: bool 280 default: true 281 description: Enable Load-Store Elimination Pass 282 tags: [perf] 283 284- name: compiler-cse 285 type: bool 286 default: false 287 description: Enable CSE Pass 288 tags: [perf] 289 290- name: compiler-vn 291 type: bool 292 default: true 293 description: Enable Value Numbering Pass 294 tags: [perf] 295 296- name: compiler-memory-coalescing 297 type: bool 298 default: true 299 description: Enable Memory Coalescing Pass 300 tags: [perf] 301 302- name: compiler-memory-coalescing-objects 303 type: bool 304 default: true 305 description: Apply Memory Coalescing to objects accesses 306 tags: [perf] 307 308- name: compiler-memory-coalescing-aligned 309 type: bool 310 default: false 311 description: Apply Memory Coalescing only to aligned accesses 312 tags: [perf] 313 314- name: compiler-print-stats 315 type: bool 316 default: false 317 description: Print optimizations statistics 318 tags: [debug] 319 320- name: compiler-dump-stats-csv 321 type: std::string 322 default: "" 323 description: Dump optimizations statistics in csv file 324 tags: [debug] 325 326- name: compiler-enable-ir-stats 327 type: bool 328 default: false 329 description: Enable collecting ir stats on compiler statistic 330 tags: [debug] 331 332 333- name: compiler-use-safepoint 334 type: bool 335 default: true 336 description: Build SafePoint instructions 337 tags: [test] 338 339- name: compiler-inlining 340 type: bool 341 default: true 342 description: Enable inlining optimization 343 tags: [perf] 344 345- name: compiler-inline-external-methods 346 type: bool 347 default: true 348 description: Enable inlining external methods in JIT mode 349 tags: [perf] 350 351- name: compiler-inlining-blacklist 352 type: arg_list_t 353 default: [] 354 description: Method names that should not be inlined 355 delimiter: "," 356 tags: [perf] 357 358- name: compiler-inlining-max-insts 359 type: uint32_t 360 default: 1024 361 description: Maximum number of the IR instructions to be inlined, including instructions of the current graph. 362 recommended_values: [50,2000] 363 tags: [perf] 364 365- name: compiler-inlining-max-depth 366 type: uint32_t 367 default: 4 368 description: Maximum depth of the inlining. 369 recommended_values: [1,10] 370 tags: [perf] 371 372- name: compiler-inlining-max-size 373 type: uint32_t 374 default: 200 375 description: Maximum bytecode size for inlined functions, in bytes. Avarage bytecode instruction size is 2.8 bytes. 376 recommended_values: [10,1000] 377 tags: [perf] 378 379- name: compiler-inline-simple-only 380 type: bool 381 default: false 382 description: Inline only simple methods that don't contain calls to runtime 383 tags: [perf] 384 385- name: compiler-inlining-skip-throw-blocks 386 type: bool 387 default: true 388 description: Don't inline methods inside blocks throwing an exception or performing deoptimization 389 tags: [perf] 390 391- name: compiler-inlining-skip-always-throw-methods 392 type: bool 393 default: true 394 description: Don't inline methods that always throw an exception 395 tags: [perf] 396 397- name: compiler-no-virtual-inlining 398 type: bool 399 default: false 400 description: Disable inlining of the virtual calls 401 tags: [perf] 402 403- name: compiler-no-cha-inlining 404 type: bool 405 default: false 406 description: Don't use CHA in the inlining 407 tags: [perf] 408 409- name: compiler-no-pic-inlining 410 type: bool 411 default: false 412 description: Don't use Polymorphic Inline Caches in the inlining 413 tags: [perf] 414 415- name: compiler-reset-local-allocator 416 type: bool 417 default: true 418 description: Reset local allocator between passes runs 419 tags: [test] 420 421- name: compiler-scheduling 422 type: bool 423 default: true 424 description: Enable Scheduling Pass 425 tags: [perf] 426 427- name: compiler-sched-latency 428 type: uint32_t 429 default: 2 430 description: Set default instruction latency 431 recommended_values: [1,5] 432 tags: [perf] 433 434- name: compiler-sched-latency-long 435 type: uint32_t 436 default: 7 437 description: Set loads latency 438 recommended_values: [2,15] 439 tags: [perf] 440 441- name: compiler-if-conversion 442 type: bool 443 default: true 444 description: Enable IfConversion Pass 445 tags: [perf] 446 447- name: compiler-if-conversion-limit 448 type: uint32_t 449 default: 2 450 description: Maximum amount of instructions in basicblock(s) for if-conversion 451 recommended_values: [1,10] 452 tags: [perf] 453 454- name: compiler-cross-arch 455 type: std::string 456 default: arm64 457 possible_values: 458 - arm 459 - arm64 460 - x86 461 - x86_64 462 description: On AMD64 enable creation of non-native code for testing purpose 463 tags: [test] 464 465- name: compiler-enable-events 466 type: bool 467 default: false 468 description: Enable optimizations events dump 469 tags: [debug, test] 470 471- name: compiler-events-path 472 type: std::string 473 default: ./compiler/events.csv 474 description: Set path for optimizations events dump 475 tags: [debug] 476 477- name: compiler-save-only-live-registers 478 type: bool 479 default: true 480 description: Save and Load only registers that contains live values when making calls. 481 tags: [perf] 482 483- name: compiler-ignore-failures 484 type: bool 485 default: true 486 description: Ignore failures occurred during compilation 487 tags: [test] 488 489- name: compiler-allow-backend-failures 490 type: bool 491 default: true 492 description: Ignore failures occurred during register allocation and code generation 493 tags: [test] 494 495- name: compiler-max-gen-code-size 496 type: uint32_t 497 default: 66060288 498 description: Maximum size of the generated code in code-cache, default 63 M 499 tags: [perf] 500 501- name: compiler-max-bytecode-size 502 type: uint32_t 503 default: 30000 504 description: Maximum size of the method's code to be compiled. 505 recommended_values: [10000,500000] 506 tags: [perf] 507 508- name: compiler-max-vregs-num 509 type: uint32_t 510 default: 65536 511 description: Maximum number of virtual registers in a method. 512 tags: [perf] 513 514- name: compiler-compact-prologue 515 type: bool 516 default: true 517 description: Omit unused callee-registers save/restore in prologue/epilogue when possible. 518 tags: [perf] 519 520- name: compiler-js-filter-intrinsics 521 type: bool 522 default: true 523 description: Enable intrinsics filter in JS Compiler 524 tags: [test] 525 526- name: compiler-reg-acc-alloc 527 type: bool 528 default: true 529 description: Enable accumulator register allocator pass 530 tags: [test] 531 532- name: compiler-regalloc-reg-mask 533 type: uint64_t 534 default: 0 535 description: Mask of registers, avaliable for regalloc 536 tags: [test] 537 538- name: compiler-verify-regalloc 539 type: bool 540 default: true 541 description: Verify register allocation results in debug mode. 542 tags: [debug] 543 544- name: compiler-move-constants 545 type: bool 546 default: true 547 description: Enable move constants from start block closer to usage 548 tags: [perf] 549 550- name: compiler-adjust-refs 551 type: bool 552 default: true 553 description: Enable hoisting of array data address 554 555- name: compiler-aot-load-string-plt 556 type: bool 557 default: true 558 description: Replace unconditional ResolveString runtime call with loading string reference from PLT slot for AOT. 559 tags: [perf] 560 561- name: compiler-remat-const 562 type: bool 563 default: true 564 description: Rematerialize constants instead of spilling them to the stack 565 tags: [perf] 566 567- name: compiler-unfold-const-array-max-size 568 type: uint32_t 569 default: 20 570 description: Set the maximum size of the constant array to unfold a single LoadConstArray instruction to the initial instructions set. 571 recommended_values: [2,1000] 572 tags: [perf] 573 574- name: compiler-spill-fill-pair 575 type: bool 576 default: true 577 description: Store and load values from successive stack slots as pair of values during SpillFill encoding. 578 tags: [perf] 579 580- name: compiler-cpu-features 581 type: arg_list_t 582 default: [sse42] 583 possible_values: 584 - none 585 - crc32 586 - sse42 587 description: Set compiler CPU features 588 tags: [perf] 589 delimiter: "," 590 591- name: compiler-emit-debug-info 592 type: bool 593 default: false 594 description: Emit DWARF debug info for JIT/AOT code, PANDA_COMPILER_CFI should be set 595 tags: [debug] 596 597- name: compiler-aot-ra 598 type: bool 599 default: true 600 description: Enable AOT register allocation 601 602- name: compiler-freq-based-branch-reorder 603 type: bool 604 default: true 605 description: Enables/disables frequency based branch reorder 606 607- name: compiler-freq-based-branch-reorder-threshold 608 type: uint32_t 609 default: 80 610 description: Threshold in percents for frequency based branch reorder 611 612- name: compiler-inline-full-intrinsics 613 type: bool 614 default: false 615 description: Inline graph for dynamic insrinsics in IrBuilder 616 617events: 618- name: branch-elimination 619 fields: 620 - name: if_block_id 621 type: uint32_t 622 - name: if_block_pc 623 type: uint32_t 624 - name: cond_inst_id 625 type: uint32_t 626 - name: cond_inst_pc 627 type: uint32_t 628 - name: condition_type 629 type: const char* 630 - name: removed_edge_type 631 type: bool 632 633- name: code-sink 634 fields: 635 - name: sunk_inst_id 636 type: uint32_t 637 - name: sunk_inst_pc 638 type: uint32_t 639 - name: from_bb_id 640 type: uint32_t 641 - name: to_bb_id 642 type: uint32_t 643 644- name: checks-elimination 645 fields: 646 - name: name 647 type: const char* 648 - name: inst_id 649 type: uint32_t 650 - name: pc 651 type: uint32_t 652 653- name: cleanup 654 fields: 655 - name: removed_inst_id 656 type: uint32_t 657 - name: removed_inst_pc 658 type: uint32_t 659 660- name: cse 661 fields: 662 - name: removed_inst_id 663 type: uint32_t 664 - name: removed_inst_pc 665 type: uint32_t 666 667- name: deoptimize-elimination 668 fields: 669 - name: name 670 type: const char* 671 - name: inst_id 672 type: uint32_t 673 - name: pc 674 type: uint32_t 675 676- name: if-conversion 677 fields: 678 - name: merge_block_id 679 type: uint32_t 680 - name: merge_block_pc 681 type: uint32_t 682 - name: merge_type 683 type: const char* 684 - name: removed_block_id1 685 type: int32_t 686 - name: removed_block_id2 687 type: int32_t 688 - name: removed_block_id3 689 type: int32_t 690 691- name: inlining 692 fields: 693 - name: inlined_method 694 type: const char* 695 696- name: lse 697 fields: 698 - name: removed_inst_id 699 type: uint32_t 700 - name: removed_inst_pc 701 type: uint32_t 702 - name: dominant_inst_id 703 type: uint32_t 704 - name: dominant_inst_pc 705 type: uint32_t 706 - name: code 707 type: const char* 708 709- name: redundant-loop-elimination 710 fields: 711 - name: loop_id 712 type: uint32_t 713 - name: loop_head_pc 714 type: uint32_t 715 716- name: loop-unroll 717 fields: 718 - name: loop_id 719 type: uint32_t 720 - name: loop_head_pc 721 type: uint32_t 722 - name: unroll_factor 723 type: uint32_t 724 - name: cloneable_inst_count 725 type: uint32_t 726 727- name: loop-peeling 728 fields: 729 - name: loop_id 730 type: uint32_t 731 - name: loop_head_pc 732 type: uint32_t 733 - name: loop_exit_pc 734 type: uint32_t 735 - name: moved_inst_count 736 type: uint32_t 737 738- name: memory-coalescing 739 fields: 740 - name: first_inst_id 741 type: uint32_t 742 - name: first_inst_pc 743 type: uint32_t 744 - name: second_inst_id 745 type: uint32_t 746 - name: second_inst_pc 747 type: uint32_t 748 - name: new_inst_id 749 type: uint32_t 750 - name: type 751 type: const char * 752 753- name: peephole 754 fields: 755 - name: name 756 type: const char* 757 - name: inst_id 758 type: uint32_t 759 - name: pc 760 type: uint32_t 761 762- name: scheduler 763 fields: 764 - name: block_id 765 type: uint32_t 766 - name: block_pc 767 type: uint32_t 768 - name: old_cycles 769 type: uint32_t 770 - name: num_barriers 771 type: uint32_t 772 - name: critical_path 773 type: uint32_t 774 - name: new_cycles 775 type: uint32_t 776 777- name: gvn 778 fields: 779 - name: inst_id 780 type: uint32_t 781 - name: inst_pc 782 type: uint32_t 783 - name: equal_inst_id 784 type: uint32_t 785 - name: equal_inst_pc 786 type: uint32_t 787 788- name: licm 789 fields: 790 - name: inst_id 791 type: uint32_t 792 - name: inst_pc 793 type: uint32_t 794 - name: old_loop_id 795 type: uint32_t 796 - name: new_loop_id 797 type: uint32_t 798 799- name: lowering 800 fields: 801 - name: name 802 type: const char* 803 - name: inst_id 804 type: uint32_t 805 - name: pc 806 type: uint32_t 807 808- name: reg-alloc 809 fields: 810 - name: sf_inst_id 811 type: uint32_t 812 - name: sf_purpose 813 type: const char* 814 - name: sf_type 815 type: const char* 816 - name: src 817 type: uint32_t 818 - name: dst 819 type: uint32_t 820 - name: reg_type 821 type: const char* 822 823tags: 824 perf: an option that affects the performance and/or codesize 825 debug: debugging option (checkers, events, dumps, logs e.t.c) 826 test: a test option or an option used by other components 827