summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/ABIInfo.h
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2009-06-05 22:08:42 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2009-06-05 22:08:42 +0000
commitc4a59eb306efeb4bffa3cefecd1e6392fc5c4144 (patch)
treeb68a1188634b6b223753044144b941ba425da5b6 /lib/CodeGen/ABIInfo.h
parentacebb397fa5d63835a0de9cee144987057ec1333 (diff)
Factor out TargetABIInfo stuff into separate file. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/ABIInfo.h')
-rw-r--r--lib/CodeGen/ABIInfo.h33
1 files changed, 19 insertions, 14 deletions
diff --git a/lib/CodeGen/ABIInfo.h b/lib/CodeGen/ABIInfo.h
index 3de461242a..44af0c476a 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