mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Fix "static initialization order fiasco" for the XCore Target.
I fixed all the other Targets in r283702, and interestingly the sanitizers are only now "sometimes" catching this bug on the only one I missed. llvm-svn: 283914
This commit is contained in:
parent
df03c05965
commit
93003b9ee7
@ -769,7 +769,7 @@ MCDisassembler::DecodeStatus XCoreDisassembler::getInstruction(
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
extern Target TheXCoreTarget;
|
||||
Target &getTheXCoreTarget();
|
||||
}
|
||||
|
||||
static MCDisassembler *createXCoreDisassembler(const Target &T,
|
||||
@ -780,6 +780,6 @@ static MCDisassembler *createXCoreDisassembler(const Target &T,
|
||||
|
||||
extern "C" void LLVMInitializeXCoreDisassembler() {
|
||||
// Register the disassembler.
|
||||
TargetRegistry::RegisterMCDisassembler(TheXCoreTarget,
|
||||
TargetRegistry::RegisterMCDisassembler(getTheXCoreTarget(),
|
||||
createXCoreDisassembler);
|
||||
}
|
||||
|
@ -124,26 +124,28 @@ static MCTargetStreamer *createTargetAsmStreamer(MCStreamer &S,
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeXCoreTargetMC() {
|
||||
// Register the MC asm info.
|
||||
RegisterMCAsmInfoFn X(TheXCoreTarget, createXCoreMCAsmInfo);
|
||||
RegisterMCAsmInfoFn X(getTheXCoreTarget(), createXCoreMCAsmInfo);
|
||||
|
||||
// Register the MC codegen info.
|
||||
TargetRegistry::registerMCAdjustCodeGenOpts(TheXCoreTarget,
|
||||
TargetRegistry::registerMCAdjustCodeGenOpts(getTheXCoreTarget(),
|
||||
adjustCodeGenOpts);
|
||||
|
||||
// Register the MC instruction info.
|
||||
TargetRegistry::RegisterMCInstrInfo(TheXCoreTarget, createXCoreMCInstrInfo);
|
||||
TargetRegistry::RegisterMCInstrInfo(getTheXCoreTarget(),
|
||||
createXCoreMCInstrInfo);
|
||||
|
||||
// Register the MC register info.
|
||||
TargetRegistry::RegisterMCRegInfo(TheXCoreTarget, createXCoreMCRegisterInfo);
|
||||
TargetRegistry::RegisterMCRegInfo(getTheXCoreTarget(),
|
||||
createXCoreMCRegisterInfo);
|
||||
|
||||
// Register the MC subtarget info.
|
||||
TargetRegistry::RegisterMCSubtargetInfo(TheXCoreTarget,
|
||||
TargetRegistry::RegisterMCSubtargetInfo(getTheXCoreTarget(),
|
||||
createXCoreMCSubtargetInfo);
|
||||
|
||||
// Register the MCInstPrinter
|
||||
TargetRegistry::RegisterMCInstPrinter(TheXCoreTarget,
|
||||
TargetRegistry::RegisterMCInstPrinter(getTheXCoreTarget(),
|
||||
createXCoreMCInstPrinter);
|
||||
|
||||
TargetRegistry::RegisterAsmTargetStreamer(TheXCoreTarget,
|
||||
TargetRegistry::RegisterAsmTargetStreamer(getTheXCoreTarget(),
|
||||
createTargetAsmStreamer);
|
||||
}
|
||||
|
@ -18,8 +18,7 @@
|
||||
|
||||
namespace llvm {
|
||||
class Target;
|
||||
|
||||
extern Target TheXCoreTarget;
|
||||
Target &getTheXCoreTarget();
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
|
@ -12,8 +12,11 @@
|
||||
#include "llvm/Support/TargetRegistry.h"
|
||||
using namespace llvm;
|
||||
|
||||
Target llvm::TheXCoreTarget;
|
||||
Target &llvm::getTheXCoreTarget() {
|
||||
static Target TheXCoreTarget;
|
||||
return TheXCoreTarget;
|
||||
}
|
||||
|
||||
extern "C" void LLVMInitializeXCoreTargetInfo() {
|
||||
RegisterTarget<Triple::xcore> X(TheXCoreTarget, "xcore", "XCore");
|
||||
RegisterTarget<Triple::xcore> X(getTheXCoreTarget(), "xcore", "XCore");
|
||||
}
|
||||
|
@ -297,5 +297,5 @@ void XCoreAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeXCoreAsmPrinter() {
|
||||
RegisterAsmPrinter<XCoreAsmPrinter> X(TheXCoreTarget);
|
||||
RegisterAsmPrinter<XCoreAsmPrinter> X(getTheXCoreTarget());
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void XCorePassConfig::addPreEmitPass() {
|
||||
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeXCoreTarget() {
|
||||
RegisterTargetMachine<XCoreTargetMachine> X(TheXCoreTarget);
|
||||
RegisterTargetMachine<XCoreTargetMachine> X(getTheXCoreTarget());
|
||||
}
|
||||
|
||||
TargetIRAnalysis XCoreTargetMachine::getTargetIRAnalysis() {
|
||||
|
Loading…
Reference in New Issue
Block a user