llvm-6502/lib/Support
Chris Lattner ea03e10fac Implement rdar://7415680 - Twine integer support lacks greatness
Microoptimize Twine's with unsigned and int to not pin their value to
the stack.  This saves stack space in common cases and allows mem2reg
in the caller.  A simple example is:

void foo(const Twine &);
void bar(int x) {
  foo("xyz: " + Twine(x));
}

Before:

__Z3bari:
	subq	$40, %rsp
	movl	%edi, 36(%rsp)
	leaq	L_.str3(%rip), %rax
	leaq	36(%rsp), %rcx
	leaq	8(%rsp), %rdi
	movq	%rax, 8(%rsp)
	movq	%rcx, 16(%rsp)
	movb	$3, 24(%rsp)
	movb	$7, 25(%rsp)
	callq	__Z3fooRKN4llvm5TwineE
	addq	$40, %rsp
	ret

After:

__Z3bari:
	subq	$24, %rsp
	leaq	L_.str3(%rip), %rax
	movq	%rax, (%rsp)
	movslq	%edi, %rax
	movq	%rax, 8(%rsp)
	movb	$3, 16(%rsp)
	movb	$7, 17(%rsp)
	leaq	(%rsp), %rdi
	callq	__Z3fooRKN4llvm5TwineE
	addq	$24, %rsp
	ret

It saves 16 bytes of stack and one instruction in this case.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103107 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-05 18:40:33 +00:00
..
Allocator.cpp BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob) 2010-04-13 16:38:06 +00:00
APFloat.cpp Fix minor style issues. 2010-03-24 19:38:02 +00:00
APInt.cpp improve portability to minix, patch by 2010-03-26 23:54:15 +00:00
APSInt.cpp
circular_raw_ostream.cpp clean this up, fix std::min ambiguity on some platforms. 2010-04-09 20:43:54 +00:00
CMakeLists.txt De-bork CMake build 2009-12-23 17:03:46 +00:00
CommandLine.cpp Fix minor style issues. 2010-03-24 19:38:02 +00:00
ConstantRange.cpp Fix a typo that several people pointed out. Also, address the case of 2010-01-26 15:56:18 +00:00
COPYRIGHT.regex Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
Debug.cpp Fix a bunch of namespace polution. 2010-04-15 17:08:50 +00:00
DeltaAlgorithm.cpp DeltaAlgorithm: Add a virtual destructor and home. 2009-12-09 07:19:48 +00:00
Dwarf.cpp Fix typo. add a test case. 2010-04-19 20:31:39 +00:00
ErrorHandling.cpp rename llvm_install_error_handler -> install_fatal_error_handler 2010-04-07 23:12:29 +00:00
FileUtilities.cpp Convert some users of ftostr to raw_ostream. 2010-01-29 14:42:22 +00:00
FoldingSet.cpp Add the ability to "intern" FoldingSetNodeID data into a 2010-03-18 16:16:38 +00:00
FormattedStream.cpp Fix various doxygen warnings. 2010-02-22 04:10:52 +00:00
GraphWriter.cpp reduce indentation 2010-04-18 03:35:23 +00:00
IsInf.cpp
IsNAN.cpp
Makefile Removed trailing whitespace from Makefiles. 2009-01-09 16:44:42 +00:00
ManagedStatic.cpp Split the thread-related APIs out into their own file, and add a few more 2009-06-16 17:33:51 +00:00
MemoryBuffer.cpp stringref-ize the MemoryBuffer::get apis. This requires 2010-04-05 22:42:30 +00:00
MemoryObject.cpp canonicalize namespace gymnastics 2009-09-09 23:46:42 +00:00
PluginLoader.cpp remove some uses of llvm/Support/Streams.h 2009-08-23 08:43:55 +00:00
PrettyStackTrace.cpp Switch to SmallString::str from SmallString::c_str, and remove 2009-08-19 20:07:03 +00:00
raw_os_ostream.cpp Make some methods const. The only interesting change here is that 2009-12-19 01:38:42 +00:00
raw_ostream.cpp Try again if write(2) reports an recoverable error. 2010-05-05 15:17:47 +00:00
regcclass.h Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
regcname.h Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
regcomp.c Fix may-be-used-uninitialized warning. 2009-09-08 16:14:54 +00:00
regengine.inc Various MSVC warning fixes about truncated 64 bit shifts and const pointers passed to free. 2010-04-08 15:25:57 +00:00
regerror.c More MSVC warning fixes: 2009-09-06 12:26:28 +00:00
regex2.h Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
regex_impl.h Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
Regex.cpp Add Regex::sub, for doing regular expression substitution with backreferences. 2010-02-17 20:08:42 +00:00
regexec.c Push const through the regex engine. Fixes some of the warnings in PR6616. 2010-04-05 17:50:20 +00:00
regfree.c Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
regstrlcpy.c Add regular expression matching support, based on OpenBSD regexec()/regcomp() 2009-08-30 08:24:09 +00:00
regutils.h More MSVC warning fixes: 2009-09-06 12:26:28 +00:00
SlowOperationInformer.cpp remove some uses of llvm/Support/Streams.h 2009-08-23 08:43:55 +00:00
SmallPtrSet.cpp Fix several const-correctness issues, resolving some -Wcast-qual warnings. 2008-08-05 14:45:15 +00:00
SmallVector.cpp now that libsystem no longer uses SmallVector, we can move 2009-12-16 08:44:24 +00:00
SourceMgr.cpp enhance SMDiagnostic to also maintain a pointer to the SourceMgr. 2010-04-06 18:06:18 +00:00
Statistic.cpp Introduce namespace-scope functions to enable LLVM statistics without 2010-03-30 17:32:08 +00:00
StringExtras.cpp Fix refacto reported by Nicolas Geoffray. 2010-01-18 12:40:05 +00:00
StringMap.cpp Pass StringRef by value. 2009-11-06 10:58:06 +00:00
StringPool.cpp Kill off more cerr/cout uses and prune includes a bit. 2009-08-23 11:37:21 +00:00
StringRef.cpp Add an override to StringRef::getAsInteger which parses into an APInt. 2010-02-28 09:55:58 +00:00
SystemUtils.cpp Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn't 2009-09-11 20:46:33 +00:00
TargetRegistry.cpp Improve JIT error message for users crazy enough to use -march with JIT, and 2009-09-08 23:32:35 +00:00
Timer.cpp Fix a bunch of namespace polution. 2010-04-15 17:08:50 +00:00
Triple.cpp Fix comment typo. 2010-03-24 09:05:14 +00:00
Twine.cpp Implement rdar://7415680 - Twine integer support lacks greatness 2010-05-05 18:40:33 +00:00