diff options
Diffstat (limited to 'lib/CodeGen/ABIInfo.h')
-rw-r--r-- | lib/CodeGen/ABIInfo.h | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/CodeGen/ABIInfo.h b/lib/CodeGen/ABIInfo.h index 3de4612..44af0c4 100644 --- a/lib/CodeGen/ABIInfo.h +++ b/lib/CodeGen/ABIInfo.h @@ -10,8 +10,13 @@ #ifndef CLANG_CODEGEN_ABIINFO_H #define CLANG_CODEGEN_ABIINFO_H +#include "clang/AST/Type.h" + +#include <cassert> + namespace llvm { class Type; + class Value; } namespace clang { @@ -38,32 +43,32 @@ namespace clang { Direct, /// Pass the argument directly using the normal /// converted LLVM type. Complex and structure types /// are passed using first class aggregates. - + Indirect, /// Pass the argument indirectly via a hidden pointer /// with the specified alignment (0 indicates default /// alignment). - + Ignore, /// Ignore the argument (treat as void). Useful for /// void and empty structs. - + Coerce, /// Only valid for aggregate return types, the argument /// should be accessed by coercion to a provided type. - + Expand, /// Only valid for aggregate argument types. The /// structure should be expanded into consecutive /// arguments for its constituent fields. Currently /// expand is only allowed on structures whose fields /// are all scalar types or are themselves expandable /// types. - + KindFirst=Direct, KindLast=Expand }; - + private: Kind TheKind; const llvm::Type *TypeData; unsigned UIntData; - + ABIArgInfo(Kind K, const llvm::Type *TD=0, unsigned UI=0) : TheKind(K), TypeData(TD), @@ -71,13 +76,13 @@ namespace clang { public: ABIArgInfo() : TheKind(Direct), TypeData(0), UIntData(0) {} - static ABIArgInfo getDirect() { - return ABIArgInfo(Direct); + static ABIArgInfo getDirect() { + return ABIArgInfo(Direct); } static ABIArgInfo getIgnore() { return ABIArgInfo(Ignore); } - static ABIArgInfo getCoerce(const llvm::Type *T) { + static ABIArgInfo getCoerce(const llvm::Type *T) { return ABIArgInfo(Coerce, T); } static ABIArgInfo getIndirect(unsigned Alignment) { @@ -86,20 +91,20 @@ namespace clang { static ABIArgInfo getExpand() { return ABIArgInfo(Expand); } - + Kind getKind() const { return TheKind; } bool isDirect() const { return TheKind == Direct; } bool isIgnore() const { return TheKind == Ignore; } bool isCoerce() const { return TheKind == Coerce; } bool isIndirect() const { return TheKind == Indirect; } bool isExpand() const { return TheKind == Expand; } - + // Coerce accessors const llvm::Type *getCoerceToType() const { assert(TheKind == Coerce && "Invalid kind!"); return TypeData; } - + // ByVal accessors unsigned getIndirectAlign() const { assert(TheKind == Indirect && "Invalid kind!"); @@ -120,7 +125,7 @@ namespace clang { /// EmitVAArg - Emit the target dependent code to load a value of /// \arg Ty from the va_list pointed to by \arg VAListAddr. - + // FIXME: This is a gaping layering violation if we wanted to drop // the ABI information any lower than CodeGen. Of course, for // VAArg handling it has to be at this level; there is no way to |