Skip to content

Use the new directives in Arm #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 39 commits into from

Conversation

spiessimon
Copy link
Owner

@spiessimon spiessimon commented Apr 18, 2025

This PR replaces the manually printed assembly directives in Arm with the new assembly directives. I only observed a minor difference in the resulting assembly: no comments for floating point constants. The difference is summarized in this branch: https://github.com/spiessimon/flambda-backend/tree/new-directives-in-arm-patches

TheNumbat and others added 15 commits April 17, 2025 17:29
Previously, the `add_equation` logic handled multiple concerns at the
same time in a relatively convoluted way, in part due to the need to
accomodate both basic and advanced meet algorithms in the same code.
With the removal of the basic meet (ocaml-flambda#3726), we can considerably simplify
the code.

This commit refactors `add_equation` by decomposing it into smaller,
well-defined steps and recognizing that concrete types and aliases need
to be handled differently.

This restructuring clarifies the process of adding an equation:

1. Compute the canonical of the LHS with
   `get_canonical_simple_ignoring_name_mode`

2. Check if the type is a concrete type or an alias, which is then
   resolved to its current canonical (`add_equation_on_canonical`).

3. If an alias, merge the two canonical simples in the Aliases
   structure, then call `record_demotion` to update the typing env,
   transferring the existing concrete type from the demoted element to
   its new canonical element.

4. If a concrete type, perform the `meet` with the existing concrete
   type, then call `replace_concrete_equation` if a more precise
   concrete type is found.  `replace_concrete_equation` automatically
   demotes to a constant instead if the concrete type is a singleton
   (without going through `record_demotion`, since we have already
   computed the `meet`).

Additionally, `Type_grammar.recover_const_alias` is renamed to
`must_be_singleton`, which better captures its behavior.

Overall, this should be easier to read and maintain. It also facilitates
extensions; for instance, the improved relations tracking for the
match-in-match heuristics will rely on `record_demotion` and
`add_alias_between_canonicals`.
* Disable warning 4 on SIMD instructions only

* Move warning "-66" back to one "open"

* Stronger condition for [Simd.Seq.equal]

* Minor refactor of [Simd.Seq]

* Format arm64/regalloc_stack_operands.ml

* Refactor Simd.operation

* Add a CR

* Refactor Simd_selection.pseudoregs_for_operation

* Minor refactor in Emit

* Refactor SSE string operations: instroduce Pcompare_string layer

* minor edit

* match on seq id

---------

Co-authored-by: Greta Yorsh <[email protected]>
revert order for frametable expression
* remove direct assignment of the form x = e

* ocamlformat
@spiessimon spiessimon force-pushed the new-directives-delete-fcm branch from 7fca7b7 to 647a5f8 Compare April 22, 2025 12:37
@spiessimon spiessimon force-pushed the new-directives-in-arm branch 2 times, most recently from f2bf842 to 4eb459d Compare April 23, 2025 09:22
@spiessimon spiessimon force-pushed the new-directives-in-arm branch 2 times, most recently from debc14e to 62e9ab4 Compare April 24, 2025 10:16
@spiessimon spiessimon changed the title WIP: Use the new directives in Arm Use the new directives in Arm Apr 24, 2025
* Fix stack offset after eliminating dead handlers
* Propagate handler label to Linear.Poptrap for debugging
* Move [invalid_stack_offset] to [Cfg]
* Remove unused interface
* Add [Cfg.set_stack_offset_for_block]
* Check top of trap stack on pop in select_utils (disabled by default)
* Improve debug printing
* Remove Select_utils.debug (statically turn on)
@spiessimon spiessimon force-pushed the new-directives-in-arm branch from 4c703f1 to 820f17b Compare April 24, 2025 12:24
gretay-js and others added 5 commits April 24, 2025 13:29
…ges to `ART` API (ocaml-flambda#3884)

* Use [Are_rebuilding_terms.t] in DE instead of bool

Also, remove the `of_bool` function in favour of dedicated constructors
for values of type [ART.t], since they were only called with constant
literals for now.

Not a necessary path, but seems cleaner.

* missing renaming

* make fmt
* Stable ordering

* Update middle_end/flambda2/compare/compare.ml

Co-authored-by: Nathanaëlle Courant <[email protected]>

---------

Co-authored-by: Nathanaëlle Courant <[email protected]>
…l-flambda#3303)

Index lifted cont params y variables instead of custom indexes

This should have no observable effect, but will simplify the
continuation specialization work, particularly when paired with the
replay histories feature, so that lifted cont params can be correctly
tracked between a first pass and subsequent passes during continuation
specialization.
@spiessimon spiessimon force-pushed the new-directives-in-arm branch from 6652136 to 079dfa4 Compare April 24, 2025 14:43
Currently, any and all variables in scope, including parameters
and extra parameters (coming from CSE and unboxing), are added to the
lifted_cont_params. This is superfluous, since the handlers of lifted
continuations do not contain any reference to these extra params prior
to simplification, and these extra params can be recomputed for the
lifted continuations.

As it stands, this commit alone may lead to regressions, since we
currently do not perform unboxing on the lifted_cont_params. This will
be fixed in a later commit.
@spiessimon spiessimon force-pushed the new-directives-in-arm branch 2 times, most recently from b0d668b to b3f70e5 Compare April 25, 2025 08:48
@spiessimon spiessimon force-pushed the new-directives-in-arm branch from b3f70e5 to a7d853d Compare April 25, 2025 09:25
@spiessimon spiessimon force-pushed the new-directives-in-arm branch from bfa142f to ae0ac31 Compare April 25, 2025 09:43
@spiessimon spiessimon closed this Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.