diff options
Diffstat (limited to 'tools/llc/llc.cpp')
-rw-r--r-- | tools/llc/llc.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 346e547..9acfcd2 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -128,8 +128,7 @@ GetFileNameRoot(const std::string &InputFilename) { return outputFilename; } -static formatted_raw_ostream *GetOutputStream(const char *TargetName, - const char *ProgName) { +static formatted_raw_ostream *GetOutputStream(const char *ProgName) { if (OutputFilename != "") { if (OutputFilename == "-") return &fouts(); @@ -170,10 +169,10 @@ static formatted_raw_ostream *GetOutputStream(const char *TargetName, bool Binary = false; switch (FileType) { case TargetMachine::AssemblyFile: - if (TargetName[0] == 'c') { - if (TargetName[1] == 0) + if (MArch->Name[0] == 'c') { + if (MArch->Name[1] == 0) OutputFilename += ".cbe.c"; - else if (TargetName[1] == 'p' && TargetName[2] == 'p') + else if (MArch->Name[1] == 'p' && MArch->Name[2] == 'p') OutputFilename += ".cpp"; else OutputFilename += ".s"; @@ -249,13 +248,10 @@ int main(int argc, char **argv) { // Allocate target machine. First, check whether the user has // explicitly specified an architecture to compile for. - const Target *TheTarget; - if (MArch) { - TheTarget = &MArch->TheTarget; - } else { + if (MArch == 0) { std::string Err; - TheTarget = TargetRegistry::getClosestStaticTargetForModule(mod, Err); - if (TheTarget == 0) { + MArch = TargetMachineRegistry::getClosestStaticTargetForModule(mod, Err); + if (MArch == 0) { errs() << argv[0] << ": error auto-selecting target for module '" << Err << "'. Please use the -march option to explicitly " << "pick a target.\n"; @@ -273,13 +269,12 @@ int main(int argc, char **argv) { FeaturesStr = Features.getString(); } - std::auto_ptr<TargetMachine> - target(TheTarget->createTargetMachine(mod, FeaturesStr)); + std::auto_ptr<TargetMachine> target(MArch->CtorFn(mod, FeaturesStr)); assert(target.get() && "Could not allocate target machine!"); TargetMachine &Target = *target.get(); // Figure out where we are going to send the output... - formatted_raw_ostream *Out = GetOutputStream(TheTarget->getName(), argv[0]); + formatted_raw_ostream *Out = GetOutputStream(argv[0]); if (Out == 0) return 1; CodeGenOpt::Level OLvl = CodeGenOpt::Default; |