================ @@ -0,0 +1,195 @@ +//===- CIRABIClassifier.h - ABI classification for CIR ----------*- C++ -*-===// +// +// 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 file defines CIRABIClassifier, the interface CallConvLowering uses to +// obtain a mlir::abi::FunctionClassification for a CIR signature. +// +// CIRABIClassifier is the producer half of CIR's calling-convention lowering. +// The consumer half is CIRABIRewriteContext, which turns a classification into +// IR and needs to know nothing about where it came from. +// +//===----------------------------------------------------------------------===// + +#ifndef CLANG_LIB_CIR_DIALECT_TRANSFORMS_CIRABICLASSIFIER_H +#define CLANG_LIB_CIR_DIALECT_TRANSFORMS_CIRABICLASSIFIER_H + +#include "mlir/ABI/ABIRewriteContext.h" +#include "mlir/ABI/ABITypeMapper.h" +#include "mlir/IR/BuiltinOps.h" +#include "mlir/IR/Diagnostics.h" +#include "mlir/Interfaces/DataLayoutInterfaces.h" +#include "clang/CIR/Dialect/IR/CIRDialect.h" +#include "clang/CIR/Dialect/Passes.h" +#include "llvm/ABI/FunctionInfo.h" +#include "llvm/ABI/TargetInfo.h" +#include "llvm/ADT/STLFunctionalExtras.h" +#include "llvm/ADT/StringRef.h" + +#include <memory> +#include <optional> + +namespace cir { + +/// The target-specific settings a classifier needs beyond what it can read +/// from the module. Every field names the target it belongs to, because a +/// classifier for one target ignores the others' settings. +struct ABIClassifierOptions { + // TODO: Make this class target-independent. + + /// The AVX level the x86_64 classifier sizes a native vector at. + llvm::abi::X86AVXABILevel x86AvxAbiLevel = llvm::abi::X86AVXABILevel::None; + + /// Whether a function's own recorded target features may raise its x86_64 + /// AVX level above x86AvxAbiLevel. + bool allowsX86TargetAttrAvx = true; + + /// The x86_64 flags whose value depends on the target and the requested ABI + /// compatibility version. + llvm::abi::X86ABICompatInfo x86AbiCompat; +}; ---------------- andykaylor wrote:
I've already got a factory for the classifier creation, and in this PR X86 is the only classifier using the options structure. I'm trying to maneuver towards a common set of options (see https://github.com/llvm/llvm-project/blob/31e612428a06220689de3230d9b3211579fb3c7e/clang/lib/CodeGen/CodeGenModule.cpp#L386), but I'm still fighting with the fact that x86 went first both here and in the LLVM ABI library. I can do something better here as a first step. https://github.com/llvm/llvm-project/pull/233639 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
