From a2940d63b4a3ed43b3a079b669fab3bd466f9dad Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Fri, 1 Jul 2011 08:32:58 +0100 Subject: [PATCH] Update call to llvm::Target::createTargetMachine() for LLVM dev tree build to handle recent change to API. If building with LLVM tot, a version starting with or after this change must be used: commit 276365dd4bc0c2160f91fd8062ae1fc90c86c324 Author: Evan Cheng Date: Thu Jun 30 01:53:36 2011 +0000 Fix the ridiculous SubtargetFeatures API where it implicitly expects CPU name to be the first encoded as the first feature. It then uses the CPU name to look up features / scheduling itineray even though clients know full well the CPU name being used to query these properties. The fix is to just have the clients explictly pass the CPU name! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134127 91177308-0d34-0410-b5e6-96231b3b80d8 --- module.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module.cpp b/module.cpp index 5aabc790..0403b81e 100644 --- a/module.cpp +++ b/module.cpp @@ -979,6 +979,11 @@ Module::writeObjectFileOrAssembly(OutputType outputType, const char *outFileName } std::string featuresString; +#ifdef LLVM_3_0svn + llvm::TargetMachine *targetMachine = + target->createTargetMachine(triple.getTriple(), g->target.cpu, + featuresString); +#else if (g->target.cpu.size()) { llvm::SubtargetFeatures features; features.setCPU(g->target.cpu); @@ -987,6 +992,7 @@ Module::writeObjectFileOrAssembly(OutputType outputType, const char *outFileName llvm::TargetMachine *targetMachine = target->createTargetMachine(triple.getTriple(), featuresString); +#endif if (targetMachine == NULL) { fprintf(stderr, "Unable to create target machine for target \"%s\"!", triple.str().c_str());