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 <evan.cheng@apple.com>
    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
This commit is contained in:
Matt Pharr
2011-07-01 08:32:58 +01:00
parent 32764e7639
commit a2940d63b4

View File

@@ -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());