Fix file mode.
[llvm-testsuite.git] / TEST.optllcdbg.Makefile
blob2719d4e0b8c73c868c5269c8129ce4fd269f4147
1 ##===- TEST.optllcdbg.Makefile -----------------------------*- Makefile -*-===##
3 # This test checks whether presence of debug declarations influences
4 # the code generator or not.
6 # If input.bc includes llvm.dbg intrinsics and llvm.dbg variables then
7 # the code in first.s and second.s should match. Otherwise debugging information
8 # is influencing the code generator.  The Dwarf info in first.s and second.s is
9 # normally quite different, so the data directives that appear in Dwarf are
10 # stripped out before comparison.
12 # This has only been used on Darwin; the data directives to strip and grep magic
13 # might be different elsewhere.
15 ##===----------------------------------------------------------------------===##
17 CURDIR  := $(shell cd .; pwd)
18 PROGDIR := $(PROJ_SRC_ROOT)
19 RELDIR  := $(subst $(PROGDIR),,$(CURDIR))
21 TESTNAME = $*
22 TEST_TARGET_FLAGS = -g -O0
23 LLC_DEBUG_FLAGS = -O3 $(LLCFLAGS)
24 OPT_FLAGS = -std-compile-opts
25 .PRECIOUS: Output/%.first.s Output/%.second.s Output/%.t2c.s Output/%.t1c.s Output/%.t2b.bc Output/%.t1b.bc Output/%.t1a.bc Output/%.t2a.bc
27 $(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
28 test.$(TEST).%: Output/%.$(TEST).report.txt
29         @-cat $<
31 $(PROGRAMS_TO_TEST:%=Output/%.optllcdbg.report.txt): \
32 Output/%.optllcdbg.report.txt: Output/%.report.diff
33         @echo > $@
34         @echo "---------------------------------------------------------------" >> $@
35         @echo ">>> ========= '$(RELDIR)/$*' Program" >> $@
36         @echo "---------------------------------------------------------------" >> $@
37         @echo >> $@
38         @-if test -s Output/$^ ; then \
39           echo "TEST-FAIL" >> $@;\
40         else \
41           echo "TEST-PASS" >> $@;\
42         fi
44 Output/%.t1a.bc: Output/%.linked.rbc Output/.dir $(LOPT)
45         $(LOPT) -strip-debug-declare -strip-nondebug $< -f -o $@
47 Output/%.t1b.bc: Output/%.t1a.bc Output/.dir $(LOPT)
48         $(LOPT) $(OPT_FLAGS) $< -f -o $@
50 Output/%.t1c.s: Output/%.t1b.bc Output/.dir $(LLC)
51         $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@
53 Output/%.first.s: Output/%.t1c.s Output/.dir $(LLC)
54         grep -v '\.long' < $< \
55           | grep -v '\.byte' \
56           | grep -v '\.short' \
57           | grep -v '\.asci' \
58           | grep -v '\.quad' \
59           | grep -v '\.align' \
60           | grep -v '## DW_AT' \
61           | grep -v '## Abbrev' \
62           | grep -v '## End Of Children' \
63           | grep -v '## Extended Op' \
64           | grep -v 'Ltmp[0-9]' \
65           | grep -v '## DIE' \
66           | grep -v '## $$' \
67           | grep -v '^#.*' \
68           | grep -v '^$$' \
69           | grep -v '__debug_str' \
70           | grep -v 'Lstring' \
71           | grep -v 'Lset' \
72           | grep -v 'debug_loc' \
73           | grep -v 'Lpubtypes' \
74           | grep -v 'Lpubnames' \
75           | grep -v 'Linfo_' \
76           | grep -v 'Lfunc_begin' \
77           | grep -v 'Lfunc_end' \
78           | grep -v 'Ldebug_frame_begin' \
79           | grep -v 'Ldebug_frame_end' > $@
81 Output/%.t2a.bc: Output/%.linked.rbc Output/.dir $(LOPT)
82         $(LOPT) -strip-nondebug $< -f -o $@
84 Output/%.t2b.bc: Output/%.t2a.bc Output/.dir $(LOPT)
85         $(LOPT) $(OPT_FLAGS) $< -f -o $@
87 Output/%.t2c.s: Output/%.t2b.bc Output/.dir $(LLC)
88         $(LLC) $(LLC_DEBUG_FLAGS) $< -o $@
90 Output/%.second.s: Output/%.t2c.s Output/.dir
91         grep -v '\.long' < $< \
92           | grep -v '\.byte' \
93           | grep -v '\.short' \
94           | grep -v '\.asci' \
95           | grep -v '\.quad' \
96           | grep -v '\.align' \
97           | grep -v '## DW_AT' \
98           | grep -v '## Abbrev' \
99           | grep -v '## End Of Children' \
100           | grep -v '## Extended Op' \
101           | grep -v 'Ltmp[0-9]' \
102           | grep -v '## DIE' \
103           | grep -v '## $$' \
104           | grep -v '^#.*' \
105           | grep -v '^$$' \
106           | grep -v '__debug_str' \
107           | grep -v 'Lstring' \
108           | grep -v 'Lset' \
109           | grep -v 'debug_loc' \
110           | grep -v 'Lpubtypes' \
111           | grep -v 'Lpubnames' \
112           | grep -v 'Linfo_' \
113           | grep -v 'Lfunc_begin' \
114           | grep -v 'Lfunc_end' \
115           | grep -v 'Ldebug_frame_begin' \
116           | grep -v 'Ldebug_frame_end' > $@
118 Output/%.diff: Output/%.first.s Output/%.second.s
119         @-if diff $^ > $@; then \
120          echo "--------- TEST-PASS: $*"; \
121         else \
122          echo "--------- TEST-FAIL: $*"; \
123         fi
125 Output/%.report.diff: Output/%.first.s Output/%.second.s
126         @diff $^ > $@