From d9cc333cc71aef5bb87cb1f4d68cadc9b2e20d7f Mon Sep 17 00:00:00 2001 From: Or Biri Date: Fri, 10 Jan 2025 20:37:51 +0200 Subject: [PATCH] [CIR][CodeGen][NFC] Add documentation regarding memory emission deferral --- clang/lib/CIR/CodeGen/CIRGenFunction.h | 9 +++++++++ clang/lib/CIR/CodeGen/CIRGenTypes.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h index ce26520114e8..047f7488f5dc 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.h +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h @@ -1114,6 +1114,10 @@ class CIRGenFunction : public CIRGenTypeCache { /// addressed later. RValue GetUndefRValue(clang::QualType Ty); + /// Given a value and its clang type, returns the value casted from its memory + /// representation. + /// Note: CIR defers most of the special casting to the final lowering passes + /// to conserve the high level information. mlir::Value emitFromMemory(mlir::Value Value, clang::QualType Ty); mlir::LogicalResult emitAsmStmt(const clang::AsmStmt &S); @@ -1339,7 +1343,12 @@ class CIRGenFunction : public CIRGenTypeCache { } void emitStoreOfScalar(mlir::Value value, LValue lvalue, bool isInit); + /// Given a value and its clang type, returns the value casted to its memory + /// representation. + /// Note: CIR defers most of the special casting to the final lowering passes + /// to conserve the high level information. mlir::Value emitToMemory(mlir::Value Value, clang::QualType Ty); + void emitDeclRefExprDbgValue(const DeclRefExpr *E, const APValue &Init); /// Store the specified rvalue into the specified diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.h b/clang/lib/CIR/CodeGen/CIRGenTypes.h index 1d01a56cfa41..b2ca274f63ec 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.h +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.h @@ -186,7 +186,8 @@ class CIRGenTypes { /// convertType in that it is used to convert to the memory representation /// for a type. For example, the scalar representation for _Bool is i1, but /// the memory representation is usually i8 or i32, depending on the target. - // TODO: convert this comment to account for MLIR's equivalence + /// Note: CIR defers most of the special conversions to the final lowering + /// passes to conserve the high level information. mlir::Type convertTypeForMem(clang::QualType, bool forBitField = false); /// Get the CIR function type for \arg Info.