diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /tools/llc | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'tools/llc')
-rw-r--r-- | tools/llc/Android.mk | 1 | ||||
-rw-r--r-- | tools/llc/llc.cpp | 40 |
2 files changed, 15 insertions, 26 deletions
diff --git a/tools/llc/Android.mk b/tools/llc/Android.mk index a25cf5c..a98cd8b 100644 --- a/tools/llc/Android.mk +++ b/tools/llc/Android.mk @@ -48,6 +48,7 @@ llvm_llc_STATIC_LIBRARIES := \ libLLVMipo \ libLLVMipa \ libLLVMLinker \ + libLLVMMCDisassembler \ libLLVMMC \ libLLVMMCParser \ libLLVMScalarOpts \ diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 09ff461..fe4d9ac 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -41,6 +41,7 @@ #include "llvm/Support/ToolOutputFile.h" #include "llvm/Target/TargetLibraryInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetSubtargetInfo.h" #include <memory> using namespace llvm; @@ -94,23 +95,6 @@ static cl::opt<bool> AsmVerbose("asm-verbose", static int compileModule(char **, LLVMContext &); -// GetFileNameRoot - Helper function to get the basename of a filename. -static inline std::string -GetFileNameRoot(const std::string &InputFilename) { - std::string IFN = InputFilename; - std::string outputFilename; - int Len = IFN.length(); - if ((Len > 2) && - IFN[Len-3] == '.' && - ((IFN[Len-2] == 'b' && IFN[Len-1] == 'c') || - (IFN[Len-2] == 'l' && IFN[Len-1] == 'l'))) { - outputFilename = std::string(IFN.begin(), IFN.end()-3); // s/.bc/.s/ - } else { - outputFilename = IFN; - } - return outputFilename; -} - static tool_output_file *GetOutputStream(const char *TargetName, Triple::OSType OS, const char *ProgName) { @@ -119,7 +103,12 @@ static tool_output_file *GetOutputStream(const char *TargetName, if (InputFilename == "-") OutputFilename = "-"; else { - OutputFilename = GetFileNameRoot(InputFilename); + // If InputFilename ends in .bc or .ll, remove it. + StringRef IFN = InputFilename; + if (IFN.endswith(".bc") || IFN.endswith(".ll")) + OutputFilename = IFN.drop_back(3); + else + OutputFilename = IFN; switch (FileType) { case TargetMachine::CGFT_AssemblyFile: @@ -158,14 +147,13 @@ static tool_output_file *GetOutputStream(const char *TargetName, } // Open the file. - std::string error; + std::error_code EC; sys::fs::OpenFlags OpenFlags = sys::fs::F_None; if (!Binary) OpenFlags |= sys::fs::F_Text; - tool_output_file *FDOut = new tool_output_file(OutputFilename.c_str(), error, - OpenFlags); - if (!error.empty()) { - errs() << error << '\n'; + tool_output_file *FDOut = new tool_output_file(OutputFilename, EC, OpenFlags); + if (EC) { + errs() << EC.message() << '\n'; delete FDOut; return nullptr; } @@ -231,7 +219,7 @@ static int compileModule(char **argv, LLVMContext &Context) { // If user just wants to list available options, skip module loading if (!SkipModule) { - M.reset(ParseIRFile(InputFilename, Err, Context)); + M = parseIRFile(InputFilename, Err, Context); mod = M.get(); if (mod == nullptr) { Err.print(argv[0], errs()); @@ -317,9 +305,9 @@ static int compileModule(char **argv, LLVMContext &Context) { PM.add(TLI); // Add the target data from the target machine, if it exists, or the module. - if (const DataLayout *DL = Target.getDataLayout()) + if (const DataLayout *DL = Target.getSubtargetImpl()->getDataLayout()) mod->setDataLayout(DL); - PM.add(new DataLayoutPass(mod)); + PM.add(new DataLayoutPass()); if (RelaxAll.getNumOccurrences() > 0 && FileType != TargetMachine::CGFT_ObjectFile) |