[llvm] [SystemZ] Implement .machine (push|pop) directives (PR #137302)
Dominik Steenken via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 28 05:23:43 PDT 2025
================
@@ -1382,17 +1395,35 @@ bool SystemZAsmParser::parseDirectiveMachine(SMLoc L) {
Parser.getTok().isNot(AsmToken::String))
return TokError("unexpected token in '.machine' directive");
- StringRef CPU = Parser.getTok().getIdentifier();
+ StringRef Id = Parser.getTok().getIdentifier();
+
+ // Parse push and pop directives first
+ if (Id == "push") {
+ // Push the Current FeatureBitSet onto the stack.
+ MachineStack.push_back(CurrentFeatures);
+ getTargetStreamer().emitMachine("push");
+ } else if (Id == "pop") {
+ // If the Stack is not empty, pop the topmost FeatureBitset and use it.
+ if (MachineStack.empty())
+ return TokError("pop without corresponding push in '.machine' directive");
+ CurrentFeatures = MachineStack.back();
+ MachineStack.pop_back();
+ setAvailableFeatures(CurrentFeatures);
----------------
dominik-steenken wrote:
Thanks, i was a bit confused as to what `ComputeAvailableFeatures` did since it takes and produces a `FeatureBitset`. Since i took your advice above, i think this is now addressed as well.
https://github.com/llvm/llvm-project/pull/137302
More information about the llvm-commits
mailing list