[llvm-commits] [llvm-gcc-4.2] r100049 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-debug.h llvm-internal.h

Duncan Sands baldrick at free.fr
Thu Apr 1 02:17:23 PDT 2010


Hi Stuart,

> @@ -512,6 +512,8 @@
>     if (!flag_pch_file&&
>         debug_info_level>  DINFO_LEVEL_NONE)
>       TheDebugInfo = new DebugInfo(TheModule);
> +  else
> +    TheDebugInfo = 0;

why is this needed?

> @@ -1010,7 +1010,7 @@
>     // Convert the AST to raw/ugly LLVM code.
>     Function *Fn;
>     {
> -    TreeToLLVM Emitter(fndecl);
> +    TreeToLLVM *Emitter = getTreeToLLVM(fndecl);

It seems that you are keeping the TreeToLLVM object for every function
processed.  This seems rather wasteful.  Surely you can store much less
than this.  Also, what if gcc garbage collects the fndecl and reallocates
the memory for another function (I don't know if this is actually possible) -
then getTreeToLLVM will return the wrong result if it is called with the newly
allocated function later.

> @@ -179,6 +178,7 @@
>         TheDebugInfo->setLocationFile("<unknown file>");
>         TheDebugInfo->setLocationLine(0);
>       }
> +    TheDebugInfo->Initialize();

Here it looks like you first use TheDebugInfo, and only afterwards initialize
it.

Ciao,

Duncan.



More information about the llvm-commits mailing list