[llvm-commits] [gcc-plugin] r82691 - in /gcc-plugin/trunk: llvm-backend.cpp llvm-convert.cpp llvm-internal.h

Duncan Sands baldrick at free.fr
Thu Sep 24 09:16:27 PDT 2009


Author: baldrick
Date: Thu Sep 24 11:16:26 2009
New Revision: 82691

URL: http://llvm.org/viewvc/llvm-project?rev=82691&view=rev
Log:
It seems safer to have the SSANames map take trees to AssertingVH's
rather than Value*'s.  It's still not completely clear to me whether
a value defining an SSAName can be deleted out from under us, so best
to check. 

Modified:
    gcc-plugin/trunk/llvm-backend.cpp
    gcc-plugin/trunk/llvm-convert.cpp
    gcc-plugin/trunk/llvm-internal.h

Modified: gcc-plugin/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=82691&r1=82690&r2=82691&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Thu Sep 24 11:16:26 2009
@@ -1788,8 +1788,11 @@
   calculate_dominance_info(CDI_DOMINATORS);
 
   // Convert the AST to raw/ugly LLVM code.
-  TreeToLLVM Emitter(current_function_decl);
-  Function *Fn = Emitter.EmitFunction();
+  Function *Fn;
+  {
+    TreeToLLVM Emitter(current_function_decl);
+    Fn = Emitter.EmitFunction();
+  }
 
   // Free dominator and other ssa data structures.
   execute_free_datastructures();

Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=82691&r1=82690&r2=82691&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Thu Sep 24 11:16:26 2009
@@ -38,6 +38,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Target/TargetLowering.h"
@@ -2106,7 +2107,7 @@
 
 /// EmitSSA_NAME - Return the defining value of the given SSA_NAME.
 Value *TreeToLLVM::EmitSSA_NAME(tree exp) {
-  DenseMap<tree, Value*>::iterator I = SSANames.find(exp);
+  DenseMap<tree, AssertingVH<> >::iterator I = SSANames.find(exp);
   if (I != SSANames.end())
     return I->second;
 

Modified: gcc-plugin/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=82691&r1=82690&r2=82691&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-internal.h (original)
+++ gcc-plugin/trunk/llvm-internal.h Thu Sep 24 11:16:26 2009
@@ -63,6 +63,7 @@
   class TargetMachine;
   class TargetData;
   class DebugInfo;
+  template<typename> class AssertingVH;
 }
 using namespace llvm;
 
@@ -350,7 +351,7 @@
   SmallVector<PhiRecord, 16> PendingPhis;
 
   // SSANames - Map from GCC ssa names to the defining LLVM value.
-  DenseMap<tree, Value*> SSANames;
+  DenseMap<tree, AssertingVH<> > SSANames;
 
   //===---------------------- Exception Handling --------------------------===//
 





More information about the llvm-commits mailing list