aboutsummaryrefslogtreecommitdiffstats
path: root/utils/countloc.sh
diff options
context:
space:
mode:
authorDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
committerDan Gohman <djg@cray.com>2007-07-18 16:29:46 +0000
commitf17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc (patch)
treeebb79ea1ee5e3bc1fdf38541a811a8b804f0679a /utils/countloc.sh
downloadexternal_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.gz
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.tar.bz2
external_llvm-f17a25c88b892d30c2b41ba7ecdfbdfb2b4be9cc.zip
It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40004 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/countloc.sh')
-rwxr-xr-xutils/countloc.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/utils/countloc.sh b/utils/countloc.sh
new file mode 100755
index 0000000000..988e80360a
--- /dev/null
+++ b/utils/countloc.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+##===- utils/countloc.sh - Counts Lines Of Code --------------*- Script -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file was developed by Reid Spencer and is distributed under the
+# University of Illinois Open Source License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+#
+# This script finds all the source code files in the source code directories
+# (excluding certain things), runs "wc -l" on them to get the number of lines in
+# each file and then sums up and prints the total with awk.
+#
+# The script takes one optional option, -topdir, which specifies the top llvm
+# source directory. If it is not specified then the llvm-config tool is
+# consulted to find top source dir.
+#
+# Note that the implementation is based on llvmdo. See that script for more
+# details.
+##===----------------------------------------------------------------------===##
+
+if test $# -gt 1 ; then
+ if test "$1" = "-topdir" ; then
+ TOPDIR="$2"
+ shift; shift;
+ else
+ TOPDIR=`llvm-config --src-root`
+ fi
+fi
+
+if test -d "$TOPDIR" ; then
+ cd $TOPDIR
+ ./utils/llvmdo -topdir "$TOPDIR" -dirs "include lib tools test utils examples" -code-only wc -l | awk '\
+ BEGIN { loc=0; } \
+ { loc += $1; } \
+ END { print loc; }'
+else
+ echo "Can't find LLVM top directory"
+fi