From: Anders Carlsson Date: Mon, 9 Feb 2009 20:20:56 +0000 (+0000) Subject: Add DidCallStackSave variable to CodeGenFunction. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4cc1a4703363ff940b6273aeef9d96a87edeb04b;p=clang Add DidCallStackSave variable to CodeGenFunction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64156 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 5e005b4c55..153fcc8ec4 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -144,6 +144,7 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy, llvm::Function *Fn, const FunctionArgList &Args, SourceLocation StartLoc) { + DidCallStackSave = false; CurFuncDecl = D; FnRetTy = RetTy; CurFn = Fn; diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 58d3a73433..03230949e5 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -260,6 +260,10 @@ private: /// which the stack depth changes. llvm::Value *StackDepth; + /// DidCallStackSave - Whether llvm.stacksave has been called. Used to avoid + /// calling llvm.stacksave for multiple VLAs in the same scope. + bool DidCallStackSave; + /// StackSaveValues - A stack(!) of stack save values. When a new scope is /// entered, a null is pushed on this stack. If a VLA is emitted, then the /// return value of llvm.stacksave() is stored at the top of this stack.