[llvm-commits] CVS: llvm/lib/Reoptimizer/Inst/lib/Phase1/Makefile Phase1.cpp
Joel Stanley
jstanley at cs.uiuc.edu
Sat May 10 13:35:05 PDT 2003
Changes in directory llvm/lib/Reoptimizer/Inst/lib/Phase1:
Makefile updated: 1.1 -> 1.2
Phase1.cpp updated: 1.23 -> 1.24
---
Log message:
Moved Phase1 pass code into this CVS repository, fixed makefiles.
---
Diffs of the changes:
Index: llvm/lib/Reoptimizer/Inst/lib/Phase1/Makefile
diff -u llvm/lib/Reoptimizer/Inst/lib/Phase1/Makefile:1.1 llvm/lib/Reoptimizer/Inst/lib/Phase1/Makefile:1.2
--- llvm/lib/Reoptimizer/Inst/lib/Phase1/Makefile:1.1 Wed Jan 22 12:00:09 2003
+++ llvm/lib/Reoptimizer/Inst/lib/Phase1/Makefile Sat May 10 13:44:33 2003
@@ -1,6 +1,4 @@
-# Makefile for pcl pass
-
-LEVEL = $(LOCAL_CVSROOT)/llvm
+LEVEL = ../../../../..
LIBRARYNAME = perf
SHARED_LIBRARY = 1
Index: llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp
diff -u llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp:1.23 llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp:1.24
--- llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp:1.23 Fri May 9 23:02:35 2003
+++ llvm/lib/Reoptimizer/Inst/lib/Phase1/Phase1.cpp Sat May 10 13:44:33 2003
@@ -28,7 +28,6 @@
#include "llvm/Target/TargetData.h"
#include "PrimInfo.h"
-#include "Utils.h"
using std::cerr;
using std::endl;
@@ -37,6 +36,15 @@
namespace pp
{
+static void PurgeInst(Instruction* inst)
+{
+ // Completely remove inst (and all its uses, recursively)
+ assert(inst && "PurgeInst expects non-null argument");
+ while(!inst->use_empty())
+ PurgeInst(dyn_cast<Instruction>(inst->use_back()));
+ inst->getParent()->getInstList().erase(inst);
+}
+
class Phase1 : public Pass
{
public:
@@ -389,7 +397,7 @@
startCall->getCalledFunction(),
endCall->getCalledFunction()));
- // Recursively remove the calls and their uses
+ // Remove the calls and their uses
PurgeInst(startCall);
PurgeInst(endCall);
}
@@ -428,7 +436,7 @@
m_primInfos.push_back(PrimInfo(type, php.first, metricVar, m_module,
pointCall->getCalledFunction()));
- // Recursively remove the call
+ // Remove the call
PurgeInst(pointCall);
}
More information about the llvm-commits
mailing list