[clang] [CIR] Lowering to LLVM for global pointers (PR #125619)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 4 07:11:04 PST 2025
================
@@ -35,6 +36,54 @@ using namespace llvm;
namespace cir {
namespace direct {
+class CIRAttrToValue : public CirAttrVisitor<CIRAttrToValue, mlir::Value> {
+public:
+ mlir::Value lowerCirAttrAsValue(mlir::Operation *parentOp,
+ mlir::Attribute attr,
+ mlir::ConversionPatternRewriter &rewriter,
+ const mlir::TypeConverter *converter,
+ mlir::DataLayout const &dataLayout) {
+ return visit(attr, parentOp, rewriter, converter, dataLayout);
+ }
+
+ mlir::Value visitCirIntAttr(cir::IntAttr intAttr, mlir::Operation *parentOp,
+ mlir::ConversionPatternRewriter &rewriter,
----------------
erichkeane wrote:
Instead of all the arguments, typically with the visitors, we have them become members of the visitor itself. So this would be:
```
mlir::Value visitCirIntAttr(cir::IntAttr intAttr) {
Location Loc parentOp->getLoc();
return rewriter.create<mlir::LLVM::ConstantOp>(
loc, converter->convertType(intAttr.getType()), intAttr.getValue());
}
```
still, but they would be members instead.
https://github.com/llvm/llvm-project/pull/125619
More information about the cfe-commits
mailing list