blob: 7634357915d621f2c5949641bcc0ab8052444b20 [file] [log] [blame]
Devang Patele330f2d2008-07-18 22:59:45 +00001//===- LTOBugPoint.h - Top-Level LTO BugPoint class -------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This class contains all of the shared state and information that is used by
11// the LTO BugPoint tool to track down bit code files that cause errors.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/ADT/SmallVector.h"
Devang Patel4f574f52008-07-21 23:04:39 +000016#include "llvm/Module.h"
Devang Patel35b39b4f2008-07-22 20:03:45 +000017#include "llvm/System/Path.h"
Devang Patele330f2d2008-07-18 22:59:45 +000018#include <string>
19#include <fstream>
20
21class LTOBugPoint {
22 public:
23
24 LTOBugPoint(std::istream &args, std::istream &ins);
Devang Patel35b39b4f2008-07-22 20:03:45 +000025 ~LTOBugPoint();
Devang Patele330f2d2008-07-18 22:59:45 +000026
Devang Patel5dd66a02008-07-18 23:46:41 +000027 /// findTroubleMakers - Find minimum set of input files that causes error
28 /// identified by the script.
29 bool findTroubleMakers(llvm::SmallVector<std::string, 4> &TroubleMakers,
30 std::string &Script);
Devang Patel4f574f52008-07-21 23:04:39 +000031
32 /// getNativeObjectFile - Generate native object file based from llvm
33 /// bitcode file. Return false in case of an error.
34 bool getNativeObjectFile(std::string &FileName);
35
36 std::string &getErrMsg() { return ErrMsg; }
37
Devang Patele330f2d2008-07-18 22:59:45 +000038 private:
39 /// LinkerInputFiles - This is a list of linker input files. Once populated
40 /// this list is not modified.
41 llvm::SmallVector<std::string, 16> LinkerInputFiles;
Devang Patel5dd66a02008-07-18 23:46:41 +000042
43 /// LinkerOptions - List of linker command line options.
Devang Patele330f2d2008-07-18 22:59:45 +000044 llvm::SmallVector<std::string, 16> LinkerOptions;
45
Devang Patel5dd66a02008-07-18 23:46:41 +000046 /// NativeInputFiles - This is a list of input files that are not llvm
47 /// bitcode files. The order in this list is important. The a file
48 /// in LinkerInputFiles at index 4 is a llvm bitcode file then the file
49 /// at index 4 in NativeInputFiles is corresponding native object file.
50 llvm::SmallVector<std::string, 16> NativeInputFiles;
51
Devang Patel4f574f52008-07-21 23:04:39 +000052 std::string getFeatureString(const char *TargetTriple);
53 std::string ErrMsg;
54
Devang Patel35b39b4f2008-07-22 20:03:45 +000055 llvm::sys::Path TempDir;
Devang Patel4f574f52008-07-21 23:04:39 +000056private:
57 /// assembleBitcode - Generate assembly code from the module. Return false
58 /// in case of an error.
59 bool assembleBitcode(llvm::Module *M, const char *AsmFileName);
Devang Patele330f2d2008-07-18 22:59:45 +000060};