================
@@ -0,0 +1,152 @@
+//===- X86.cpp - Emit CIR for x86-64 -------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "../TargetLoweringInfo.h"
+#include "clang/CIR/Dialect/Builder/CIRBaseBuilder.h"
+#include "clang/CIR/Dialect/IR/CIRDataLayout.h"
+#include "clang/CIR/Dialect/IR/CIRDialect.h"
+#include "clang/CIR/Dialect/IR/CIROpsEnums.h"
+#include "clang/CIR/Dialect/IR/CIRTypes.h"
+
+#include <cstdint>
+
+namespace cir {
+
+namespace {
+
+/// x86-64 System V target hooks.
+class X86_64TargetLoweringInfo : public TargetLoweringInfo {
+public:
+  mlir::Value
+  lowerAggregateVAArg(CIRBaseBuilderTy &builder, cir::VAArgOp op,
+                      mlir::Value valist,
+                      const cir::CIRDataLayout &dataLayout) const override;
+};
+
+// Expand a `cir.va_arg` that produces an aggregate into the x86-64 System V
+// register-save-area dance.  The generic lowering of `cir.va_arg` emits an
+// `llvm.va_arg` instruction, which Selection-DAG cannot handle for aggregate
+// types (it crashes with "Unknown type!").  Classic CodeGen open-codes this
+// expansion at the AST level; CIR defers it to the CXXABILowering pass so the
+// LLVM lowering only ever sees a fully expanded form.
+//
+// Only aggregates whose eightbytes are all of INTEGER class (integers,
----------------
adams381 wrote:

Agreed, belongs in CallConvLowering with the classifier, not here. Closing; 
I'll redo it on the callconv stack.

https://github.com/llvm/llvm-project/pull/201175
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to