blob: c63a2723b2d3987eadd96f6e5d2c1ed3029b409d [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 Patele330f2d2008-07-18 22:59:45 +000017#include <string>
18#include <fstream>
19
20class LTOBugPoint {
21 public:
22
23 LTOBugPoint(std::istream &args, std::istream &ins);
24
Devang Patel5dd66a02008-07-18 23:46:41 +000025 /// findTroubleMakers - Find minimum set of input files that causes error
26 /// identified by the script.
27 bool findTroubleMakers(llvm::SmallVector<std::string, 4> &TroubleMakers,
28 std::string &Script);
Devang Patel4f574f52008-07-21 23:04:39 +000029
30 /// getNativeObjectFile - Generate native object file based from llvm
31 /// bitcode file. Return false in case of an error.
32 bool getNativeObjectFile(std::string &FileName);
33
34 std::string &getErrMsg() { return ErrMsg; }
35
Devang Patele330f2d2008-07-18 22:59:45 +000036 private:
37 /// LinkerInputFiles - This is a list of linker input files. Once populated
38 /// this list is not modified.
39 llvm::SmallVector<std::string, 16> LinkerInputFiles;
Devang Patel5dd66a02008-07-18 23:46:41 +000040
41 /// LinkerOptions - List of linker command line options.
Devang Patele330f2d2008-07-18 22:59:45 +000042 llvm::SmallVector<std::string, 16> LinkerOptions;
43
Devang Patel5dd66a02008-07-18 23:46:41 +000044 /// NativeInputFiles - This is a list of input files that are not llvm
45 /// bitcode files. The order in this list is important. The a file
46 /// in LinkerInputFiles at index 4 is a llvm bitcode file then the file
47 /// at index 4 in NativeInputFiles is corresponding native object file.
48 llvm::SmallVector<std::string, 16> NativeInputFiles;
49
Devang Patel4f574f52008-07-21 23:04:39 +000050 std::string getFeatureString(const char *TargetTriple);
51 std::string ErrMsg;
52
53private:
54 /// assembleBitcode - Generate assembly code from the module. Return false
55 /// in case of an error.
56 bool assembleBitcode(llvm::Module *M, const char *AsmFileName);
Devang Patele330f2d2008-07-18 22:59:45 +000057};