Rework the routines that convert AP[S]Int into a string. Now, instead of
authorChris Lattner <sabre@nondot.org>
Sun, 17 Aug 2008 07:19:36 +0000 (07:19 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 17 Aug 2008 07:19:36 +0000 (07:19 +0000)
commitfad86b003a839cef40ec8ce8408322f4913368ca
tree4049a1355d17df35e86a6806d300f0c894bb3fd9
parentb6c8a4098fd23c21d6cda33b09b99b5a0ac1e13f
Rework the routines that convert AP[S]Int into a string.  Now, instead of
returning an std::string by value, it fills in a SmallString/SmallVector
passed in.  This significantly reduces string thrashing in some cases.

More specifically, this:
 - Adds an operator<< and a print method for APInt that allows you to
   directly send them to an ostream.
 - Reimplements APInt::toString to be much simpler and more efficient
   algorithmically in addition to not thrashing strings quite as much.

This speeds up llvm-dis on kc++ by 7%, and may also slightly speed up the
asmprinter.  This also fixes a bug I introduced into the asmwriter in a
previous patch w.r.t. alias printing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54873 91177308-0d34-0410-b5e6-96231b3b80d8
13 files changed:
examples/Fibonacci/fibonacci.cpp
examples/HowToUseJIT/HowToUseJIT.cpp
include/llvm/ADT/APInt.h
include/llvm/ADT/APSInt.h
lib/AsmParser/ParserInternals.h
lib/CodeGen/AsmPrinter.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Support/APFloat.cpp
lib/Support/APInt.cpp
lib/Support/ConstantRange.cpp
lib/Target/CppBackend/CPPBackend.cpp
lib/Transforms/Utils/LowerSwitch.cpp
lib/VMCore/AsmWriter.cpp