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

View File

@ -8,7 +8,7 @@
There is NO WARRANTY for this software. See license.txt for
details. */
#include "assembler.h"
#include "codegen/assembler.h"
#include "alloc-vector.h"
#define CAST1(x) reinterpret_cast<UnaryOperationType>(x)
@ -2446,6 +2446,8 @@ class MyArchitecture: public Assembler::Architecture {
}
}
virtual Assembler* makeAssembler(Allocator* allocator, Zone* zone);
virtual void acquire() {
++ referenceCount;
}
@ -2858,23 +2860,20 @@ class MyAssembler: public Assembler {
MyArchitecture* arch_;
};
Assembler* MyArchitecture::makeAssembler(Allocator* allocator, Zone* zone) {
return new(zone) MyAssembler(this->c.s, allocator, zone, this);
}
} // namespace
namespace vm {
namespace avian {
namespace codegen {
Assembler::Architecture*
makeArchitecture(System* system, bool)
makeArchitecturePowerpc(System* system, bool)
{
return new (allocate(system, sizeof(MyArchitecture))) MyArchitecture(system);
}
Assembler*
makeAssembler(System* system, Allocator* allocator, Zone* zone,
Assembler::Architecture* architecture)
{
return
new(zone) MyAssembler(system, allocator, zone,
static_cast<MyArchitecture*>(architecture));
}
} // namespace vm
} // namespace codegen
} // namespace avian