aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llc/llc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llc/llc.cpp')
-rw-r--r--tools/llc/llc.cpp46
1 files changed, 17 insertions, 29 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 2ca502e..0a3afe2 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -18,7 +18,6 @@
#include "llvm/PassManager.h"
#include "llvm/Pass.h"
#include "llvm/ADT/Triple.h"
-#include "llvm/Analysis/Verifier.h"
#include "llvm/Support/IRReader.h"
#include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
#include "llvm/CodeGen/LinkAllCodegenComponents.h"
@@ -29,6 +28,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/ToolOutputFile.h"
#include "llvm/System/Host.h"
#include "llvm/System/Signals.h"
#include "llvm/Target/SubtargetFeature.h"
@@ -124,9 +124,9 @@ GetFileNameRoot(const std::string &InputFilename) {
return outputFilename;
}
-static formatted_tool_output_file *GetOutputStream(const char *TargetName,
- Triple::OSType OS,
- const char *ProgName) {
+static tool_output_file *GetOutputStream(const char *TargetName,
+ Triple::OSType OS,
+ const char *ProgName) {
// If we don't yet have an output filename, make one.
if (OutputFilename.empty()) {
if (InputFilename == "-")
@@ -184,11 +184,7 @@ static formatted_tool_output_file *GetOutputStream(const char *TargetName,
return 0;
}
- formatted_tool_output_file *Out =
- new formatted_tool_output_file(*FDOut,
- formatted_raw_ostream::DELETE_STREAM);
-
- return Out;
+ return FDOut;
}
// main - Entry point for the llc compiler.
@@ -279,7 +275,7 @@ int main(int argc, char **argv) {
TargetMachine &Target = *target.get();
// Figure out where we are going to send the output...
- OwningPtr<formatted_tool_output_file> Out
+ OwningPtr<tool_output_file> Out
(GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
if (!Out) return 1;
@@ -295,14 +291,6 @@ int main(int argc, char **argv) {
case '3': OLvl = CodeGenOpt::Aggressive; break;
}
- // Request that addPassesToEmitFile run the Verifier after running
- // passes which modify the IR.
-#ifndef NDEBUG
- bool DisableVerify = false;
-#else
- bool DisableVerify = true;
-#endif
-
// Build up all of the passes that we want to do to the module.
PassManager PM;
@@ -312,9 +300,6 @@ int main(int argc, char **argv) {
else
PM.add(new TargetData(&mod));
- if (!NoVerify)
- PM.add(createVerifierPass());
-
// Override default to generate verbose assembly.
Target.setAsmVerbosityDefault(true);
@@ -326,15 +311,18 @@ int main(int argc, char **argv) {
Target.setMCRelaxAll(true);
}
- // Ask the target to add backend passes as necessary.
- if (Target.addPassesToEmitFile(PM, *Out, FileType, OLvl,
- DisableVerify)) {
- errs() << argv[0] << ": target does not support generation of this"
- << " file type!\n";
- return 1;
- }
+ {
+ formatted_raw_ostream FOS(Out->os());
- PM.run(mod);
+ // Ask the target to add backend passes as necessary.
+ if (Target.addPassesToEmitFile(PM, FOS, FileType, OLvl, NoVerify)) {
+ errs() << argv[0] << ": target does not support generation of this"
+ << " file type!\n";
+ return 1;
+ }
+
+ PM.run(mod);
+ }
// Declare success.
Out->keep();