[clang] [CIR] Upstream basic alloca and load support (PR #128792)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 26 14:55:01 PST 2025
================
@@ -0,0 +1,82 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This contains code to emit Decl nodes as CIR code.
+//
+//===----------------------------------------------------------------------===//
+
+#include "CIRGenFunction.h"
+#include "clang/AST/Expr.h"
+#include "clang/CIR/MissingFeatures.h"
+
+using namespace clang;
+using namespace clang::CIRGen;
+
+/// Emit code and set up symbol table for a variable declaration with auto,
+/// register, or no storage class specifier. These turn into simple stack
+/// objects, globals depending on target.
+void CIRGenFunction::emitAutoVarDecl(const VarDecl &d) {
+ QualType ty = d.getType();
+ assert(ty.getAddressSpace() == LangAS::Default);
----------------
andykaylor wrote:
> If upstream is silently ignoring things this is pretty bad, because it leads to subtle miscompilations that are super hard to debug/find.
There's nothing really subtle about no CIR being generated for function arguments (the case I had in mind that's being ignored currently). I take your point though, and I'll try to incorporate the suggestion.
My question is more like this. When we have large sections of code being omitted that are checking for conditions that maybe can't even be checked yet because the support functions are missing, how should that be handled? In this function, I have checks plus errorNYI for a lot of things, but it feels very messy. What I really want is something like a single check for the limited cases we are handling, and an error for anything else, but that's not always possible. In places where the conditions can't be checked, I've put MissingFeature calls.
https://github.com/llvm/llvm-project/pull/128792
More information about the cfe-commits
mailing list