]> granicus.if.org Git - clang/commitdiff
Fold GeneraticStaticBlockVarDecl into callers.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 25 Feb 2009 19:45:19 +0000 (19:45 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 25 Feb 2009 19:45:19 +0000 (19:45 +0000)
 - No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65470 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp
lib/CodeGen/CodeGenFunction.h

index c0f2054394b701d277e8ed670d205e4429b30b1e..349656f58b8f98034be674c816f5ece6cf98464d 100644 (file)
@@ -98,15 +98,15 @@ CodeGenFunction::CreateStaticBlockVarDecl(const VarDecl &D,
                                   &CGM.getModule(), 0, Ty.getAddressSpace());
 }
 
-llvm::GlobalVariable *
-CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D,
-                                            bool NoInit,
-                                            const char *Separator,
-                                            llvm::GlobalValue
-                                               ::LinkageTypes Linkage) {
-  llvm::GlobalVariable *GV = CreateStaticBlockVarDecl(D, Separator, Linkage);
-
-  if (D.getInit() && !NoInit) {
+void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { 
+
+  llvm::Value *&DMEntry = LocalDeclMap[&D];
+  assert(DMEntry == 0 && "Decl already exists in localdeclmap!");
+  
+  llvm::GlobalVariable *GV = 
+    CreateStaticBlockVarDecl(D, ".", llvm::GlobalValue::InternalLinkage);
+
+  if (D.getInit()) {
     llvm::Constant *Init = CGM.EmitConstantExpr(D.getInit(), this);
 
     // If constant emission failed, then this should be a C++ static
@@ -147,18 +147,6 @@ CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D,
     }
   }
 
-  return GV;
-}
-
-void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) { 
-
-  llvm::Value *&DMEntry = LocalDeclMap[&D];
-  assert(DMEntry == 0 && "Decl already exists in localdeclmap!");
-  
-  llvm::GlobalValue *GV;
-  GV = GenerateStaticBlockVarDecl(D, false, ".",
-                                  llvm::GlobalValue::InternalLinkage);
-
   // FIXME: Merge attribute handling.
   if (const AnnotateAttr *AA = D.getAttr<AnnotateAttr>()) {
     SourceManager &SM = CGM.getContext().getSourceManager();
@@ -206,9 +194,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
       // Targets that don't support recursion emit locals as globals.
       const char *Class =
         D.getStorageClass() == VarDecl::Register ? ".reg." : ".auto.";
-      DeclPtr = GenerateStaticBlockVarDecl(D, true, Class, 
-                                           llvm::GlobalValue
-                                           ::InternalLinkage);
+      DeclPtr = CreateStaticBlockVarDecl(D, Class, 
+                                         llvm::GlobalValue
+                                         ::InternalLinkage);
     }
     
     if (Ty->isVariablyModifiedType())
@@ -306,8 +294,8 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, llvm::Value *Arg) {
     // Targets that don't have stack use global address space for parameters.
     // Specify external linkage for such globals so that llvm optimizer do
     // not assume there values initialized as zero.
-    DeclPtr = GenerateStaticBlockVarDecl(D, true, ".auto.",
-                                         llvm::GlobalValue::ExternalLinkage);
+    DeclPtr = CreateStaticBlockVarDecl(D, ".auto.",
+                                       llvm::GlobalValue::ExternalLinkage);
   } else {
     // A fixed sized single-value variable becomes an alloca in the entry block.
     const llvm::Type *LTy = ConvertType(Ty);
index 02276b98b0602374bd2559c387b8cb6a3d83a0b8..6ee22bba00c365c4363a7dd39702499781fed202 100644 (file)
@@ -753,14 +753,6 @@ public:
                                                   llvm::GlobalValue::LinkageTypes
                                                   Linkage);
 
-  /// GenerateStaticBlockVarDecl - Return the the static declaration of local
-  /// variable.
-  llvm::GlobalVariable * GenerateStaticBlockVarDecl(const VarDecl &D,
-                                                    bool NoInit,
-                                                    const char *Separator,
-                                                    llvm::GlobalValue
-                                                    ::LinkageTypes Linkage);
-
   /// GenerateStaticCXXBlockVarDecl - Create the initializer for a C++
   /// runtime initialized static block var decl.
   void GenerateStaticCXXBlockVarDeclInit(const VarDecl &D,