comparison gen/main.cpp @ 1565:b1e5f8001904

Build fix for TargetMachine changes. #if'ed for now.
author Benjamin Kramer <benny.kra@gmail.com>
date Mon, 03 Aug 2009 11:29:35 +0200
parents 3adcb70700cb
children c03d164e96d9
comparison
equal deleted inserted replaced
1564:68dea5bae9e9 1565:b1e5f8001904
440 const llvm::Target *theTarget = NULL; 440 const llvm::Target *theTarget = NULL;
441 // Check whether the user has explicitly specified an architecture to compile for. 441 // Check whether the user has explicitly specified an architecture to compile for.
442 if (mArch.empty()) 442 if (mArch.empty())
443 { 443 {
444 std::string Err; 444 std::string Err;
445 #if LLVM_REV < 77950
445 theTarget = llvm::TargetRegistry::lookupTarget(mod.getTargetTriple(), false, false, Err); 446 theTarget = llvm::TargetRegistry::lookupTarget(mod.getTargetTriple(), false, false, Err);
447 #else
448 theTarget = llvm::TargetRegistry::lookupTarget(mod.getTargetTriple(), Err);
449 #endif
446 if (theTarget == 0) 450 if (theTarget == 0)
447 { 451 {
448 error("failed to auto-select target: %s, please use the -march option", Err.c_str()); 452 error("failed to auto-select target: %s, please use the -march option", Err.c_str());
449 fatal(); 453 fatal();
450 } 454 }
477 for (unsigned i = 0; i != mAttrs.size(); ++i) 481 for (unsigned i = 0; i != mAttrs.size(); ++i)
478 Features.AddFeature(mAttrs[i]); 482 Features.AddFeature(mAttrs[i]);
479 FeaturesStr = Features.getString(); 483 FeaturesStr = Features.getString();
480 } 484 }
481 485
486 #if LLVM_REV < 77946
482 std::auto_ptr<llvm::TargetMachine> target(theTarget->createTargetMachine(mod, FeaturesStr)); 487 std::auto_ptr<llvm::TargetMachine> target(theTarget->createTargetMachine(mod, FeaturesStr));
488 #else
489 std::auto_ptr<llvm::TargetMachine> target(theTarget->createTargetMachine(mod, mod.getTargetTriple(), FeaturesStr));
490 #endif
483 assert(target.get() && "Could not allocate target machine!"); 491 assert(target.get() && "Could not allocate target machine!");
484 gTargetMachine = target.get(); 492 gTargetMachine = target.get();
485 gTargetData = gTargetMachine->getTargetData(); 493 gTargetData = gTargetMachine->getTargetData();
486 494
487 // get final data layout 495 // get final data layout