allow codegen targets (Architectures and Assemblers) to co-exist

The primary motivation behind this is to allow all the different Assemblers
to be built at once, on a single machine. This should dramatically reduce
the time required to make sure that a particular change doesn't break
the build for one of the not-so-common architectures (arm, powerpc)

Simply pass "codegen-targets=all" to make to compile all
src/codegen/<arch>/assembler.cpp.

Note that while these architectures are built, they will not be fully-
functional.  Certain stuff is assumed to be the same across the entire
build (such as TargetBytesPerWord), but this isn't the case anymore.
This commit is contained in:
Joshua Warner
2013-02-12 08:15:30 -07:00
parent 68776e5d73
commit f7b49ddb06
8 changed files with 125 additions and 50 deletions

37
src/codegen/targets.cpp Normal file
View File

@ -0,0 +1,37 @@
/* Copyright (c) 2008-2012, Avian Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice appear
in all copies.
There is NO WARRANTY for this software. See license.txt for
details. */
#include "codegen/targets.h"
#include "environment.h"
namespace avian {
namespace codegen {
vm::Assembler::Architecture* makeArchitectureNative(vm::System* system, bool useNativeFeatures UNUSED) {
#ifndef AVIAN_TARGET_ARCH
#error "Must specify native target!"
#endif
#if AVIAN_TARGET_ARCH == AVIAN_ARCH_UNKNOWN
system->abort();
return 0;
#elif (AVIAN_TARGET_ARCH == AVIAN_ARCH_X86) || (AVIAN_TARGET_ARCH == AVIAN_ARCH_X86_64)
return makeArchitectureX86(system, useNativeFeatures);
#elif AVIAN_TARGET_ARCH == AVIAN_ARCH_ARM
return makeArchitectureArm(system, useNativeFeatures);
#elif AVIAN_TARGET_ARCH == AVIAN_ARCH_POWERPC
return makeArchitecturePowerpc(system, useNativeFeatures);
#else
#error "Unsupported codegen target"
#endif
}
} // namespace codegen
} // namespace avian