[llvm] [AMDGPU] MCExpr printing helper with KnownBits support (PR #95951)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 12:19:56 PDT 2024


================
@@ -105,6 +106,16 @@ class AMDGPUMCExpr : public MCTargetExpr {
   }
 };
 
+// Tries to leverage KnownBits for MCExprs to reduce and limit any composed
+// MCExprs printing. E.g., for an expression such as
+// ((unevaluatable_sym | 1) & 1) won't evaluate due to unevaluatable_sym and
+// would verbosely print the full expression; however, KnownBits should deduce
+// the value to be 1. Particularly useful for AMDGPU metadata MCExprs.
+void AMDGPUMCExprPrint(const MCExpr *Expr, raw_ostream &OS,
+                       const MCAsmInfo *MAI);
+
+const MCExpr *TryFold(const MCExpr *Expr, MCContext &Ctx);
----------------
arsenm wrote:

Needs better name, and shouldn't be in the llvm namespace 

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


More information about the llvm-commits mailing list