================ @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits