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))
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
31 $(PROGRAMS_TO_TEST:%=Output/%.optllcdbg.report.txt): \
32 Output/%.optllcdbg.report.txt: Output/%.report.diff
34 @echo "---------------------------------------------------------------" >> $@
35 @echo ">>> ========= '$(RELDIR)/$*' Program" >> $@
36 @echo "---------------------------------------------------------------" >> $@
38 @-if test -s Output/$^ ; then \
39 echo "TEST-FAIL" >> $@;\
41 echo "TEST-PASS" >> $@;\
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' < $< \
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]' \
69 | grep -v '__debug_str' \
72 | grep -v 'debug_loc' \
73 | grep -v 'Lpubtypes' \
74 | grep -v 'Lpubnames' \
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' < $< \
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]' \
106 | grep -v '__debug_str' \
107 | grep -v 'Lstring' \
109 | grep -v 'debug_loc' \
110 | grep -v 'Lpubtypes' \
111 | grep -v 'Lpubnames' \
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: $*"; \
122 echo "--------- TEST-FAIL: $*"; \
125 Output/%.report.diff: Output/%.first.s Output/%.second.s