[cfe-commits] r64481 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CodeGenModule.cpp CodeGenModule.h

Mike Stump mrs at apple.com
Fri Feb 13 11:36:04 PST 2009


Author: mrs
Date: Fri Feb 13 13:36:03 2009
New Revision: 64481

URL: http://llvm.org/viewvc/llvm-project?rev=64481&view=rev
Log:
Move DescriptorUniqueCount into CGM.

Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=64481&r1=64480&r2=64481&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Fri Feb 13 13:36:03 2009
@@ -65,10 +65,8 @@
 
   C = llvm::ConstantStruct::get(Elts);
 
-  // FIXME: Should be in module?
-  static int desc_unique_count;
   char Name[32];
-  sprintf(Name, "__block_descriptor_tmp_%d", ++desc_unique_count);
+  sprintf(Name, "__block_descriptor_tmp_%d", CGM.getDescriptorUniqueCount());
   C = new llvm::GlobalVariable(C->getType(), true,
                                llvm::GlobalValue::InternalLinkage,
                                C, Name, &CGM.getModule());

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=64481&r1=64480&r2=64481&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Feb 13 13:36:03 2009
@@ -52,6 +52,7 @@
   DebugInfo = GenerateDebugInfo ? new CGDebugInfo(this) : 0;
 
   Block.GlobalUniqueCount = 0;
+  Block.DescriptorUniqueCount = 0;
 }
 
 CodeGenModule::~CodeGenModule() {

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=64481&r1=64480&r2=64481&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Fri Feb 13 13:36:03 2009
@@ -128,9 +128,10 @@
   llvm::Constant *NSConcreteStackBlock;
   
   const llvm::Type *BlockDescriptorType;
-  const llvm::Type * GenericBlockLiteralType;
+  const llvm::Type *GenericBlockLiteralType;
   struct {
     int GlobalUniqueCount;
+    int DescriptorUniqueCount;
   } Block;
 
   std::vector<llvm::Function *> BuiltinFunctions;
@@ -147,6 +148,7 @@
   llvm::Constant *getNSConcreteGlobalBlock();
   llvm::Constant *getNSConcreteStackBlock();
   int getGlobalUniqueCount() { return ++Block.GlobalUniqueCount; }
+  int getDescriptorUniqueCount() { return ++Block.DescriptorUniqueCount; }
   const llvm::Type *getBlockDescriptorType();
 
   const llvm::Type *getGenericBlockLiteralType();





More information about the cfe-commits mailing list