sun::codegen::abi
namespace · Source (opens in a new tab)
Adapts Sun values and calls to the target C calling convention.
Checks compatible C types and emits calls across the C ABI boundary.
Namespaces
Classes
- sun::codegen::abi::ExternCEmitter (public)
Structs
- sun::codegen::abi::SignednessInfo (public)
- sun::codegen::abi::ArgLowering (public)
- sun::codegen::abi::SignatureLowering (public)
- sun::codegen::abi::PreparedArg (public)
Functions
- buildLoweredFunctionType
- isCStyleEnum
- isCallbackParameter
- isCallbackReturn
- isFunctionPointer
- isReturn
- isValue
- lowerCSignature
buildLoweredFunctionType
public · function · Source (opens in a new tab)
llvm::FunctionType * sun::codegen::abi::buildLoweredFunctionType(const SignatureLowering &lowering, llvm::LLVMContext &ctx, bool isVarArg)The LLVM function type implied by a lowering: sret pointer prepended when needed, coerced parameters expanded in place, indirect ones as pointers.
Builds the LLVM function type required by a lowered C signature.
Related: SignatureLowering
isCStyleEnum
public · function · Source (opens in a new tab)
bool sun::codegen::abi::isCStyleEnum(const TypePtr &type)Return whether an enum uses C's integer representation.
Related: TypePtr
isCallbackParameter
public · function · Source (opens in a new tab)
bool sun::codegen::abi::isCallbackParameter(const TypePtr &type)Return whether a C function pointer can accept this parameter type.
Related: TypePtr
isCallbackReturn
public · function · Source (opens in a new tab)
bool sun::codegen::abi::isCallbackReturn(const TypePtr &type)Return whether a C function pointer can return this type.
Related: TypePtr
isFunctionPointer
public · function · Source (opens in a new tab)
bool sun::codegen::abi::isFunctionPointer(const TypePtr &type)Return whether a function type is a non-throwing C function pointer.
Related: TypePtr
isReturn
public · function · Source (opens in a new tab)
bool sun::codegen::abi::isReturn(const TypePtr &type)Return whether a value has a supported C return layout.
Related: TypePtr
isValue
public · function · Source (opens in a new tab)
bool sun::codegen::abi::isValue(const TypePtr &type)Return whether a value has a supported C global or parameter layout.
Related: TypePtr
lowerCSignature
public · function · Source (opens in a new tab)
SignatureLowering sun::codegen::abi::lowerCSignature(const llvm::Triple &triple, llvm::Type *returnType, llvm::ArrayRef< llvm::Type * > paramTypes, const llvm::DataLayout &dl, const SignednessInfo *signs=nullptr)Classify a whole signature under the C ABI of triple.
Classifies every parameter and the result of a C function signature.
Throws a compilation error for targets without implemented rules. signs says which integers are signed, for targets that must pick an extension; null means "unknown", which only loses the extension attributes such targets want, so pass it whenever the Sun-level types are at hand.
Related: SignatureLowering, SignednessInfo
Enums
ArgKind
public · enum · Source (opens in a new tab)
enum class sun::codegen::abi::ArgKindDescribes how an argument crosses the target C calling convention.
Direct
Direct
No documentation comment.
Coerced
Coerced
No documentation comment.
Indirect
Indirect
No documentation comment.
Extend
public · enum · Source (opens in a new tab)
enum class sun::codegen::abi::Extend : uint8_tHow an integer narrower than 32 bits must be widened at the boundary.
Darwin arm64 requires the caller to extend such arguments (and the callee such returns), spelled as the signext/zeroext attributes; ELF leaves the upper bits unspecified and needs neither.
None
None
No documentation comment.
Zero
Zero
No documentation comment.
Sign
Sign
No documentation comment.