Commit 999a22f0 by Jim Stichnoth

Subzero: Allow Makefile.standalone to build for a single target.

This makes it easier to focus on reducing the translator size. Enable with e.g.: make -f Makefile.standalone MINIMAL=1 SZTARGET=X8664 bloat-sb BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4362 R=jpp@chromium.org Review URL: https://codereview.chromium.org/1787143002 .
parent 1670ecea
......@@ -100,6 +100,16 @@ else
BASE_CXX_DEFINES += -DALLOW_DUMP=1
endif
# Restrict to a single supported target. Current options:
# SZTARGET=ARM32
# SZTARGET=MIPS32
# SZTARGET=X8632
# SZTARGET=X8664
ifdef SZTARGET
OBJDIR := $(OBJDIR)+T_$(SZTARGET)
BASE_CXX_DEFINES += -DSZTARGET=$(SZTARGET)
endif
CXX_DEFINES := $(BASE_CXX_DEFINES) -DPNACL_BROWSER_TRANSLATOR=0
ifdef NOASSERT
......
......@@ -3,7 +3,32 @@ Targets:
check-lit - run the lit tests
check-xtest - run the cross tests
For more detailed help:
Additional 'make' command options:
MINIMAL=1
Create a minimal build, as small and fast as possible
DEBUG=1
Compile with -O0 instead of -O2
NODUMP=1
Disable textual dump/emission support and other verbose options
NOASSERT=1
Disable assert() calls, via -DNDEBUG
UBSAN=1
Enable UBSan support, i.e. -fsanitize=undefined
UBSAN_TRAP=1
Enable UBSan support, trapping on errors
TSAN=1
Enable TSan support, i.e. -fsanitize=thread
ASAN=1
Enable ASan support, i.e. -fsanitize=address
MSAN=1
Enable MSan support, i.e. -fsanitize=memory
SZTARGET=<target>
Restrict support to a single processor target,
where <target> is one of {ARM32,MIPS32,X8632,X8664}
Most of these options can be combined, e.g.
make -f Makefile.standalone NOASSERT=1 NODUMP=1
make -f Makefile.standalone help-<target> , e.g:
make -f Makefile.standalone help-check-lit
For more detailed help on a 'make' target:
make -f Makefile.standalone help-<target> , e.g:
make -f Makefile.standalone help-check-lit
......@@ -142,7 +142,7 @@ struct {
void dumpBuildAttributes(Ostream &Str) {
// List the supported targets.
#define SUBZERO_TARGET(TARGET) Str << "target_" #TARGET << "\n";
#include "llvm/Config/SZTargets.def"
#include "SZTargets.def"
const char *Prefix[2] = {"no", "allow"};
for (size_t i = 0; i < llvm::array_lengthof(ConditionalBuildAttributes);
++i) {
......
......@@ -27,6 +27,8 @@
#include "IceOperand.h"
#include "IceRegAlloc.h"
#define TARGET_LOWERING_CLASS_FOR(t) Target_##t
// We prevent target-specific implementation details from leaking outside their
// implementations by forbidding #include of target-specific header files
// anywhere outside their own files. To create target-specific objects
......@@ -52,7 +54,7 @@
createTargetHeaderLowering(::Ice::GlobalContext *Ctx); \
void staticInit(::Ice::GlobalContext *Ctx); \
} // end of namespace X
#include "llvm/Config/SZTargets.def"
#include "SZTargets.def"
#undef SUBZERO_TARGET
namespace Ice {
......@@ -250,9 +252,9 @@ TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
default:
badTargetFatalError(Target);
#define SUBZERO_TARGET(X) \
case Target_##X: \
case TARGET_LOWERING_CLASS_FOR(X): \
return ::X::createTargetLowering(Func);
#include "llvm/Config/SZTargets.def"
#include "SZTargets.def"
#undef SUBZERO_TARGET
}
}
......@@ -264,7 +266,7 @@ void TargetLowering::staticInit(GlobalContext *Ctx) {
default:
badTargetFatalError(Target);
#define SUBZERO_TARGET(X) \
case Target_##X: { \
case TARGET_LOWERING_CLASS_FOR(X): { \
static bool InitGuard##X = false; \
if (InitGuard##X) { \
return; \
......@@ -272,7 +274,7 @@ void TargetLowering::staticInit(GlobalContext *Ctx) {
InitGuard##X = true; \
::X::staticInit(Ctx); \
} break;
#include "llvm/Config/SZTargets.def"
#include "SZTargets.def"
#undef SUBZERO_TARGET
}
}
......@@ -746,9 +748,9 @@ TargetDataLowering::createLowering(GlobalContext *Ctx) {
default:
badTargetFatalError(Target);
#define SUBZERO_TARGET(X) \
case Target_##X: \
case TARGET_LOWERING_CLASS_FOR(X): \
return ::X::createTargetDataLowering(Ctx);
#include "llvm/Config/SZTargets.def"
#include "SZTargets.def"
#undef SUBZERO_TARGET
}
}
......@@ -877,9 +879,9 @@ TargetHeaderLowering::createLowering(GlobalContext *Ctx) {
default:
badTargetFatalError(Target);
#define SUBZERO_TARGET(X) \
case Target_##X: \
case TARGET_LOWERING_CLASS_FOR(X): \
return ::X::createTargetHeaderLowering(Ctx);
#include "llvm/Config/SZTargets.def"
#include "SZTargets.def"
#undef SUBZERO_TARGET
}
}
......
//===- subzero/src/SZTargets.def - Target enumeration x-macro ---*- C++ -*-===//
//
// The Subzero Code Generator
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file provides an alternate implementation of llvm/Config/SZTargets.def,
// such that when SZTARGET is defined, it enumerates the single SZTARGET instead
// of the complete list. This can be used to model a proper minimal build for
// the browser.
//
//===----------------------------------------------------------------------===//
#ifdef SZTARGET
#ifndef SUBZERO_TARGET
#error Please define the macro SUBZERO_TARGET(TargetName)
#endif
SUBZERO_TARGET(SZTARGET)
#undef SUBZERO_TARGET
#else // !SZTARGET
#include "llvm/Config/SZTargets.def"
#endif // !SZTARGET
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment