1 //===- LTOBugPoint.h - Top-Level LTO BugPoint class -------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
13 //===----------------------------------------------------------------------===//
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/BitVector.h"
17 #include "llvm/Module.h"
18 #include "llvm/System/Path.h"
25 LTOBugPoint(std::istream &args, std::istream &ins);
28 /// findTroubleMakers - Find minimum set of input files that causes error
29 /// identified by the script.
30 bool findTroubleMakers(llvm::SmallVector<std::string, 4> &TroubleMakers,
33 /// getNativeObjectFile - Generate native object file based from llvm
34 /// bitcode file. Return false in case of an error. Generated native
35 /// object file is inserted in to the NativeInputFiles list.
36 bool getNativeObjectFile(std::string &FileName);
38 std::string &getErrMsg() { return ErrMsg; }
41 /// LinkerInputFiles - This is a list of linker input files. Once populated
42 /// this list is not modified.
43 llvm::SmallVector<std::string, 16> LinkerInputFiles;
45 /// LinkerOptions - List of linker command line options.
46 llvm::SmallVector<std::string, 16> LinkerOptions;
48 /// NativeInputFiles - This is a list of input files that are not llvm
49 /// bitcode files. The order in this list is important. The a file
50 /// in LinkerInputFiles at index 4 is a llvm bitcode file then the file
51 /// at index 4 in NativeInputFiles is corresponding native object file.
52 llvm::SmallVector<std::string, 16> NativeInputFiles;
54 /// BCFiles - This bit vector tracks input bitcode files.
55 llvm::BitVector BCFiles;
57 /// ConfirmedClean - This bit vector tracks input files that are confirmed
59 llvm::BitVector ConfirmedClean;
61 /// ConfirmedGuilty - This bit vector tracks input files that are confirmed
62 /// to contribute to the bug being investigated.
63 llvm::BitVector ConfirmedGuilty;
64 std::string getFeatureString(const char *TargetTriple);
67 llvm::sys::Path TempDir;
69 /// findLinkingFailure - If true, investigate link failure bugs when
70 /// one or more linker input files are llvm bitcode files. If false,
71 /// investigate optimization or code generation bugs in LTO mode.
72 bool findLinkingFailure;
75 /// assembleBitcode - Generate assembly code from the module. Return false
76 /// in case of an error.
77 bool assembleBitcode(llvm::Module *M, const char *AsmFileName);
79 /// relinkProgram - Relink program. Return false if linking fails.
80 bool relinkProgram(llvm::SmallVector<std::string, 16> &InputFiles);
82 /// reproduceProgramError - Validate program using user provided script.
83 bool reproduceProgramError(std::string &Script);
85 /// identifyTroubleMakers - Identify set of inputs from the given
86 /// bitvector that are causing the bug under investigation.
87 void identifyTroubleMakers(llvm::BitVector &In);