[llvm-commits] [llvm] r93504 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h include/llvm/IntrinsicInst.h include/llvm/Intrinsics.td lib/Analysis/DebugInfo.cpp lib/CodeGen/SelectionDAG/FastISel.cpp lib/VMCore/Verifier.cpp test/Assembler/funct

Devang Patel devang.patel at gmail.com
Fri Jan 15 09:51:57 PST 2010


Hi Victor,

On Thu, Jan 14, 2010 at 7:37 PM, Victor Hernandez <vhernandez at apple.com> wrote:
> Author: hernande
> Date: Thu Jan 14 21:37:48 2010
> New Revision: 93504
>
> URL: http://llvm.org/viewvc/llvm-project?rev=93504&view=rev
> Log:
> Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
> This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.
>
>
> Modified:
>    llvm/trunk/include/llvm/Analysis/DebugInfo.h
>    llvm/trunk/include/llvm/IntrinsicInst.h
>    llvm/trunk/include/llvm/Intrinsics.td
>    llvm/trunk/lib/Analysis/DebugInfo.cpp
>    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
>    llvm/trunk/lib/VMCore/Verifier.cpp
>    llvm/trunk/test/Assembler/functionlocal-metadata.ll
>    llvm/trunk/test/DebugInfo/2009-10-16-Scope.ll
>    llvm/trunk/test/DebugInfo/printdbginfo2.ll
>
> Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=93504&r1=93503&r2=93504&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
> +++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Thu Jan 14 21:37:48 2010
> @@ -491,7 +491,6 @@
>     Module &M;
>     LLVMContext& VMContext;
>
> -    const Type *EmptyStructPtr; // "{}*".
>     Function *DeclareFn;     // llvm.dbg.declare
>     Function *ValueFn;       // llvm.dbg.value
>
> @@ -659,7 +658,7 @@
>
>   /// Finds the dbg.declare intrinsic corresponding to this value if any.
>   /// It looks through pointer casts too.
> -  const DbgDeclareInst *findDbgDeclare(const Value *V, bool stripCasts = true);
> +  const DbgDeclareInst *findDbgDeclare(const Value *V);
>
>   /// Find the debug info descriptor corresponding to this global variable.
>   Value *findDbgGlobalDeclare(GlobalVariable *V);
>
> Modified: llvm/trunk/include/llvm/IntrinsicInst.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicInst.h?rev=93504&r1=93503&r2=93504&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/IntrinsicInst.h (original)
> +++ llvm/trunk/include/llvm/IntrinsicInst.h Thu Jan 14 21:37:48 2010
> @@ -25,6 +25,7 @@
>  #define LLVM_INTRINSICINST_H
>
>  #include "llvm/Constants.h"
> +#include "llvm/Metadata.h"
>  #include "llvm/Function.h"
>  #include "llvm/Instructions.h"
>  #include "llvm/Intrinsics.h"
> @@ -82,7 +83,12 @@
>   ///
>   class DbgDeclareInst : public DbgInfoIntrinsic {
>   public:
> -    Value *getAddress()  const { return getOperand(1); }
> +    Value *getAddress() const {
> +      if (MDNode* MD = dyn_cast<MDNode>(getOperand(1)))
> +       return MD->getOperand(0);
> +      else
> +       return NULL;
> +    }

If getOperand(1) is either MDNode or NULL. Pl. add an assert to check
if it is anything else.

If you move this def. in .cpp then you can avoid including Metadata.h here.
-
Devang




More information about the llvm-commits mailing list