Add getTargetTriple() that linker can use to query target architecture.
authorDevang Patel <dpatel@apple.com>
Wed, 6 Sep 2006 20:16:28 +0000 (20:16 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 6 Sep 2006 20:16:28 +0000 (20:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30132 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/LinkTimeOptimizer.h
tools/lto/lto.cpp

index 76a7af66da0c583ff5ab487923b82ab969ed0932..006f1171c80f842b625e060dd9505973b84add63 100644 (file)
@@ -92,6 +92,7 @@ namespace llvm {
     enum LTOStatus optimizeModules(const std::string &OutputFilename,
                                    std::vector<const char*> &exportList,
                                    std::string &targetTriple);
+    void getTargetTriple(const std::string &InputFilename, std::string &targetTriple);
 
   private:
     Module *getModule (const std::string &InputFilename);
index 96b449e28c80cc297e00ca2b97abebd613213e15..14cfc8efafa3dffe752acc88c9904f0f0e93fd17 100644 (file)
@@ -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.