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
|
# test/Programs/Makefile.programs
#
# This makefile contains all of the makefile machinery that is common to
# building stuff in the Programs directory. The main job of this is to take
# executables for the following targets:
#
# 1. The native Sun Sparc compiler
# 2. LLVM Bytecode Compiler + LLI interpreter
# 3. LLVM Bytecode Compiler + LLC Sparc machine code backend
#
# Running them, and then diffing the output. If there are any failures, they
# are flagged.
#
# Input to this makefile should be the PROGRAMS_TO_TEST variable, which contains
# a list of programs that should be run.
#
# FIXME: There should be a way to specify the command line for a program
#
include $(LEVEL)/test/Makefile.tests
.PRECIOUS: Output/%.llvm Output/%.native Output/%.llc
# We will be working in the Output directory...
PREFIXED_PROGRAMS_TO_TEST := $(addprefix Output/,$(PROGRAMS_TO_TEST))
# Output produced by programs run
NATOUTPUT := $(addsuffix .out.nat, $(PREFIXED_PROGRAMS_TO_TEST))
LLIOUTPUT := $(addsuffix .out.lli, $(PREFIXED_PROGRAMS_TO_TEST))
LLCOUTPUT := $(addsuffix .out.llc, $(PREFIXED_PROGRAMS_TO_TEST))
# Diffs of program runs vs the native program
LLIDIFFS := $(addsuffix .diff.lli, $(PREFIXED_PROGRAMS_TO_TEST))
LLCDIFFS := $(addsuffix .diff.llc, $(PREFIXED_PROGRAMS_TO_TEST))
# Build Program outputs:
.PRECIOUS: Output/%.out.lli Output/%.out.llc Output/%.out.nat
all:: $(NATOUTPUT) $(LLIOUTPUT) #$(LLCOUTPUT)
# Build diffs for LLI and LLC output...
#.PRECIOUS: Output/%.diff.lli Output/%.diff.llc
all:: $(LLIDIFFS) $(LLCDIFFS)
# Rules to build the test output...
Output/%.out.nat: Output/%.native
-$< > $@ 2>&1
Output/%.out.lli: Output/%.llvm
-$< > $@ 2>&1
Output/%.out.llc: Output/%.llc
-$< > $@ 2>&1
# DIFFPROG - The program used to diff the output
DIFFPROG = $(LEVEL)/test/Programs/DiffOutput.sh
# Rules to diff test output...
Output/%.diff.lli: Output/%.out.nat Output/%.out.lli
$(DIFFPROG) lli $(subst Output/,,$(@:.diff.lli=))
# Rules to diff test output...
Output/%.diff.llc: Output/%.out.nat Output/%.out.llc
$(DIFFPROG) llc $(subst Output/,,$(@:.diff.llc=))
|