[cfe-commits] r64481 - in /cfe/trunk/lib/CodeGen: CGBlocks.cpp CodeGenModule.cpp CodeGenModule.h
Daniel Dunbar
daniel at zuster.org
Fri Feb 13 11:42:17 PST 2009
Mike,
There is no need for this code; LLVM will already unique these symbols
for you. Just pass the prefix when creating the global value and the
rest will be done automatically.
- Daniel
On Fri, Feb 13, 2009 at 11:36 AM, Mike Stump <mrs at apple.com> wrote:
> 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();
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
More information about the cfe-commits
mailing list