search for: raw_svector_ostream

Displaying 20 results from an estimated 54 matches for "raw_svector_ostream".

2015 Apr 19
6
[LLVMdev] SmallString + raw_svector_ostream combination should be more efficient
A very common code pattern in LLVM is SmallString<128> S; raw_svector_ostream OS(S); OS<< ... Use OS.str() While raw_svector_ostream is smart to share the text buffer itself, it's inefficient keeping two sets of pointers to the same buffer: In SmallString: void *BeginX, *EndX, *CapacityX In raw_ostream: char *OutBufStart, *OutBufEnd, *OutBufCur Moreover, at...
2015 May 02
2
[LLVMdev] SmallString + raw_svector_ostream combination should be more efficient
...t; I outlined (is that the right > word?) raw_char_ostream::grow, raw_char_ostream::write (both) into > raw_ostream.cpp with less than 10% difference in performance. > > Profiling reveals that the real culprit is the code line > > OS.reserve(OS.size() + 64); > > called from raw_svector_ostream::write_impl called from > raw_svector_ostream::~raw_svector_ostream. > The issue is already documented: > > raw_svector_ostream::~raw_svector_ostream() { > // FIXME: Prevent resizing during this flush(). > flush(); > } > > And a solution is provided in raw_svector_ost...
2015 May 22
2
[LLVMdev] SmallString + raw_svector_ostream combination should be more efficient
Here's a performance testcase for the raw_svector_ostream patch. On my WIndows x64 machine it runs in 1010ms with the current code and in 440ms with the patch applies. Is this OK to commit? 2015-05-02 21:31 GMT+03:00 Yaron Keren <yaron.keren at gmail.com>: > Following a hint from Duncan in http://llvm.org/pr23395, here is a > revised patch....
2015 Aug 12
2
SmallString + raw_svector_ostream combination should be more efficient
+llvm-dev at lists.llvm.org The impact should be small as all the other streamers usually write directly to the memory buffer and only when out of buffer they call write(). OTOH, raw_svector_ostream (without a buffer) goes though write for every character or block it writes. It can work without virtual write() by overriding the existing virtual write_impl() but this is a slower code path for raw_svector_ostream. Even though the attached raw_svector_ostream patch without virtual write() is sti...
2015 Aug 13
2
SmallString + raw_svector_ostream combination should be more efficient
...ed), thanks! I initially placed the virtual function in header since they were one-liners. The coding standards say that an anchor() function should be supplied, which was indeed missing. Other than required anchor function, why should the virtual functions go in the .cpp? Should I move the empty raw_svector_ostream destructor to the .cpp file too as well? 2015-08-13 2:59 GMT+03:00 Rafael EspĂ­ndola <rafael.espindola at gmail.com>: > Given that it is faster, I am OK with it. > > I get 0.774371631s with master and 0.649787169s with your patch. > > Why move all virtual functions to the hea...
2015 Aug 13
2
SmallString + raw_svector_ostream combination should be more efficient
Ok, one more issue. I've removed the no-op resync() method and now getting rid of numerous raw_ostream::flush() calls. These were required before but now will never do anything but will waste runtime discovering that. To find raw_svector_ostream::flush() calls speficially I locally shadowed raw_ostream:flush() with a deleted flush(): class raw_svector_ostream { ... public: ... void flush() = delete; }; so any direct use of raw_svector_ostream::flush() fails compilation. Calling raw_ostream:flush() itself would never reach the deleted f...
2015 May 02
2
[LLVMdev] SmallString + raw_svector_ostream combination should be more efficient
Could you dig into why: + raw_ostream &write(unsigned char C) override { + grow(1); + *OutBufCur++ = C; + return *this; + } Is 3 times as fast as raw_svector_ostream? I don't see a good reason why that should be any faster than: raw_ostream &operator<<(char C) { if (OutBufCur >= OutBufEnd) return write(C); *OutBufCur++ = C; return *this; } You might just be seeing the difference between having write inlined vs. non-inli...
2015 Apr 20
2
[LLVMdev] SmallString + raw_svector_ostream combination should be more efficient
Sean, thanks for reminding this, Alp did commit a class derived from raw_svector_ostream conatining an internal SmallString he called small_string_ostream. The commit was reverted after a day due to a disagreement about the commit approval and apparently abandoned. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140623/223393.html http://lists.cs.uiuc.edu/pipermail/llvm-...
2015 Apr 30
2
[LLVMdev] SmallString + raw_svector_ostream combination should be more efficient
...e code is not tested yet, I'd like to know if the overall direction and > design are correct. > > Yaron > > > 2015-04-21 0:10 GMT+03:00 Yaron Keren <yaron.keren at gmail.com>: >> >> Sean, thanks for reminding this, Alp did commit a class derived from >> raw_svector_ostream conatining an internal SmallString he called >> small_string_ostream. The commit was reverted after a day due to a >> disagreement about the commit approval and apparently abandoned. >> >> >> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140623/223393.h...
2016 May 04
2
raw_pwrite_stream on a non-fixed-size buffer?
...and my old method doesn't work any more. In principle one gets the asm with targetMachine->addPassesToEmitFile( PM , *OS , llvm::TargetMachine::CGFT_AssemblyFile ) where *OS is a raw_pwrite_stream. The problem is that I only find use cases of raw_pwrite_stream where the derived class raw_svector_ostream is initialized on a SmallString, like SmallString<128> Str; raw_svector_ostream OS(Str); However, the assembler of the modules could be arbitrary large (not fitting in any finite sized SmallString) What can I do? Thanks, Frank
2020 Jan 25
2
Minor bug in raw_svector_ostream
include/llvm/Support/raw_ostream.h, line 568: StringRef str() { return StringRef(OS.data(), OS.size()); } Why str method is without "const" attribute? Any reasonable reason? Thanks! -Stepan
2015 Apr 14
5
[LLVMdev] [cfe-dev] A problem with names that can not be demangled.
...p seems to fix this > problem. > > > > ------------ start diff ------------------- > > @@ -54,5 +54,5 @@ void ValueSymbolTable::reinsertValue(Value* V) { > > // Trim any suffix off and append the next number. > > UniqueName.resize(BaseSize); > > - raw_svector_ostream(UniqueName) << ++LastUnique; > > + raw_svector_ostream(UniqueName) << "." << ++LastUnique; > > > > // Try insert the vmap entry with this suffix. > > -------------- end diff --------------------- > > > > However it causes 60...
2016 Mar 23
2
Help with pass manager
...FileType != TargetMachine::CGFT_ObjectFile) errs() << "warning: ignoring -mc-relax-all because filetype != obj"; { raw_pwrite_stream *outstream = &objoutstream->os(); SmallVector<char, 0> filebuf; std::unique_ptr<raw_svector_ostream> BOS; if ((FileType != TargetMachine::CGFT_AssemblyFile && !objoutstream->os().supportsSeeking())) { BOS = make_unique<raw_svector_ostream>(filebuf); outstream = BOS.get(); } AnalysisID StartBeforeID = nullptr; Ana...
2016 Feb 19
3
raw_pwrite_stream to string or stdout?
TargetMachine::addPassesToEmitFile(..) requires as its 2nd argument an raw_pwrite_stream. Is it possible to create such a thing which either writes into a standard string or streams to outs() ? Thanks,
2016 Mar 24
2
Help with pass manager
...errs() << "warning: ignoring -mc-relax-all because filetype != obj"; >> >> { >> raw_pwrite_stream *outstream = &objoutstream->os(); >> >> SmallVector<char, 0> filebuf; >> std::unique_ptr<raw_svector_ostream> BOS; >> if ((FileType != TargetMachine::CGFT_AssemblyFile && !objoutstream->os().supportsSeeking())) { >> BOS = make_unique<raw_svector_ostream>(filebuf); >> outstream = BOS.get(); >> } >> >>...
2016 Mar 24
0
Help with pass manager
...T_ObjectFile) > errs() << "warning: ignoring -mc-relax-all because filetype != obj"; > > { > raw_pwrite_stream *outstream = &objoutstream->os(); > > SmallVector<char, 0> filebuf; > std::unique_ptr<raw_svector_ostream> BOS; > if ((FileType != TargetMachine::CGFT_AssemblyFile && !objoutstream->os().supportsSeeking())) { > BOS = make_unique<raw_svector_ostream>(filebuf); > outstream = BOS.get(); > } > > AnalysisID StartB...
2016 Mar 24
2
Help with pass manager
...elax-all because filetype != obj"; >>>> >>>> { >>>> raw_pwrite_stream *outstream = &objoutstream->os(); >>>> >>>> SmallVector<char, 0> filebuf; >>>> std::unique_ptr<raw_svector_ostream> BOS; >>>> if ((FileType != TargetMachine::CGFT_AssemblyFile && !objoutstream->os().supportsSeeking())) { >>>> BOS = make_unique<raw_svector_ostream>(filebuf); >>>> outstream = BOS.get(); >>>>...
2016 Mar 24
0
Help with pass manager
...;warning: ignoring -mc-relax-all because filetype != obj"; >>> >>> { >>> raw_pwrite_stream *outstream = &objoutstream->os(); >>> >>> SmallVector<char, 0> filebuf; >>> std::unique_ptr<raw_svector_ostream> BOS; >>> if ((FileType != TargetMachine::CGFT_AssemblyFile && !objoutstream->os().supportsSeeking())) { >>> BOS = make_unique<raw_svector_ostream>(filebuf); >>> outstream = BOS.get(); >>> } >>>...
2016 Mar 24
2
Help with pass manager
...>>>> >>>>>> { >>>>>> raw_pwrite_stream *outstream = &objoutstream->os(); >>>>>> >>>>>> SmallVector<char, 0> filebuf; >>>>>> std::unique_ptr<raw_svector_ostream> BOS; >>>>>> if ((FileType != TargetMachine::CGFT_AssemblyFile && !objoutstream->os().supportsSeeking())) { >>>>>> BOS = make_unique<raw_svector_ostream>(filebuf); >>>>>> outstream = BOS.get();...
2015 Jun 02
2
[LLVMdev] struct type parament
...be inefficient. > > See in lib/IR/Type.cpp, StructType::setName(StringRef Name): > > ... > // While we have a name collision, try a random rename. > if (Entry->getValue()) { > SmallString<64> TempStr(Name); > TempStr.push_back('.'); > raw_svector_ostream TmpStream(TempStr); > unsigned NameSize = Name.size(); > > do { > TempStr.resize(NameSize + 1); > TmpStream.resync(); > TmpStream << getContext().pImpl->NamedStructTypesUniqueID++; > > Entry = &getContext().pImp...