[cfe-commits] r65470 - in /cfe/trunk/lib/CodeGen: CGDecl.cpp CodeGenFunction.h
Daniel Dunbar
daniel at zuster.org
Wed Feb 25 11:45:19 PST 2009
Author: ddunbar
Date: Wed Feb 25 13:45:19 2009
New Revision: 65470
URL: http://llvm.org/viewvc/llvm-project?rev=65470&view=rev
Log:
Fold GeneraticStaticBlockVarDecl into callers.
- No functionality change.
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=65470&r1=65469&r2=65470&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Wed Feb 25 13:45:19 2009
@@ -98,15 +98,15 @@
&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);
+void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
- if (D.getInit() && !NoInit) {
+ 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 @@
}
}
- 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 @@
// 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 @@
// 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);
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=65470&r1=65469&r2=65470&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Wed Feb 25 13:45:19 2009
@@ -753,14 +753,6 @@
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,
More information about the cfe-commits
mailing list