[clang] [CIR] Upstream func args alloca handling (PR #129167)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 28 09:59:56 PST 2025
================
@@ -149,16 +153,49 @@ mlir::LogicalResult CIRGenFunction::declare(Address addr, const Decl *var,
void CIRGenFunction::startFunction(GlobalDecl gd, QualType returnType,
cir::FuncOp fn, cir::FuncType funcType,
- SourceLocation loc,
+ FunctionArgList args, SourceLocation loc,
SourceLocation startLoc) {
assert(!curFn &&
"CIRGenFunction can only be used for one function at a time");
fnRetTy = returnType;
curFn = fn;
+ const auto *fd = dyn_cast_or_null<FunctionDecl>(gd.getDecl());
+
mlir::Block *entryBB = &fn.getBlocks().front();
builder.setInsertionPointToStart(entryBB);
+
+ // TODO(cir): this should live in `emitFunctionProlog
+ // Declare all the function arguments in the symbol table.
+ for (const auto nameValue : llvm::zip(args, entryBB->getArguments())) {
+ auto *paramVar = std::get<0>(nameValue);
----------------
andykaylor wrote:
Yeah, I know this. I don't know how I missed these. I'll probably do this a few more times before it completely sinks in.
https://github.com/llvm/llvm-project/pull/129167
More information about the cfe-commits
mailing list