Commit Graph

222 Commits

Author SHA1 Message Date
Dmitry Stogov
c3fca224ff Introduce IR_OP_FLAG_PINNED and IR_BB_HAS_PHI/PI/PARAM/VAR flags 2023-05-05 16:59:22 +03:00
Dmitry Stogov
1150c80ca2 Fixed support for OSR ENTRY 2023-05-05 12:59:33 +03:00
Dmitry Stogov
76f44fa126 Implemented path-exploration based live ranges construction
The algorithm is based on "Computing Liveness Sets for SSA-Form Programs",
Florian Brandner, Benoit Boissinot, Alain Darte, Benoit Dupont de Dinechin,
Fabrice Rastello. TR Inria RR-7503, 2011

In comparison to the existing bitset based approach, the new algorithm
is more memory-space efficient and faster on big functions.
2023-05-05 02:01:53 +03:00
Dmitry Stogov
ac3a11e911 Improve ir_add_live_range(). Set ival->type when process definition. 2023-05-04 12:23:40 +03:00
Dmitry Stogov
d30f523c62 Avoid iteration over an empty bitset 2023-05-03 12:30:05 +03:00
Dmitry Stogov
1bbee7b9da Get rid of ir_live_interval.top 2023-04-28 09:49:12 +03:00
Dmitry Stogov
0de0c1d0fa Improve parallel copy algorithm to support move of single source into multiple destinations 2023-04-26 10:56:55 +03:00
Dmitry Stogov
1749168078 Add ir_insn_len() and ir_insn_inputs_to_len() private helpers 2023-04-21 13:40:55 +03:00
Dmitry Stogov
e01c43a967 Simplify access to nodes with variable inputs count 2023-04-21 12:40:17 +03:00
Dmitry Stogov
ac7f9a3a02 Improve ir_compute_live_ranges() 2023-04-14 01:47:47 +03:00
Dmitry Stogov
1115e7fb6e cleanup 2023-04-13 21:45:38 +03:00
Dmitry Stogov
2a17b87219 LSRA optimization 2023-04-13 20:56:49 +03:00
Dmitry Stogov
e5c01495da Use arena to allocate live_intervals and nested data structures 2023-04-13 13:47:16 +03:00
Dmitry Stogov
0b78a322f8 Cache deleted live ranges in ir_ctx.unused_ranges 2023-04-13 11:42:47 +03:00
Dmitry Stogov
7d395532d9 Simplify ir_assign_virtual_registers() 2023-04-13 03:01:08 +03:00
Dmitry Stogov
f85f5fd2a8 Remove data dependency between TAILCALL and UNREACHABLE 2023-04-13 02:41:28 +03:00
Dmitry Stogov
d71cbd47d5 Disable LICM across an OSR ENTRY if the value can't be restored at OSR ENTRY point 2023-04-07 16:36:27 +03:00
Dmitry Stogov
efa8a83153 Fix spilling code for arguments passed theought stack and change RA to
prefer reusing the same register for splitted intervals
i#	utils/
2023-04-06 00:16:49 +03:00
Dmitry Stogov
1e5e9e08ce Re-implement instruction fusion and live-range construction 2023-04-05 19:20:43 +03:00
Dmitry Stogov
ee827ee983 Don't create two DEF UsePos 2023-03-29 17:22:49 +03:00
Dmitry Stogov
2392f546bf Improve merging of sorted lists 2023-03-24 12:42:41 +03:00
Dmitry Stogov
87dbdcea0d Add necessary compensation loads for bounded nodes when enter into function through OSR entry-point 2023-03-21 13:45:37 +03:00
Dmitry Stogov
f5b7065b10 Refactor the ENTRY nodes
Now all ENTRY nodes have a "fake" input control edge.
Through this edge all of them are dominated by START node.
2023-03-17 09:02:37 +03:00
Dmitry Stogov
300665700f Adopt IR test engine for Windows (this requires php and diff installed) 2023-03-01 20:31:14 +03:00
Dmitry Stogov
9b34731d16 Fix most MSVC compilation warnings 2023-02-28 02:11:09 +03:00
Anatol Belski
964f5a0191 build: MSVC compatibility
Signed-off-by: Anatol Belski <ab@php.net>
2023-02-25 00:04:57 +01:00
Dmitry Stogov
31ea3153f3 Add (commeted) code that could eliminate register move for RSTORE 2023-02-16 17:49:30 +03:00
Dmitry Stogov
c7e2cca534 Add hint to reuse register in ZEXT/SEXT 2023-02-15 18:33:02 +03:00
Dmitry Stogov
0eff9e0516 Registers %r4b - %r7b are not available in 32-bit mode 2023-01-24 15:31:31 +03:00
Dmitry Stogov
32ad3d1052 Use inline functions to avoid false positive address sanitaizer warnings 2023-01-20 15:35:02 +03:00
Dmitry Stogov
3ac58893f2 Fix address sanitizer warnings 2023-01-20 11:30:22 +03:00
Dmitry Stogov
5103c18269 Fix load fusion in combination with depended register spill load 2023-01-19 13:39:29 +03:00
Dmitry Stogov
397ed1696b Split at "max_pos" if "min_bb" is in a deeper loop than "max_bb" 2022-12-29 01:39:24 +03:00
Dmitry Stogov
cc8f3fe987 Fix register allocation for intervals started by RLOAD of non-fixed register.
These intervals may be split and spilled.
2022-12-27 22:34:52 +03:00
Dmitry Stogov
862e25d96c Try allocationg another blocked register in case of unresolvable conflicts 2022-12-22 22:09:04 +03:00
Dmitry Stogov
9e54343a62 Fix iteration through loop pre-headers 2022-12-15 23:28:09 +03:00
Dmitry Stogov
5959f5375b Fix missed register allocation for the rest of splitted inactive interval 2022-12-09 15:07:36 +03:00
Dmitry Stogov
6a4e239773 Create a sparate pass to remove unreachableble CFG blocks.
SCCP pass removes unreachable blocks before CFG construction.
In case of -O0 or -O1 pipeline (without SCCP) it's simpler and faster
to unlink unreachable CFG blocks once, then check for reachability
in almost any compilation pass.
-O2 pipeline (with SCCP) don't need this pass.
2022-11-29 20:02:07 +03:00
Dmitry Stogov
a137adfdf9 Separate ir_build_prev_refs(). It's necessary only for -O0 pipeline. 2022-11-24 12:55:16 +03:00
Dmitry Stogov
bdb8e6a1da Set ir_ctx.prev_ref[] elements for inner BB traversing 2022-11-23 16:16:08 +03:00
Dmitry Stogov
bce0114bab Traverse instruction backward (it's cheaper) 2022-11-23 15:48:22 +03:00
Dmitry Stogov
dde8309108 Use reference to previous instruction instead of its length 2022-11-18 13:59:49 +03:00
Dmitry Stogov
ae19ad7c79 Eliminate unnecessary loops 2022-11-18 12:47:15 +03:00
Dmitry Stogov
00395f0a23 Cleanup: separate ir_phi_input_number() function 2022-11-18 10:11:16 +03:00
Dmitry Stogov
3e3746d5cb Refactor API that expose target CPU register constraints for register allocator 2022-11-17 23:30:35 +03:00
Dmitry Stogov
baa9f44ca2 RLOAD and VAR don't have inputs 2022-11-16 19:21:52 +03:00
Dmitry Stogov
3471060709 Skip END and LOOP_END 2022-11-16 19:06:09 +03:00
Dmitry Stogov
c0e1216361 Improve ir_assign_virtual_registers() 2022-11-16 18:43:34 +03:00
Dmitry Stogov
ba97919e9e Improve ir_assign_virtual_registers() 2022-11-16 18:09:49 +03:00
Dmitry Stogov
9fc66b37c9 Improve ir_assign_virtual_registers() 2022-11-16 00:40:14 +03:00
Dmitry Stogov
bd80dd4700 ir_compute_live_ranges() micro-optimizations 2022-11-16 00:40:14 +03:00
Dmitry Stogov
f72e6dc388 Avoid bitset clearing and copying 2022-11-16 00:40:14 +03:00
Dmitry Stogov
f72bb45e07 Remove useless condition and keep "visited" bitset only for debug build 2022-11-16 00:40:14 +03:00
Dmitry Stogov
9f777661b5 Improve DESSA
Instead o clearing a huge array use an additional loop to clear only the necessary entries.
2022-11-16 00:40:14 +03:00
Dmitry Stogov
7e710d5e91 Speedup coalescing 2022-11-16 00:40:14 +03:00
Dmitry Stogov
c8dc4e9e74 Move ir_input_edges_count(phi) out of the loop, because all PHIs inherit their arity from MERGE/LOOP_BEGIN 2022-11-09 21:54:01 +03:00
Dmitry Stogov
3535fd2fc4 Fix compilation warnings and signed/unsigned mess 2022-11-08 23:09:35 +03:00
Dmitry Stogov
cc73788981 Fix compilation warnings 2022-11-08 18:17:29 +03:00
Dmitry Stogov
cc56f12f13 Add LICENSE and copyright notices 2022-11-08 11:32:46 +03:00
Dmitry Stogov
22385c1528 Allocate and reuse spill slots using simple linear-scan (without holes) 2022-11-02 21:53:05 +03:00
Dmitry Stogov
0a5bb4a571 Better condition 2022-11-02 21:28:56 +03:00
Dmitry Stogov
802ec945ad Reorder conditions for the most common case 2022-11-02 16:27:26 +03:00
Dmitry Stogov
3af9e1a062 Move some common code into ir_emit.c 2022-10-26 22:52:19 +03:00
Dmitry Stogov
4b114914dc Prevent register clobbering 2022-10-25 12:24:05 +03:00
Dmitry Stogov
265ebc1000 Fix two LSRA edge cases 2022-10-24 21:55:59 +03:00
Dmitry Stogov
9f472c1c91 Add support for deoptimization and binding to multiple slots 2022-10-21 17:16:25 +03:00
Dmitry Stogov
22cd9265d3 Check if the register is necessary at all 2022-10-18 22:02:09 +03:00
Dmitry Stogov
3ef58e5c2e Take into account RLOADs for non fixed registers 2022-10-11 22:23:09 +03:00
Dmitry Stogov
f5c0151740 Remove hints to the same virtual register 2022-10-05 20:31:20 +03:00
Dmitry Stogov
e9402c8436 Add hint for "op1" if result reuses "op1" register.
This improves register allocation if regiter for result was coalesced and allocated before the register for operand.
2022-10-05 17:58:37 +03:00
Dmitry Stogov
45fff1fe5f Implement binding IR node to VAR (assign spill slot) 2022-09-20 11:03:25 +03:00
Dmitry Stogov
9aac7e76af Requre opearnad to be in register 2022-09-15 22:18:35 +03:00
Dmitry Stogov
a0c9405ae7 Fixed memory leak 2022-09-15 20:32:20 +03:00
Dmitry Stogov
e6f6e92d66 Improve spill code fusion 2022-09-15 17:52:28 +03:00
Dmitry Stogov
ad59556d85 Add support for binding IR nodes to "external" spill slots (e.g. PHP VM stack slots) 2022-09-15 15:26:43 +03:00
Dmitry Stogov
d4cd0d6eba Better interval splitting 2022-09-15 01:50:25 +03:00
Dmitry Stogov
cdc34ae22b Prohibit swapping of operands when the first operand is constant 2022-09-14 14:28:57 +03:00
Dmitry Stogov
76028e8855 Fix compilation warnings 2022-09-05 22:43:27 +03:00
Dmitry Stogov
756a1afc82 Better register allocation support for address and load fusion 2022-09-01 19:19:01 +03:00
Dmitry Stogov
b0cba142a9 Merge ir_uses_fixed_reg() into ir_get_def_flags() and ir_get_use_flags() 2022-08-12 21:17:19 +03:00
Dmitry Stogov
b607a28b2a Fix 2022-08-12 21:01:35 +03:00
Dmitry Stogov
360ca107f4 Replace dirst ir_bitset_union() by ir_bitset_copy() 2022-08-12 19:52:24 +03:00
Dmitry Stogov
d55154d998 Introduce ir_bitqueue API 2022-08-12 19:25:10 +03:00
Dmitry Stogov
9ff5d74778 Introduce ir_bitset_pop_first_ex() and ir_bitset_incl_ex() to avoid repatable checks of the first bitset elements. 2022-08-12 18:01:15 +03:00
Dmitry Stogov
253b99ae74 Eliminate useless ir_bitset_empty() checks 2022-08-11 20:42:03 +03:00
Dmitry Stogov
ca109d3fc9 Use single live interval to handle all scratch registers clobbered by CALL 2022-08-11 19:56:59 +03:00
Dmitry Stogov
1820972a21 Use PHP memory manager 2022-08-10 17:41:14 +03:00
Dmitry Stogov
825d18a5cf Reprder conditions 2022-08-10 15:37:14 +03:00
Dmitry Stogov
8ed4a4d2fa Cleanup "current_range" cache maintenance 2022-08-10 15:24:09 +03:00
Dmitry Stogov
8861c6cf54 Construct unhandled list in backward order to simplify the list sorting 2022-08-10 15:04:01 +03:00
Dmitry Stogov
1ef04d2540 Improve live interval coverage and overlaping tests by checking only the necessary tails of active and inactive intervals. 2022-08-10 13:59:34 +03:00
Dmitry Stogov
89013100c8 Optimize ir_ival_covers() (the list of live ranges is sorted) 2022-08-10 10:38:30 +03:00
Dmitry Stogov
0295c071cf Cache the last ir_live_range.end in ir_live_interval.end 2022-08-10 09:47:06 +03:00
Dmitry Stogov
2148f05392 Initial support for fascall calling convention (incomplete) 2022-06-22 23:59:56 +03:00
Dmitry Stogov
082bcf89c9 Use ir_ctx.fixed_regset to limit available registers 2022-06-21 16:13:14 +03:00
Dmitry Stogov
00e92483bc Fix compilation warnings 2022-06-21 11:41:59 +03:00
Dmitry Stogov
5ef1e97261 Better support for unreachable basic blocks 2022-06-20 16:34:44 +03:00
Dmitry Stogov
5cafe50d36 Initial support for PHP 2022-06-10 00:16:29 +03:00
Dmitry Stogov
3212cd5bd2 Fix compilation warnings 2022-06-07 14:43:35 +03:00
Dmitry Stogov
91bddc09ed Cleanup & unification 2022-06-01 00:34:45 +03:00