clang 22.0.0git
clang::CodeGen::SwiftABIInfo Class Reference

Target specific hooks for defining how a type should be passed or returned from functions with one of the Swift calling conventions. More...

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/ABIInfo.h"

Public Member Functions

 SwiftABIInfo (CodeGen::CodeGenTypes &CGT, bool SwiftErrorInRegister)
virtual ~SwiftABIInfo ()
virtual bool shouldPassIndirectly (ArrayRef< llvm::Type * > ComponentTys, bool AsReturnValue) const
 Returns true if an aggregate which expands to the given type sequence should be passed / returned indirectly.
virtual bool isLegalVectorType (CharUnits VectorSize, llvm::Type *EltTy, unsigned NumElts) const
 Returns true if the given vector type is legal from Swift's calling convention perspective.
bool isSwiftErrorInRegister () const
 Returns true if swifterror is lowered to a register by the target ABI.

Protected Member Functions

bool occupiesMoreThan (ArrayRef< llvm::Type * > scalarTypes, unsigned maxAllRegisters) const
 Does the given lowering require more than the given number of registers when expanded?

Protected Attributes

CodeGenTypesCGT
bool SwiftErrorInRegister

Detailed Description

Target specific hooks for defining how a type should be passed or returned from functions with one of the Swift calling conventions.

Definition at line 145 of file ABIInfo.h.

Constructor & Destructor Documentation

◆ SwiftABIInfo()

clang::CodeGen::SwiftABIInfo::SwiftABIInfo ( CodeGen::CodeGenTypes & CGT,
bool SwiftErrorInRegister )
inline

Definition at line 154 of file ABIInfo.h.

References CGT, and SwiftErrorInRegister.

◆ ~SwiftABIInfo()

SwiftABIInfo::~SwiftABIInfo ( )
virtualdefault

Member Function Documentation

◆ isLegalVectorType()

bool SwiftABIInfo::isLegalVectorType ( CharUnits VectorSize,
llvm::Type * EltTy,
unsigned NumElts ) const
virtual

Returns true if the given vector type is legal from Swift's calling convention perspective.

Definition at line 293 of file ABIInfo.cpp.

References clang::CharUnits::getQuantity().

Referenced by clang::CodeGen::swiftcall::isLegalVectorType().

◆ isSwiftErrorInRegister()

bool clang::CodeGen::SwiftABIInfo::isSwiftErrorInRegister ( ) const
inline

Returns true if swifterror is lowered to a register by the target ABI.

Definition at line 170 of file ABIInfo.h.

References SwiftErrorInRegister.

Referenced by clang::CodeGen::swiftcall::isSwiftErrorLoweredInRegister().

◆ occupiesMoreThan()

bool SwiftABIInfo::occupiesMoreThan ( ArrayRef< llvm::Type * > scalarTypes,
unsigned maxAllRegisters ) const
protected

Does the given lowering require more than the given number of registers when expanded?

This is intended to be the basis of a reasonable basic implementation of should{Pass,Return}Indirectly.

For most targets, a limit of four total registers is reasonable; this limits the amount of code required in order to move around the value in case it wasn't produced immediately prior to the call by the caller (or wasn't produced in exactly the right registers) or isn't used immediately within the callee. But some targets may need to further limit the register count due to an inability to support that many return registers.

Definition at line 270 of file ABIInfo.cpp.

References CGT, clang::Default, and clang::ast_matchers::type.

Referenced by shouldPassIndirectly().

◆ shouldPassIndirectly()

bool SwiftABIInfo::shouldPassIndirectly ( ArrayRef< llvm::Type * > ComponentTys,
bool AsReturnValue ) const
virtual

Returns true if an aggregate which expands to the given type sequence should be passed / returned indirectly.

Definition at line 288 of file ABIInfo.cpp.

References occupiesMoreThan().

Referenced by clang::CodeGen::swiftcall::shouldPassIndirectly(), and clang::CodeGen::swiftcall::SwiftAggLowering::shouldPassIndirectly().

Member Data Documentation

◆ CGT

CodeGenTypes& clang::CodeGen::SwiftABIInfo::CGT
protected

Definition at line 147 of file ABIInfo.h.

Referenced by occupiesMoreThan(), and SwiftABIInfo().

◆ SwiftErrorInRegister

bool clang::CodeGen::SwiftABIInfo::SwiftErrorInRegister
protected

Definition at line 148 of file ABIInfo.h.

Referenced by isSwiftErrorInRegister(), and SwiftABIInfo().


The documentation for this class was generated from the following files: