llvm/lib
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
..
Analysis Use the SCEVAddRecExpr::getPostIncExpr utility function instead 2010-05-04 01:12:27 +00:00
Archive silence a warning, patch by "mike". 2010-04-25 04:44:26 +00:00
AsmParser Remove the API compatibility layer which converted add, sub, and mul 2010-05-03 22:44:19 +00:00
Bitcode Revert 101465, it broke internal OpenGL testing. 2010-04-16 23:37:20 +00:00
CodeGen Teach liveintervalanalysis about virtual registers which are defined by reg_sequence instructions that are formed by registers defined by distinct instructions. e.g. 2010-05-05 18:27:40 +00:00
CompilerDriver Use FindExecutable as a fall-back search method. 2010-03-05 04:46:28 +00:00
ExecutionEngine Remove the -enable-sjlj-eh option, which doesn't do anything. 2010-05-02 15:36:26 +00:00
Linker Introduce isOpaqueTy and use it rather than isa<OpaqueType>. Also, move some 2010-02-16 14:50:09 +00:00
MC MC: Rename MCSymbol::{g,s}etValue -> MCSymbol::{g,s}etVariableValue. 2010-05-05 17:41:00 +00:00
Support Implement rdar://7415680 - Twine integer support lacks greatness 2010-05-05 18:40:33 +00:00
System This doesn't need SmallVector.h anymore. 2010-04-19 17:51:31 +00:00
Target Model CONCAT_VECTORS of two 64-bit values as a REG_SEQUENCE. 2010-05-05 18:28:36 +00:00
Transforms Combine the implementations of the core part of the SSAUpdater and 2010-05-04 23:18:19 +00:00
VMCore Fix a problem exposed by my previous commit and noticed by a release-asserts 2010-05-04 14:25:42 +00:00
Makefile