[llvm-commits] [llvm-gcc-4.2] r49733 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386-target.h config/i386/llvm-i386.cpp llvm-abi.h

Devang Patel dpatel at apple.com
Tue Apr 15 11:29:46 PDT 2008


Author: dpatel
Date: Tue Apr 15 13:29:45 2008
New Revision: 49733

URL: http://llvm.org/viewvc/llvm-project?rev=49733&view=rev
Log:
Using gcc's tree type node is handy.
It allows target specific code to take advantage of existing 
gcc helper functions.

Modified:
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
    llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-abi.h

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h?rev=49733&r1=49732&r2=49733&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386-target.h Tue Apr 15 13:29:45 2008
@@ -105,14 +105,14 @@
 #define LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(X) \
   llvm_x86_scalar_type_for_struct_return(X)
 
-extern const Type *llvm_x86_scalar_type_for_struct_return(const Type *Ty);
+extern const Type *llvm_x86_scalar_type_for_struct_return(tree type);
 
 /* LLVM_AGGR_TYPE_FOR_STRUCT_RETURN - Return LLVM Type if X can be 
    returned as an aggregate, otherwise return NULL. */
 #define LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(X) \
   llvm_x86_aggr_type_for_struct_return(X)
 
-extern const Type *llvm_x86_aggr_type_for_struct_return(const Type *Ty);
+extern const Type *llvm_x86_aggr_type_for_struct_return(tree type);
 
 /* LLVM_BUILD_MULTIPLE_RETURN_VALUE - Build multiple return values
    for the function FN and add them in RETVALS.  */

Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=49733&r1=49732&r2=49733&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Tue Apr 15 13:29:45 2008
@@ -957,10 +957,10 @@
   return true;
 }
 
-// llvm_x86_scalar_type_for_struct_return - Return LLVM type if TY 
+// llvm_x86_scalar_type_for_struct_return - Return LLVM type if TYPE
 // can be returned as a scalar, otherwise return NULL.
-const Type *llvm_x86_scalar_type_for_struct_return(const Type *Ty) {
-
+const Type *llvm_x86_scalar_type_for_struct_return(tree type) {
+  const Type *Ty = ConvertType(type);
   unsigned Size = getTargetData().getABITypeSize(Ty);
   if (Size == 0)
     return Type::VoidTy;
@@ -985,9 +985,9 @@
   return NULL;
 }
 
-// Return LLVM Type if TY can be returned as an aggregate, otherwise return NULL.
-const Type *llvm_x86_aggr_type_for_struct_return(const Type *Ty) {
-
+// Return LLVM Type if TYPE can be returned as an aggregate, otherwise return NULL.
+const Type *llvm_x86_aggr_type_for_struct_return(tree type) {
+  const Type *Ty = ConvertType(type);
   if (!llvm_suitable_multiple_ret_value_type(Ty))
     return NULL;
 

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=49733&r1=49732&r2=49733&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Tue Apr 15 13:29:45 2008
@@ -183,8 +183,8 @@
 // getLLVMScalarTypeForStructReturn - Return LLVM Type if TY can be 
 // returned as a scalar, otherwise return NULL. This is the default
 // target independent implementation.
-static const Type* getLLVMScalarTypeForStructReturn(const Type *Ty) {
-
+static const Type* getLLVMScalarTypeForStructReturn(tree type) {
+  const Type *Ty = ConvertType(type);
   unsigned Size = getTargetData().getABITypeSize(Ty);
   if (Size == 0)
     return Type::VoidTy;
@@ -207,7 +207,7 @@
 // getLLVMAggregateTypeForStructReturn - Return LLVM type if TY can be
 // returns as multiple values, otherwise return NULL. This is the default
 // target indepdendent implementation.
-static const Type* getLLVMAggregateTypeForStructReturn(const Type *Ty) {
+static const Type* getLLVMAggregateTypeForStructReturn(tree type) {
   return NULL;
 }
 
@@ -366,9 +366,9 @@
       } else {
         // Otherwise return as an integer value large enough to hold the entire
         // aggregate.
-        if (const Type* ScalarTy = LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(Ty))
+        if (const Type* ScalarTy = LLVM_SCALAR_TYPE_FOR_STRUCT_RETURN(type))
           C.HandleAggregateResultAsScalar(ScalarTy);
-        else if (const Type *AggrTy = LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(Ty))
+        else if (const Type *AggrTy = LLVM_AGGR_TYPE_FOR_STRUCT_RETURN(type))
           C.HandleAggregateResultAsAggregate(AggrTy);
         else {
           assert(0 && "Unable to determine how to return this aggregate!");





More information about the llvm-commits mailing list