llvm/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
CommandLine.cpp Fix minor style issues. 2010-03-24 19:38:02 +00:00
ConstantRange.cpp
COPYRIGHT.regex
Debug.cpp Fix a bunch of namespace polution. 2010-04-15 17:08:50 +00:00
DeltaAlgorithm.cpp
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
FoldingSet.cpp Add the ability to "intern" FoldingSetNodeID data into a 2010-03-18 16:16:38 +00:00
FormattedStream.cpp
GraphWriter.cpp reduce indentation 2010-04-18 03:35:23 +00:00
IsInf.cpp
IsNAN.cpp
Makefile
ManagedStatic.cpp
MemoryBuffer.cpp stringref-ize the MemoryBuffer::get apis. This requires 2010-04-05 22:42:30 +00:00
MemoryObject.cpp
PluginLoader.cpp
PrettyStackTrace.cpp
raw_os_ostream.cpp
raw_ostream.cpp Try again if write(2) reports an recoverable error. 2010-05-05 15:17:47 +00:00
regcclass.h
regcname.h
regcomp.c
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
regex2.h
regex_impl.h
Regex.cpp
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
regstrlcpy.c
regutils.h
SlowOperationInformer.cpp
SmallPtrSet.cpp
SmallVector.cpp
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
StringMap.cpp
StringPool.cpp
StringRef.cpp
SystemUtils.cpp
TargetRegistry.cpp
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