diff options
author | Derek Schuff <dschuff@google.com> | 2012-02-06 22:30:29 +0000 |
---|---|---|
committer | Derek Schuff <dschuff@google.com> | 2012-02-06 22:30:29 +0000 |
commit | 8b2dcad4b53aa9403f9a6397e35566cc78ee843c (patch) | |
tree | 4f7173ceab4188ae1bb82547d0f7e7d04c497496 /llvm/tools/llvm-dis/llvm-dis.cpp | |
parent | fe3bdad393272c3f546e49eba300223c2426217e (diff) | |
download | bcm5719-llvm-8b2dcad4b53aa9403f9a6397e35566cc78ee843c.tar.gz bcm5719-llvm-8b2dcad4b53aa9403f9a6397e35566cc78ee843c.zip |
Enable streaming of bitcode
This CL delays reading of function bodies from initial parse until
materialization, allowing overlap of compilation with bitcode download.
llvm-svn: 149918
Diffstat (limited to 'llvm/tools/llvm-dis/llvm-dis.cpp')
-rw-r--r-- | llvm/tools/llvm-dis/llvm-dis.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp index 9020a527866..6450ea6ac74 100644 --- a/llvm/tools/llvm-dis/llvm-dis.cpp +++ b/llvm/tools/llvm-dis/llvm-dis.cpp @@ -24,6 +24,7 @@ #include "llvm/Analysis/DebugInfo.h" #include "llvm/Assembly/AssemblyAnnotationWriter.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/DataStream.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" @@ -126,12 +127,19 @@ int main(int argc, char **argv) { std::string ErrorMessage; std::auto_ptr<Module> M; - { - OwningPtr<MemoryBuffer> BufferPtr; - if (error_code ec = MemoryBuffer::getFileOrSTDIN(InputFilename, BufferPtr)) - ErrorMessage = ec.message(); + // Use the bitcode streaming interface + DataStreamer *streamer = getDataFileStreamer(InputFilename, &ErrorMessage); + if (streamer) { + std::string DisplayFilename; + if (InputFilename == "-") + DisplayFilename = "<stdin>"; else - M.reset(ParseBitcodeFile(BufferPtr.get(), Context, &ErrorMessage)); + DisplayFilename = InputFilename; + M.reset(getStreamedBitcodeModule(DisplayFilename, streamer, Context, + &ErrorMessage)); + if(M.get() != 0 && M->MaterializeAllPermanently(&ErrorMessage)) { + M.reset(); + } } if (M.get() == 0) { @@ -183,4 +191,3 @@ int main(int argc, char **argv) { return 0; } - |