diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-07-29 23:18:29 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-07-29 23:18:29 +0000 |
commit | bd012ff1fa088181646a784f385b28867372d434 (patch) | |
tree | 1ebb8c8ea9f37c4b01ecc872d7030c0d0504e106 /lib/CodeGen/CodeGenFunction.cpp | |
parent | 4f95b750534f2111f28434b282bcbd5656002816 (diff) |
Rework codegen emission of globals
- No (intended) functionality change.
- Primary purpose is to clearly separate (lazy) construction of
globals that are a forward declaration or tentative definition from
those that are the final definition.
- Lazy construction is now encapsulated in
GetAddrOf{Function,GlobalVar} while final definitions are
constructed in EmitGlobal{Function,Var}Definition.
- External interface for dealing with globals is now limited to
EmitGlobal and GetAddrOf{Function,GlobalVar}.
- Also updated helper functions dealing with statics, annotations,
and ctors to be private.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 679a0f7404..e153ad9fd8 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -102,10 +102,11 @@ void CodeGenFunction::GenerateFunction(const Stmt *Body) { assert(!verifyFunction(*CurFn) && "Generated function is not well formed."); } -void CodeGenFunction::GenerateCode(const FunctionDecl *FD) { +void CodeGenFunction::GenerateCode(const FunctionDecl *FD, + llvm::Function *Fn) { CurFuncDecl = FD; FnRetTy = FD->getResultType(); - CurFn = cast<llvm::Function>(CGM.GetAddrOfFunctionDecl(FD, true)); + CurFn = Fn; assert(CurFn->isDeclaration() && "Function already has body?"); llvm::BasicBlock *EntryBB = llvm::BasicBlock::Create("entry", CurFn); |