-
Notifications
You must be signed in to change notification settings - Fork 322
/
TEST.dbgopt.Makefile
109 lines (98 loc) · 4.75 KB
/
TEST.dbgopt.Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
##===- TEST.dbgopt.Makefile --------------------------------*- Makefile -*-===##
#
# This test checks whether presense of debugging information influences
# the optimizer or not.
#
# $ clang -fno-verbose-asm -g -mllvm --disable-debug-info-print -Os \
# -S foo.c -o foo.first.s
# $ clang -fno-verbose-asm -Os -S foo.c -o foo.second.s
# $ diff foo.first.s foo.second.s
#
##===----------------------------------------------------------------------===##
TESTNAME = $*
.PRECIOUS: Output/%.first.s Output/%.second.s
$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
test.$(TEST).%: Output/%.diff
Output/%.s: %.c Output/.dir $(INCLUDES)
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \
-fno-verbose-asm -mllvm --disable-debug-info-print \
-S ${PROJ_SRC_DIR}/$*.c -o Output/$*.first.s
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os \
-fno-verbose-asm -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.second.s
echo "---------------------------------------------------------------" \
> Output/$*.dbgopt.report.txt; \
echo ">>> ========= '$*' Program" >> Output/$*.dbgopt.report.txt; \
echo "---------------------------------------------------------------\n"\
>> Output/$*.dbgopt.report.txt;
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "TEST: PASS" >> Output/$*.dbgopt.report.txt; \
else \
echo "TEST: FAIL" >> Output/$*.dbgopt.report.txt; \
fi
Output/%.s: %.cpp Output/.dir $(INCLUDES)
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \
-fno-verbose-asm -mllvm --disable-debug-info-print \
-S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.first.s
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \
-fno-verbose-asm ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.second.s
echo "---------------------------------------------------------------" \
> Output/$*.dbgopt.report.txt; \
echo ">>> ========= '$*' Program" >> Output/$*.dbgopt.report.txt; \
echo "---------------------------------------------------------------\n"\
>> Output/$*.dbgopt.report.txt;
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "TEST: PASS" >> Output/$*.dbgopt.report.txt; \
else \
echo "TEST: FAIL" >> Output/$*.dbgopt.report.txt; \
fi
Output/%.s: %.cc Output/.dir $(INCLUDES)
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \
-fno-verbose-asm -mllvm -disable-debug-info-print \
-S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.first.s
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \
-fno-verbose-asm ${PROJ_SRC_DIR}/$*.cc -o Output/$*.second.s
echo "---------------------------------------------------------------" \
> Output/$*.dbgopt.report.txt; \
echo ">>> ========= '$*' Program" >> Output/$*.dbgopt.report.txt; \
echo "---------------------------------------------------------------\n"\
>> Output/$*.dbgopt.report.txt;
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "TEST: PASS" >> Output/$*.dbgopt.report.txt; \
else \
echo "TEST: FAIL" >> Output/$*.dbgopt.report.txt; \
fi
Output/%.s: %.m Output/.dir $(INCLUDES)
-$(LLVMCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \
-fno-verbose-asm -mllvm --disable-debug-info-print \
-S ${PROJ_SRC_DIR}/$*.m -o Output/$*.first.s
-$(LLVMCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \
-fno-verbose-asm ${PROJ_SRC_DIR}/$*.m -o Output/$*.second.s
echo "---------------------------------------------------------------" \
> Output/$*.dbgopt.report.txt; \
echo ">>> ========= '$*' Program" >> Output/$*.dbgopt.report.txt; \
echo "---------------------------------------------------------------\n"\
>> Output/$*.dbgopt.report.txt;
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "TEST: PASS" >> Output/$*.dbgopt.report.txt; \
else \
echo "TEST: FAIL" >> Output/$*.dbgopt.report.txt; \
fi
Output/%.s: %.mm Output/.dir $(INCLUDES)
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os \
-fno-verbose-asm -mllvm --disable-debug-info-print \
-S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.first.s
-$(LLVMCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S \
-fno-verbose-asm ${PROJ_SRC_DIR}/$*.mm -o Output/$*.second.s
echo "---------------------------------------------------------------" \
> Output/$*.dbgopt.report.txt; \
echo ">>> ========= '$*' Program" >> Output/$*.dbgopt.report.txt; \
echo "---------------------------------------------------------------\n"\
>> Output/$*.dbgopt.report.txt;
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "TEST: PASS" >> Output/$*.dbgopt.report.txt; \
else \
echo "TEST: FAIL" >> Output/$*.dbgopt.report.txt; \
fi
Asms := $(sort $(addsuffix .s, $(notdir $(basename $(Source)))))
AllAsms := $(addprefix Output/,$(Asms))
Output/%.diff: $(AllAsms)