aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPatrick Meredith <pmeredit@cs.uiuc.edu>2005-10-13 16:26:50 +0000
committerPatrick Meredith <pmeredit@cs.uiuc.edu>2005-10-13 16:26:50 +0000
commitb89dd23b43489964e257f3c60bdfe52400fd6130 (patch)
tree45691388d0f9f18119f285af1bde6bc582486d76 /utils
parentdcdadef96d69fdc0eba1005fdb86e1273697f3f0 (diff)
This script is used to remove nodes with the label %tmp(.#)* and all
edges associated with said node from the dot files produced by DSA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-xutils/DSAclean.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/DSAclean.py b/utils/DSAclean.py
new file mode 100755
index 0000000000..b4605274ee
--- /dev/null
+++ b/utils/DSAclean.py
@@ -0,0 +1,30 @@
+#! /usr/bin/python
+
+#changelog:
+#10/13/2005: exntended to remove variables of the form %tmp(.#)* rather than just
+#%tmp.#, i.e. it now will remove %tmp.12.3.15 etc, additionally fixed a spelling error in
+#the comments
+#10/12/2005: now it only removes nodes and edges for which the label is %tmp.# rather
+#than removing all lines for which the lable CONTAINS %tmp.#
+import re
+import sys
+if( len(sys.argv) < 3 ):
+ print 'usage is: ./DSAclean <dot_file_to_be_cleaned> <out_put_file>'
+ sys.exit(1)
+#get a file object
+input = open(sys.argv[1], 'r')
+output = open(sys.argv[2], 'w')
+#we'll get this one line at a time...while we could just put the whole thing in a string
+#it would kill old computers
+buffer = input.readline()
+while buffer != '':
+ if re.compile("label(\s*)=(\s*)\"\s%tmp(.\d*)*(\s*)\"").search(buffer):
+ #skip next line, write neither this line nor the next
+ buffer = input.readline()
+ else:
+ #this isn't a tmp Node, we can write it
+ output.write(buffer)
+ #prepare for the next iteration
+ buffer = input.readline()
+input.close()
+output.close()