clang 24.0.0git
CallConvLoweringPass.cpp File Reference
#include "CIRABIClassifier.h"
#include "PassDetail.h"
#include "TargetLowering/CIRABIRewriteContext.h"
#include "mlir/ABI/ABIRewriteContext.h"
#include "mlir/Dialect/DLTI/DLTI.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/DataLayoutInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "clang/CIR/Dialect/IR/CIRDialect.h"
#include "clang/CIR/Dialect/Passes.h"
#include "llvm/ABI/TargetInfo.h"
#include "llvm/ADT/ScopeExit.h"
#include <algorithm>
#include "clang/CIR/Dialect/Passes.h.inc"

Go to the source code of this file.

Namespaces

namespace  mlir

Macros

#define GEN_PASS_DEF_CALLCONVLOWERING

Functions

static bool hasIncompleteRecordByValue (mlir::Type ty)
 Whether ty, or an aggregate member/element reached by value (never through a pointer), is an incomplete record.
static bool hasIndirectSlot (const FunctionClassification &fc)
 Whether fc gives the callee access to memory through a pointer the ABI introduced: an sret slot for an indirect return, or an indirect or byref argument.
template<typename OpTy>
static void widenForArgMemory (OpTy op)
 Record on op that the memory its pointer arguments address may be read and written.
static bool classifiesSamePrefix (const FunctionClassification &calleeFc, const FunctionClassification &callFc)
 Whether callFc classifies a call's leading arguments and its return exactly as calleeFc classifies the callee's declared parameters and return.
static std::unique_ptr< CIRABIClassifier > createABIClassifier (cir::CallConvTarget target, StringRef classificationAttrName, const DataLayout &dl, ModuleOp modOp, const ABIClassifierOptions &options)
 Build the classifier the pass options select.

Macro Definition Documentation

◆ GEN_PASS_DEF_CALLCONVLOWERING

#define GEN_PASS_DEF_CALLCONVLOWERING

Definition at line 57 of file CallConvLoweringPass.cpp.

Function Documentation

◆ classifiesSamePrefix()

bool classifiesSamePrefix ( const FunctionClassification & calleeFc,
const FunctionClassification & callFc )
static

Whether callFc classifies a call's leading arguments and its return exactly as calleeFc classifies the callee's declared parameters and return.

A function definition and its call sites are rewritten from separate classifications, so the two would silently disagree on the wire format if an ellipsis argument could ever change how a declared parameter is passed.

Definition at line 104 of file CallConvLoweringPass.cpp.

◆ createABIClassifier()

std::unique_ptr< CIRABIClassifier > createABIClassifier ( cir::CallConvTarget target,
StringRef classificationAttrName,
const DataLayout & dl,
ModuleOp modOp,
const ABIClassifierOptions & options )
static

Build the classifier the pass options select.

Exactly one of target and classificationAttrName is set, which runOnOperation checks before calling.

Definition at line 139 of file CallConvLoweringPass.cpp.

References cir::AArch64, cir::AMDGPU, cir::createAArch64ABIClassifier(), cir::createAMDGPUABIClassifier(), cir::createInjectedABIClassifier(), cir::createSPIRVABIClassifier(), cir::createTestTargetABIClassifier(), cir::createX86_64ABIClassifier(), cir::None, cir::SPIRV, cir::Test, and cir::X86_64.

◆ hasIncompleteRecordByValue()

bool hasIncompleteRecordByValue ( mlir::Type ty)
static

Whether ty, or an aggregate member/element reached by value (never through a pointer), is an incomplete record.

Such a record has no known layout, so no classification can be built for it.

Definition at line 64 of file CallConvLoweringPass.cpp.

References hasIncompleteRecordByValue().

Referenced by hasIncompleteRecordByValue().

◆ hasIndirectSlot()

bool hasIndirectSlot ( const FunctionClassification & fc)
static

Whether fc gives the callee access to memory through a pointer the ABI introduced: an sret slot for an indirect return, or an indirect or byref argument.

Definition at line 76 of file CallConvLoweringPass.cpp.

◆ widenForArgMemory()

template<typename OpTy>
void widenForArgMemory ( OpTy op)
static

Record on op that the memory its pointer arguments address may be read and written.

Absent effects already allow that, since an absent attribute means the effects are unknown, so they are left absent.

Definition at line 87 of file CallConvLoweringPass.cpp.