[llvm] Introduce DIExpressionOptimizer (PR #69769)

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 13:43:20 PDT 2023


================
@@ -3073,6 +3073,109 @@ template <> struct DenseMapInfo<DIExpression::FragmentInfo> {
   static bool isEqual(const FragInfo &A, const FragInfo &B) { return A == B; }
 };
 
+class DIExpressionOptimizer {
+
+  // When looking at a DIExpression such as {DW_OP_constu, 1, DW_OP_constu, 2,
+  // DW_OP_plus} and trying to append {DW_OP_consts, 3, DW_OP_minus}
+  // NewMathOperator = DW_OP_minus
+  // OperandRight = 3
+  // OperatorRight = DW_OP_consts
+  // CurrMathOperator = DW_OP_plus
+  // OperandLeft = 2
+  // OperandLeft = DW_OP_constu
+
+  /// The math operator of the new subexpression being appended to the
+  /// DIExpression.
+  uint64_t NewMathOperator = 0;
----------------
adrian-prantl wrote:

What do you think about calling `MathOperator` more generically `BinOp`, or `BinaryOperator`, so all operations that take two arguments fit the description?

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


More information about the llvm-commits mailing list