clang API Documentation

Public Member Functions
clang::TargetCodeGenInfo Class Reference

#include <TargetInfo.h>

List of all members.

Public Member Functions

 TargetCodeGenInfo (ABIInfo *info=0)
virtual ~TargetCodeGenInfo ()
const ABIInfogetABIInfo () const
 getABIInfo() - Returns ABI info helper for the target.
virtual void SetTargetAttributes (const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const
virtual unsigned getSizeOfUnwindException () const
virtual bool extendPointerWithSExt () const
virtual int getDwarfEHStackPointer (CodeGen::CodeGenModule &M) const
virtual bool initDwarfEHRegSizeTable (CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const
virtual llvm::ValuedecodeReturnAddress (CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const
virtual llvm::ValueencodeReturnAddress (CodeGen::CodeGenFunction &CGF, llvm::Value *Address) const
virtual llvm::Type * adjustInlineAsmType (CodeGen::CodeGenFunction &CGF, StringRef Constraint, llvm::Type *Ty) const
virtual StringRef getARCRetainAutoreleasedReturnValueMarker () const
virtual bool isNoProtoCallVariadic (const CodeGen::CallArgList &args, const FunctionNoProtoType *fnType) const

Detailed Description

TargetCodeGenInfo - This class organizes various target-specific codegeneration issues, like target-specific attributes, builtins and so on.

Definition at line 42 of file lib/CodeGen/TargetInfo.h.


Constructor & Destructor Documentation

clang::TargetCodeGenInfo::TargetCodeGenInfo ( ABIInfo info = 0) [inline]

Definition at line 46 of file lib/CodeGen/TargetInfo.h.

TargetCodeGenInfo::~TargetCodeGenInfo ( ) [virtual]

Definition at line 88 of file CodeGen/TargetInfo.cpp.


Member Function Documentation

virtual llvm::Type* clang::TargetCodeGenInfo::adjustInlineAsmType ( CodeGen::CodeGenFunction CGF,
StringRef  Constraint,
llvm::Type *  Ty 
) const [inline, virtual]
virtual llvm::Value* clang::TargetCodeGenInfo::decodeReturnAddress ( CodeGen::CodeGenFunction CGF,
llvm::Value Address 
) const [inline, virtual]

Performs the code-generation required to convert a return address as stored by the system into the actual address of the next instruction that will be executed.

Used by __builtin_extract_return_addr().

Definition at line 98 of file lib/CodeGen/TargetInfo.h.

virtual llvm::Value* clang::TargetCodeGenInfo::encodeReturnAddress ( CodeGen::CodeGenFunction CGF,
llvm::Value Address 
) const [inline, virtual]

Performs the code-generation required to convert the address of an instruction into a return address suitable for storage by the system in a return slot.

Used by __builtin_frob_return_addr().

Definition at line 108 of file lib/CodeGen/TargetInfo.h.

virtual bool clang::TargetCodeGenInfo::extendPointerWithSExt ( ) const [inline, virtual]

Controls whether __builtin_extend_pointer should sign-extend pointers to uint64_t or zero-extend them (the default). Has no effect for targets:

  • that have 64-bit pointers, or
  • that cannot address through registers larger than pointers, or
  • that implicitly ignore/truncate the top bits when addressing through such registers.

Definition at line 74 of file lib/CodeGen/TargetInfo.h.

const ABIInfo& clang::TargetCodeGenInfo::getABIInfo ( ) const [inline]

getABIInfo() - Returns ABI info helper for the target.

Definition at line 50 of file lib/CodeGen/TargetInfo.h.

virtual StringRef clang::TargetCodeGenInfo::getARCRetainAutoreleasedReturnValueMarker ( ) const [inline, virtual]

Retrieve the address of a function to call immediately before calling objc_retainAutoreleasedReturnValue. The implementation of objc_autoreleaseReturnValue sniffs the instruction stream following its return address to decide whether it's a call to objc_retainAutoreleasedReturnValue. This can be prohibitively expensive, depending on the relocation model, and so on some targets it instead sniffs for a particular instruction sequence. This functions returns that instruction sequence in inline assembly, which will be empty if none is required.

Definition at line 129 of file lib/CodeGen/TargetInfo.h.

Referenced by clang::CodeGen::CodeGenFunction::EmitARCRetainAutoreleasedReturnValue().

virtual int clang::TargetCodeGenInfo::getDwarfEHStackPointer ( CodeGen::CodeGenModule M) const [inline, virtual]

Determines the DWARF register number for the stack pointer, for exception-handling purposes. Implements __builtin_dwarf_sp_column.

Returns -1 if the operation is unsupported by this target.

Definition at line 80 of file lib/CodeGen/TargetInfo.h.

unsigned TargetCodeGenInfo::getSizeOfUnwindException ( ) const [virtual]

Determines the size of struct _Unwind_Exception on this platform, in 8-bit units. The Itanium ABI defines this as: struct _Unwind_Exception { uint64 exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; uint64 private_1; uint64 private_2; };

Definition at line 92 of file CodeGen/TargetInfo.cpp.

Referenced by InitCatchParam().

virtual bool clang::TargetCodeGenInfo::initDwarfEHRegSizeTable ( CodeGen::CodeGenFunction CGF,
llvm::Value Address 
) const [inline, virtual]

Initializes the given DWARF EH register-size table, a char*. Implements __builtin_init_dwarf_reg_size_table.

Returns true if the operation is unsupported by this target.

Definition at line 88 of file lib/CodeGen/TargetInfo.h.

bool TargetCodeGenInfo::isNoProtoCallVariadic ( const CodeGen::CallArgList args,
const FunctionNoProtoType fnType 
) const [virtual]

Determine whether a call to an unprototyped functions under the given calling convention should use the variadic convention or the non-variadic convention.

There's a good reason to make a platform's variadic calling convention be different from its non-variadic calling convention: the non-variadic arguments can be passed in registers (better for performance), and the variadic arguments can be passed on the stack (also better for performance). If this is done, however, unprototyped functions *must* use the non-variadic convention, because C99 states that a call through an unprototyped function type must succeed if the function was defined with a non-variadic prototype with compatible parameters. Therefore, splitting the conventions makes it impossible to call a variadic function through an unprototyped type. Since function prototypes came out in the late 1970s, this is probably an acceptable trade-off. Nonetheless, not all platforms are willing to make it, and in particularly x86-64 bends over backwards to make the conventions compatible.

The default is false. This is correct whenever:

  • the conventions are exactly the same, because it does not matter and the resulting IR will be somewhat prettier in certain cases; or
  • the conventions are substantively different in how they pass arguments, because in this case using the variadic convention will lead to C99 violations. It is not necessarily correct when arguments are passed in the same way and some out-of-band information is passed for the benefit of variadic callees, as is the case for x86-64. In this case the ABI should be consulted.

Definition at line 101 of file CodeGen/TargetInfo.cpp.

Referenced by clang::CodeGen::CodeGenTypes::arrangeFunctionCall().

virtual void clang::TargetCodeGenInfo::SetTargetAttributes ( const Decl D,
llvm::GlobalValue *  GV,
CodeGen::CodeGenModule M 
) const [inline, virtual]

SetTargetAttributes - Provides a convenient hook to handle extra target-specific attributes for the given global.

Definition at line 54 of file lib/CodeGen/TargetInfo.h.


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