[llvm] [SystemZ] Implement .machine (push|pop) directives (PR #137302)
Dominik Steenken via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 28 05:26:20 PDT 2025
dominik-steenken wrote:
> > This implementation makes the assumption that, without any `.machine` directive, the "current" machine is undefined, rather than trying to derive it based on the host machine. Thus, in this implementation, any `.machine push` _must_ be preceded by at least one `.machine <cpu>`. Otherwise, a parsing error is recognized.
>
> I don't think this matches GAS behavior. Why is this necessary? Can't we just push the feature bits instead of the name onto the stack? There's the default set of feature bits that's already detected (and used before any explicit machine directive); a first push would just push this; subsequent pops would restore whatever bits are set without having to re-compute them from a name.
Thanks, that was very helpful. I was somewhat unhappy with this solution as well. It originated from me having difficulties obtaining a string description of the CPU from the `SubTargetInfo` - it seemed no matter where i sourced this from, it would always be an empty string. But as you point out, it is also possible to just store the bits and restore them once the `.machine` stack is empty. I have updated the commit to provide an implementation that does this. `.machine push` without a prior `.machine <cpu>` is thus now legal and i have modified the tests accordingly. I have also tried to incorporate your additional feedback. I am now waiting for the CI to complete.
https://github.com/llvm/llvm-project/pull/137302
More information about the llvm-commits
mailing list