[llvm-commits] [llvm-gcc-4.2] r49234 - /llvm-gcc-4.2/trunk/gcc/llvm-abi.h
Devang Patel
dpatel at apple.com
Fri Apr 4 14:29:02 PDT 2008
Author: dpatel
Date: Fri Apr 4 16:29:02 2008
New Revision: 49234
URL: http://llvm.org/viewvc/llvm-project?rev=49234&view=rev
Log:
Add target hook that can be used to over ride handling of struct returns.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=49234&r1=49233&r2=49234&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Fri Apr 4 16:29:02 2008
@@ -204,6 +204,13 @@
return NULL;
}
+// getLLVMAggregateTypeForStructReturn - Return LLVM type if TY can be
+// returnes as multiple values, otherwise return NULL. This is the default
+// target indepdendent implementation.
+static const Type* getLLVMAggregateTypeForStructReturn(const Type *Ty) {
+ return NULL;
+}
+
// LLVM_SHOULD_PASS_VECTOR_IN_INTEGER_REGS - Return true if this vector
// type should be passed as integer registers. Generally vectors which are
// not part of the target architecture should do this.
@@ -275,6 +282,20 @@
#define LLVM_SHOULD_RETURN_VECTOR_AS_SHADOW(X,Y) 0
#endif
+// LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if TY can be
+// returned as a scalar, otherwise return NULL.
+#ifndef LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN
+#define LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(X) \
+ getLLVMScalarTypeForStructReturn(X)
+#endif
+
+// LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if TY can be
+// returned as an aggregate, otherwise return NULL.
+#ifndef LLVM_AGGR_TYPE_FOR_STRUCT_RETURN
+#define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X) \
+ getLLVMAggregateTypeForStructReturn(X)
+#endif
+
/// DefaultABI - This class implements the default LLVM ABI where structures are
/// passed by decimating them into individual components and unions are passed
/// by passing the largest member of the union.
@@ -318,9 +339,10 @@
} else {
// Otherwise return as an integer value large enough to hold the entire
// aggregate.
- const Type* ScalarTy = getLLVMScalarTypeForStructReturn(Ty);
- if (ScalarTy)
+ if (const Type* ScalarTy = LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(Ty))
C.HandleAggregateResultAsScalar(ScalarTy);
+ else if (const Type *AggrTy = LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(Ty))
+ C.HandleAggregateResultAsAggregate(AggrTy);
else {
assert(0 && "Unable to determine how to return this aggregate!");
abort();
More information about the llvm-commits
mailing list