[llvm] [AMDGPU] MCExpr-ify MC layer kernel descriptor (PR #80855)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 09:06:42 PST 2024


================
@@ -5276,89 +5277,107 @@ bool AMDGPUAsmParser::ParseDirectiveAMDHSAKernel() {
       return TokError(".amdhsa_ directives cannot be repeated");
 
     SMLoc ValStart = getLoc();
-    int64_t IVal;
-    if (getParser().parseAbsoluteExpression(IVal))
+    const MCExpr *ExprVal;
+    if (getParser().parseExpression(ExprVal))
       return true;
     SMLoc ValEnd = getLoc();
     SMRange ValRange = SMRange(ValStart, ValEnd);
 
-    if (IVal < 0)
-      return OutOfRangeError(ValRange);
-
+    int64_t IVal = 0;
     uint64_t Val = IVal;
+    bool EvaluatableExpr;
+    if ((EvaluatableExpr = ExprVal->evaluateAsAbsolute(IVal))) {
+      if (IVal < 0)
----------------
arsenm wrote:

Needs tests for these assorted errors 

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


More information about the llvm-commits mailing list