[llvm] [SystemZ] Implement .machine (push|pop) directives (PR #137302)

Dominik Steenken via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 05:51:51 PDT 2025


================
@@ -1382,16 +1388,32 @@ 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();
+  // Do error check before lexing the next token so that TokError
+  // points at the correct token.
+  if ((Id == "pop") && (MachineStack.empty()))
+    return TokError("pop without corresponding push in '.machine' directive");
----------------
dominik-steenken wrote:

actually hang on i used a push instead of a pop...

https://github.com/llvm/llvm-project/pull/137302


More information about the llvm-commits mailing list