aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-20 07:01:01 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-20 07:01:01 +0000
commit1488670076908261af145778c23cb9aca30904e5 (patch)
treea81aa6350baa4790b23cdde21ca7cafb25362862 /tools
parentf6fe9579505be86420beea04f2c9ecb0fd7c55fd (diff)
downloadexternal_llvm-1488670076908261af145778c23cb9aca30904e5.zip
external_llvm-1488670076908261af145778c23cb9aca30904e5.tar.gz
external_llvm-1488670076908261af145778c23cb9aca30904e5.tar.bz2
Add -std-{compile,link}-opts to bugpoint.
- Sheesh. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/bugpoint/bugpoint.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp
index 9aedd7e..df8fbc6 100644
--- a/tools/bugpoint/bugpoint.cpp
+++ b/tools/bugpoint/bugpoint.cpp
@@ -22,6 +22,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/StandardPasses.h"
#include "llvm/System/Process.h"
#include "llvm/System/Signals.h"
#include "llvm/LinkAllVMCore.h"
@@ -57,6 +58,14 @@ MemoryLimit("mlimit", cl::init(100), cl::value_desc("MBytes"),
static cl::list<const PassInfo*, bool, PassNameParser>
PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
+static cl::opt<bool>
+StandardCompileOpts("std-compile-opts",
+ cl::desc("Include the standard compile time optimizations"));
+
+static cl::opt<bool>
+StandardLinkOpts("std-link-opts",
+ cl::desc("Include the standard link time optimizations"));
+
/// BugpointIsInterrupted - Set to true when the user presses ctrl-c.
bool llvm::BugpointIsInterrupted = false;
@@ -64,6 +73,20 @@ static void BugpointInterruptFunction() {
BugpointIsInterrupted = true;
}
+// Hack to capture a pass list.
+namespace {
+ class AddToDriver : public PassManager {
+ BugDriver &D;
+ public:
+ AddToDriver(BugDriver &_D) : D(_D) {}
+
+ virtual void add(Pass *P) {
+ const PassInfo *PI = P->getPassInfo();
+ D.addPasses(&PI, &PI + 1);
+ }
+ };
+}
+
int main(int argc, char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv);
@@ -77,6 +100,23 @@ int main(int argc, char **argv) {
LLVMContext& Context = getGlobalContext();
BugDriver D(argv[0], AsChild, FindBugs, TimeoutValue, MemoryLimit, Context);
if (D.addSources(InputFilenames)) return 1;
+
+ AddToDriver PM(D);
+ if (StandardCompileOpts) {
+ createStandardModulePasses(&PM, 3,
+ /*OptimizeSize=*/ false,
+ /*UnitAtATime=*/ true,
+ /*UnrollLoops=*/ true,
+ /*SimplifyLibCalls=*/ true,
+ /*HaveExceptions=*/ true,
+ createFunctionInliningPass());
+ }
+
+ if (StandardLinkOpts)
+ createStandardLTOPasses(&PM, /*Internalize=*/false,
+ /*RunInliner=*/true,
+ /*VerifyEach=*/false);
+
D.addPasses(PassList.begin(), PassList.end());
// Bugpoint has the ability of generating a plethora of core files, so to