[Mlir-commits] [mlir] [mlir][emitc] Deferred emission as expressions (PR #159975)
Gil Rapaport
llvmlistbot at llvm.org
Sat Sep 27 08:33:33 PDT 2025
================
@@ -1288,44 +1371,14 @@ CppEmitter::CppEmitter(raw_ostream &os, bool declareVariablesAtTop,
labelInScopeCount.push(0);
}
-std::string CppEmitter::getSubscriptName(emitc::SubscriptOp op) {
- std::string out;
- llvm::raw_string_ostream ss(out);
- ss << getOrCreateName(op.getValue());
- for (auto index : op.getIndices()) {
- ss << "[" << getOrCreateName(index) << "]";
- }
- return out;
-}
-
-std::string CppEmitter::createMemberAccess(emitc::MemberOp op) {
- std::string out;
- llvm::raw_string_ostream ss(out);
- ss << getOrCreateName(op.getOperand());
- ss << "." << op.getMember();
- return out;
-}
-
-std::string CppEmitter::createMemberAccess(emitc::MemberOfPtrOp op) {
- std::string out;
- llvm::raw_string_ostream ss(out);
- ss << getOrCreateName(op.getOperand());
- ss << "->" << op.getMember();
- return out;
-}
-
-void CppEmitter::cacheDeferredOpResult(Value value, StringRef str) {
- if (!valueMapper.count(value))
- valueMapper.insert(value, str.str());
+void CppEmitter::setName(Value val, StringRef name) {
----------------
aniragil wrote:
It's meant to match the existing `getOrCreateName()`, which is also used for block labels (we now also have `getOrCreateInductionVarName()`). We should indeed find something less obscure for that mapping-to-C API, but perhaps do it in a separate patch?
https://github.com/llvm/llvm-project/pull/159975
More information about the Mlir-commits
mailing list