aboutsummaryrefslogtreecommitdiff
path: root/tools/find_bigfuncs.py
blob: 6fdec3a98f6925f684deda05c731917ce59f1785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'''
Simple tool to find big functions in an .ll file.
'''

import os, sys, re

filename = sys.argv[1]
i = 0
start = -1
curr = None
data = []
for line in open(filename):
  i += 1
  if line.startswith('function '):
    start = i
    curr = line
  elif line.startswith('}') and curr:
    size = i - start
    data.append([curr, size])
    curr = None
data.sort(lambda x, y: x[1] - y[1])
print ''.join(['%6d : %s' % (x[1], x[0]) for x in data])