Files
revng-revng/lib/CliftTransforms/FieldAccessReplacement.h
Andrea Gussoni 0e63c46930 EmitFieldAccesses: propagate through indirection
After a replacement, check if the replaced value feeds into an
IndirectionOp. If the "rich" pre-bitcast value has a ptr<ptr<T>>
type, create a new typed IndirectionOp and insert a fixup bitcast
for existing non-lvalue uses. Lvalue uses (assign LHS) stay on the
old indirection to preserve type and lvalue constraints.

Returns true if propagation occurred, signaling the EFA driver to
rerun and discover new rewriting opportunities.
2026-04-14 09:50:48 +02:00

17 lines
641 B
C

#pragma once
//
// This file is distributed under the MIT License. See LICENSE.md for details.
//
#include "BestTraversal.h"
#include "PointerArithmetic.h"
/// Perform the replacement of the pointer arithmetic access
/// (`PointerToReplace`), with operations equivalent to the `BestTraversal`.
/// Returns `true` if a type was propagated through an `indirection`, signaling
/// that a subsequent EFA pass may find new rewriting opportunities.
bool replaceFieldAccess(mlir::clift::ExpressionOpInterface PointerToReplace,
const PointerArithmetic &Arithmetic,
const Traversal &BestTraversal);