diff --git a/llvm/include/llvm/LinkTimeOptimizer.h b/llvm/include/llvm/LinkTimeOptimizer.h index 76a7af66da0c..006f1171c80f 100644 --- a/llvm/include/llvm/LinkTimeOptimizer.h +++ b/llvm/include/llvm/LinkTimeOptimizer.h @@ -92,6 +92,7 @@ namespace llvm { enum LTOStatus optimizeModules(const std::string &OutputFilename, std::vector &exportList, std::string &targetTriple); + void getTargetTriple(const std::string &InputFilename, std::string &targetTriple); private: Module *getModule (const std::string &InputFilename); diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp index 96b449e28c80..14cfc8efafa3 100644 --- a/llvm/tools/lto/lto.cpp +++ b/llvm/tools/lto/lto.cpp @@ -116,6 +116,17 @@ LinkTimeOptimizer::getModule(const std::string &InputFilename) return m; } +/// InputFilename is a LLVM bytecode file. Reade this bytecode file and +/// set corresponding target triplet string. +void +LinkTimeOptimizer::getTargetTriple(const std::string &InputFilename, + std::string &targetTriple) +{ + Module *m = getModule(InputFilename); + if (m) + targetTriple = m->getTargetTriple(); +} + /// InputFilename is a LLVM bytecode file. Read it using bytecode reader. /// Collect global functions and symbol names in symbols vector. /// Collect external references in references vector.