mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
Implement TargetRegistrationListener
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14759 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2845ece825
commit
7c38def077
@ -18,8 +18,34 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
/// List - This is the main list of all of the registered target machines.
|
||||||
const TargetMachineRegistry::Entry *TargetMachineRegistry::List = 0;
|
const TargetMachineRegistry::Entry *TargetMachineRegistry::List = 0;
|
||||||
|
|
||||||
|
/// Listeners - All of the listeners registered to get notified when new targets
|
||||||
|
/// are loaded.
|
||||||
|
static TargetRegistrationListener *Listeners = 0;
|
||||||
|
|
||||||
|
TargetMachineRegistry::Entry::Entry(const char *N, const char *SD,
|
||||||
|
TargetMachine *(*CF)(const Module &, IntrinsicLowering*),
|
||||||
|
unsigned (*MMF)(const Module &M), unsigned (*JMF)())
|
||||||
|
: Name(N), ShortDesc(SD), CtorFn(CF), ModuleMatchQualityFn(MMF),
|
||||||
|
JITMatchQualityFn(JMF), Next(List) {
|
||||||
|
List = this;
|
||||||
|
for (TargetRegistrationListener *L = Listeners; L; L = L->getNext())
|
||||||
|
L->targetRegistered(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetRegistrationListener::TargetRegistrationListener() {
|
||||||
|
Next = Listeners;
|
||||||
|
if (Next) Next->Prev = &Next;
|
||||||
|
Prev = &Listeners;
|
||||||
|
Listeners = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetRegistrationListener::~TargetRegistrationListener() {
|
||||||
|
*Prev = Next;
|
||||||
|
}
|
||||||
|
|
||||||
/// getClosestStaticTargetForModule - Given an LLVM module, pick the best target
|
/// getClosestStaticTargetForModule - Given an LLVM module, pick the best target
|
||||||
/// that is compatible with the module. If no close target can be found, this
|
/// that is compatible with the module. If no close target can be found, this
|
||||||
/// returns null and sets the Error string to a reason.
|
/// returns null and sets the Error string to a reason.
|
||||||
|
Loading…
Reference in New Issue
Block a user