Skip to content

Commit

Permalink
Allow setting of TARGET_FLAGS on the make command line, as is done fo…
Browse files Browse the repository at this point in the history
…r the

nightly test target. Allows using other test targets for ARM more
effectively.

llvm-svn: 105334
  • Loading branch information
Jim Grosbach committed Jun 2, 2010
1 parent ef3b4f0 commit 13efcf1
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ LLVMGCCARCH := $(TARGET_LLVMGCCARCH)
endif

ifeq ($(ARCH),THUMB)
TARGET_FLAGS += -mthumb
TEST_TARGET_FLAGS += -mthumb
endif

#
Expand Down
14 changes: 7 additions & 7 deletions Makefile.programs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ Output/%.cbe.c: Output/%.llvm.bc $(LLC)

$(PROGRAMS_TO_TEST:%=Output/%.cbe): \
Output/%.cbe: Output/%.cbe.c
-$(RUNTOOLSAFELY) $(CC) $< -o $@ $(LDFLAGS) $(CFLAGS) $(OPTFLAGS) -fno-strict-aliasing -fno-inline $(TARGET_FLAGS) $(LIBS)
-$(RUNTOOLSAFELY) $(CC) $< -o $@ $(LDFLAGS) $(CFLAGS) $(OPTFLAGS) -fno-strict-aliasing -fno-inline $(X_TARGET_FLAGS) $(LIBS)

#
# Compile a linked program to machine code with LLC.
Expand Down Expand Up @@ -461,31 +461,31 @@ ifdef TEST_INTEGRATED_ASSEMBLER
# Link an LLVM-linked program using the system linker.
$(PROGRAMS_TO_TEST:%=Output/%.llc): \
Output/%.llc: Output/%.llc.o
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) $(LDFLAGS)
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(X_TARGET_FLAGS) $(LDFLAGS)

$(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
Output/%.llc-beta: Output/%.llc-beta.o
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) $(LDFLAGS)
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(X_TARGET_FLAGS) $(LDFLAGS)

$(PROGRAMS_TO_TEST:%=Output/%.opt-beta): \
Output/%.opt-beta: Output/%.opt-beta.o
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) $(LDFLAGS)
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(X_TARGET_FLAGS) $(LDFLAGS)

else

# Assemble/Link an LLVM-linked program using the system assembler and linker.
#
$(PROGRAMS_TO_TEST:%=Output/%.llc): \
Output/%.llc: Output/%.llc.s
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) $(LDFLAGS)
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(X_TARGET_FLAGS) $(LDFLAGS)

$(PROGRAMS_TO_TEST:%=Output/%.llc-beta): \
Output/%.llc-beta: Output/%.llc-beta.s
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) $(LDFLAGS)
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(X_TARGET_FLAGS) $(LDFLAGS)

$(PROGRAMS_TO_TEST:%=Output/%.opt-beta): \
Output/%.opt-beta: Output/%.opt-beta.s
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(TARGET_FLAGS) $(LDFLAGS)
-$(PROGRAMLD) $< -o $@ $(LLCLIBS) $(LLCASSEMBLERFLAGS) $(X_TARGET_FLAGS) $(LDFLAGS)

endif

Expand Down
10 changes: 5 additions & 5 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,11 @@ endif
# Explicitly specify -m32 / -m64 so there is no mismatch between llvm-gcc
# default and system compiler default.
ifeq ($(ARCH),x86)
TARGET_FLAGS += -m32
TEST_TARGET_FLAGS += -m32
endif

ifeq ($(ARCH),x86_64)
TARGET_FLAGS += -m64
TEST_TARGET_FLAGS += -m64
endif

ifeq ($(ARCH),Alpha)
Expand All @@ -381,14 +381,14 @@ TARGET_LLIFLAGS += -relocation-model=pic -disable-fp-elim
TARGET_LLIFLAGS += -code-model=small
endif
else
TARGET_FLAGS += -fomit-frame-pointer
TEST_TARGET_FLAGS += -fomit-frame-pointer
ifeq ($(TARGET_OS),Darwin)
TARGET_FLAGS += -mdynamic-no-pic
TEST_TARGET_FLAGS += -mdynamic-no-pic
endif
endif

ifdef EXTRA_OPTIONS
TARGET_FLAGS += $(EXTRA_OPTIONS)
TEST_TARGET_FLAGS += $(EXTRA_OPTIONS)
endif

ifdef SMALL_PROBLEM_SIZE
Expand Down
17 changes: 11 additions & 6 deletions Makefile.tests
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ DISABLE_AUTO_DEPENDENCIES=1

include ${LEVEL}/Makefile.common

# TARGET_FLAGS can come in from the command line, and tests may add to them,
# so use an internal target name to combine them. Just using += to add to
# TARGET_FLAGS in the TEST.* makefiles doesn't work out.
X_TARGET_FLAGS = $(TARGET_FLAGS) $(TEST_TARGET_FLAGS)

STATS = -stats -time-passes

.PHONY: clean default
Expand All @@ -39,27 +44,27 @@ clean::

# Compile from X.c to Output/X.bc
Output/%.bc: %.c $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
-$(LCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
-$(LCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -c $< -o $@ -emit-llvm

# Compile from X.cpp to Output/X.bc
Output/%.bc: %.cpp $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -c $< -o $@ -emit-llvm

# Compile from X.cc to Output/X.bc
Output/%.bc: %.cc $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -c $< -o $@ -emit-llvm

# Compile from X.C to Output/X.bc
Output/%.bc: %.C $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -c $< -o $@ -emit-llvm

# Compile from X.m to Output/X.bc
Output/%.bc: %.m $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
-$(LCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
-$(LCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -c $< -o $@ -emit-llvm

# Compile from X.mm to Output/X.bc
Output/%.bc: %.mm $(LCC_PROGRAMS) Output/.dir $(INCLUDES)
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
-$(LCXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -c $< -o $@ -emit-llvm

# LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
# LLVM source, use the non-transforming assembler.
Expand Down
20 changes: 10 additions & 10 deletions TEST.dbgopt.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,44 @@ $(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
test.$(TEST).%: Output/%.diff

Output/%.s: %.c Output/.dir $(INCLUDES)
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.second.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.c -o Output/$*.second.s
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "--------- TEST-PASS: $*"; \
else \
echo "--------- TEST-FAIL: $*"; \
fi

Output/%.s: %.cpp Output/.dir $(INCLUDES)
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.second.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.cpp -o Output/$*.second.s
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "--------- TEST-PASS: $*"; \
else \
echo "--------- TEST-FAIL: $*"; \
fi

Output/%.s: %.cc Output/.dir $(INCLUDES)
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.second.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.cc -o Output/$*.second.s
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "--------- TEST-PASS: $*"; \
else \
echo "--------- TEST-FAIL: $*"; \
fi

Output/%.s: %.m Output/.dir $(INCLUDES)
-$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.first.s
-$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.second.s
-$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.first.s
-$(LLVMGCC) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.m -o Output/$*.second.s
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "--------- TEST-PASS: $*"; \
else \
echo "--------- TEST-FAIL: $*"; \
fi

Output/%.s: %.mm Output/.dir $(INCLUDES)
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.second.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -g -Os -fdebug-disable-debug-info-print -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.first.s
-$(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(X_TARGET_FLAGS) -Os -S ${PROJ_SRC_DIR}/$*.mm -o Output/$*.second.s
@-if diff Output/$*.first.s Output/$*.second.s > $@; then \
echo "--------- TEST-PASS: $*"; \
else \
Expand Down
2 changes: 1 addition & 1 deletion TEST.ipodbgopt.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
##===----------------------------------------------------------------------===##

TESTNAME = $*
TARGET_FLAGS = -g -O0
TEST_TARGET_FLAGS = -g -O0
.PRECIOUS: Output/%.first.ll Output/%.second.ll

$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
Expand Down
4 changes: 2 additions & 2 deletions TEST.llcdbg.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
##===----------------------------------------------------------------------===##

TESTNAME = $*
TARGET_FLAGS = -g -O0
LLC_DEBUG_FLAGS = -O0 -regalloc=local
TEST_TARGET_FLAGS = -g -O0
LLC_DEBUG_FLAGS = -O0 -regalloc=local $(LLCFLAGS)
.PRECIOUS: Output/%.first.s Output/%.second.s Output/%.t2b.s Output/%.t1b.s

$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
Expand Down
4 changes: 2 additions & 2 deletions TEST.m2regllcdbg.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
##===----------------------------------------------------------------------===##

TESTNAME = $*
TARGET_FLAGS = -g -O0
LLC_DEBUG_FLAGS = -O0 -regalloc=local
TEST_TARGET_FLAGS = -g -O0
LLC_DEBUG_FLAGS = -O0 -regalloc=local $(LLCFLAGS)
.PRECIOUS: Output/%.first.s Output/%.second.s Output/%.t2c.s Output/%.t1c.s Output/%.t2b.bc Output/%.t1b.bc

$(PROGRAMS_TO_TEST:%=test.$(TEST).%): \
Expand Down
4 changes: 2 additions & 2 deletions TEST.optllcdbg.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
##===----------------------------------------------------------------------===##

TESTNAME = $*
TARGET_FLAGS = -g -O0
LLC_DEBUG_FLAGS = -O3
TEST_TARGET_FLAGS = -g -O0
LLC_DEBUG_FLAGS = -O3 $(LLCFLAGS)
OPT_FLAGS = -std-compile-opts
.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

Expand Down

0 comments on commit 13efcf1

Please sign in to comment.