[cfe-commits] r109726 - in /cfe/trunk/lib/CodeGen: ABIInfo.h CGCall.cpp TargetInfo.cpp

Chris Lattner sabre at nondot.org
Wed Jul 28 19:31:05 PDT 2010


Author: lattner
Date: Wed Jul 28 21:31:05 2010
New Revision: 109726

URL: http://llvm.org/viewvc/llvm-project?rev=109726&view=rev
Log:
dissolve some more complexity: make the x86-64 abi lowering code
compute its own preferred types instead of having CGT compute
them then pass them (circuituously) down into ABIInfo.

Modified:
    cfe/trunk/lib/CodeGen/ABIInfo.h
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/ABIInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ABIInfo.h?rev=109726&r1=109725&r2=109726&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ABIInfo.h (original)
+++ cfe/trunk/lib/CodeGen/ABIInfo.h Wed Jul 28 21:31:05 2010
@@ -139,11 +139,7 @@
     llvm::LLVMContext &getVMContext() const;
     const llvm::TargetData &getTargetData() const;
 
-    virtual void computeInfo(CodeGen::CGFunctionInfo &FI,
-                             // This is the preferred type for argument lowering
-                             // which can be used to generate better IR.
-                             const llvm::Type *const *PrefTypes = 0,
-                             unsigned NumPrefTypes = 0) const = 0;
+    virtual void computeInfo(CodeGen::CGFunctionInfo &FI) const = 0;
 
     /// EmitVAArg - Emit the target dependent code to load a value of
     /// \arg Ty from the va_list pointed to by \arg VAListAddr.

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=109726&r1=109725&r2=109726&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Jul 28 21:31:05 2010
@@ -243,34 +243,14 @@
                           ArgTys.data(), ArgTys.size());
   FunctionInfos.InsertNode(FI, InsertPos);
 
-  // ABI lowering wants to know what our preferred type for the argument is in
-  // various situations, pass it in.
-  llvm::SmallVector<const llvm::Type *, 8> PreferredArgTypes;
-  for (llvm::SmallVectorImpl<CanQualType>::const_iterator
-       I = ArgTys.begin(), E = ArgTys.end(); I != E; ++I) {
-    // If this is being called from the guts of the ConvertType loop, make sure
-    // to call ConvertTypeRecursive so we don't get into issues with cyclic
-    // pointer type structures.
-    PreferredArgTypes.push_back(ConvertTypeRecursive(*I));
-  }
-  
   // Compute ABI information.
-  getABIInfo().computeInfo(*FI, PreferredArgTypes.data(),
-                           PreferredArgTypes.size());
+  getABIInfo().computeInfo(*FI);
 
   // If this is a top-level call and ConvertTypeRecursive hit unresolved pointer
   // types, resolve them now.  These pointers may point to this function, which
   // we *just* filled in the FunctionInfo for.
-  if (!IsRecursive && !PointersToResolve.empty()) {
-    // Use PATypeHolder's so that our preferred types don't dangle under
-    // refinement.
-    llvm::SmallVector<llvm::PATypeHolder, 8> Handles(PreferredArgTypes.begin(),
-                                                     PreferredArgTypes.end());
+  if (!IsRecursive && !PointersToResolve.empty())
     HandleLateResolvedPointers();
-    PreferredArgTypes.clear();
-    PreferredArgTypes.append(Handles.begin(), Handles.end());
-  }
-  
   
   return *FI;
 }

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=109726&r1=109725&r2=109726&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Jul 28 21:31:05 2010
@@ -291,9 +291,7 @@
   ABIArgInfo classifyReturnType(QualType RetTy) const;
   ABIArgInfo classifyArgumentType(QualType RetTy) const;
 
-  virtual void computeInfo(CGFunctionInfo &FI,
-                           const llvm::Type *const *PrefTypes,
-                           unsigned NumPrefTypes) const {
+  virtual void computeInfo(CGFunctionInfo &FI) const {
     FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
     for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
          it != ie; ++it)
@@ -351,9 +349,7 @@
   ABIArgInfo classifyReturnType(QualType RetTy) const;
   ABIArgInfo classifyArgumentType(QualType RetTy) const;
 
-  virtual void computeInfo(CGFunctionInfo &FI,
-                           const llvm::Type *const *PrefTypes,
-                           unsigned NumPrefTypes) const {
+  virtual void computeInfo(CGFunctionInfo &FI) const {
     FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
     for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
          it != ie; ++it)
@@ -756,9 +752,7 @@
 public:
   X86_64ABIInfo(CodeGen::CodeGenTypes &CGT) : ABIInfo(CGT) {}
 
-  virtual void computeInfo(CGFunctionInfo &FI, 
-                           const llvm::Type *const *PrefTypes,
-                           unsigned NumPrefTypes) const;
+  virtual void computeInfo(CGFunctionInfo &FI) const;
 
   virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
                                  CodeGenFunction &CGF) const;
@@ -1452,9 +1446,7 @@
   return getCoerceResult(Ty, ResType);
 }
 
-void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI, 
-                                const llvm::Type *const *PrefTypes,
-                                unsigned NumPrefTypes) const {
+void X86_64ABIInfo::computeInfo(CGFunctionInfo &FI) const {
   FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
 
   // Keep track of the number of assigned registers.
@@ -1469,13 +1461,9 @@
   // get assigned (in left-to-right order) for passing as follows...
   for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
        it != ie; ++it) {
-    // If the client specified a preferred IR type to use, pass it down to
+    // Determine the preferred IR type to use and pass it down to
     // classifyArgumentType.
-    const llvm::Type *PrefType = 0;
-    if (NumPrefTypes) {
-      PrefType = *PrefTypes++;
-      --NumPrefTypes;
-    }
+    const llvm::Type *PrefType = CGT.ConvertTypeRecursive(it->type);
       
     unsigned neededInt, neededSSE;
     it->info = classifyArgumentType(it->type, neededInt, neededSSE, PrefType);
@@ -1719,9 +1707,7 @@
 
   ABIArgInfo classifyArgumentType(QualType RetTy) const;
 
-  virtual void computeInfo(CGFunctionInfo &FI, 
-                           const llvm::Type *const *PrefTypes,
-                           unsigned NumPrefTypes) const {
+  virtual void computeInfo(CGFunctionInfo &FI) const {
     FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
     for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
          it != ie; ++it)
@@ -1864,9 +1850,7 @@
   ABIArgInfo classifyReturnType(QualType RetTy) const;
   ABIArgInfo classifyArgumentType(QualType RetTy) const;
 
-  virtual void computeInfo(CGFunctionInfo &FI,
-                           const llvm::Type *const *PrefTypes,
-                           unsigned NumPrefTypes) const;
+  virtual void computeInfo(CGFunctionInfo &FI) const;
 
   virtual llvm::Value *EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
                                  CodeGenFunction &CGF) const;
@@ -1884,9 +1868,7 @@
 
 }
 
-void ARMABIInfo::computeInfo(CGFunctionInfo &FI,
-                             const llvm::Type *const *PrefTypes,
-                             unsigned NumPrefTypes) const {
+void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const {
   FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
   for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
        it != ie; ++it)
@@ -2160,9 +2142,7 @@
   ABIArgInfo classifyReturnType(QualType RetTy) const;
   ABIArgInfo classifyArgumentType(QualType RetTy) const;
 
-  virtual void computeInfo(CGFunctionInfo &FI,
-                           const llvm::Type *const *PrefTypes,
-                           unsigned NumPrefTypes) const {
+  virtual void computeInfo(CGFunctionInfo &FI) const {
     FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
     for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
          it != ie; ++it)





More information about the cfe-commits mailing list