mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-04-02 18:19:03 +02:00
Fixed choosing default target machine without needing to link in targets.
This commit is contained in:
@@ -1483,23 +1483,6 @@ LLConstant* DtoTypeInfoOf(Type* type, bool base)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void findDefaultTarget()
|
||||
{
|
||||
std::string err_str;
|
||||
const llvm::TargetMachineRegistry::entry* e = llvm::TargetMachineRegistry::getClosestTargetForJIT(err_str);
|
||||
if (e == 0)
|
||||
{
|
||||
error("Failed to find a default target machine: %s", err_str.c_str());
|
||||
fatal();
|
||||
}
|
||||
else
|
||||
{
|
||||
global.params.llvmArch = const_cast<char*>(e->Name);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
LLValue* DtoBoolean(Loc& loc, DValue* dval)
|
||||
{
|
||||
Type* dtype = dval->getType()->toBasetype();
|
||||
|
||||
@@ -95,15 +95,7 @@ void Module::genobjfile(int multiobj)
|
||||
ir.module->setTargetTriple(target_triple);
|
||||
ir.module->setDataLayout(global.params.data_layout);
|
||||
|
||||
// heavily inspired by tools/llc/llc.cpp:200-230
|
||||
const llvm::TargetMachineRegistry::entry* targetEntry;
|
||||
std::string targetError;
|
||||
targetEntry = llvm::TargetMachineRegistry::getClosestStaticTargetForModule(*ir.module, targetError);
|
||||
assert(targetEntry && "Failed to find a static target for module");
|
||||
std::auto_ptr<llvm::TargetMachine> targetPtr(targetEntry->CtorFn(*ir.module, "")); // TODO: replace "" with features
|
||||
assert(targetPtr.get() && "Could not allocate target machine!");
|
||||
llvm::TargetMachine &targetMachine = *targetPtr.get();
|
||||
gTargetData = targetMachine.getTargetData();
|
||||
gTargetData = new llvm::TargetData(global.params.data_layout);
|
||||
|
||||
// debug info
|
||||
if (global.params.symdebug) {
|
||||
|
||||
Reference in New Issue
Block a user