clang-1/lib/CodeGen
Douglas Gregor d86c477fb5 Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-15 06:46:45 +00:00
..
ABIInfo.h
CGBlocks.cpp It's bad form to create VarDecl's without DeclContexts 2010-05-11 18:17:16 +00:00
CGBlocks.h Miscellaneous codegen cleanups. Mostly, don't create new basic blocks 2010-04-21 10:05:39 +00:00
CGBuilder.h
CGBuiltin.cpp add todos for isinf_sign and isnormal, which I don't intend to implement 2010-05-06 06:13:53 +00:00
CGCXX.cpp Vtable -> VTable renames across the board. 2010-04-17 20:15:18 +00:00
CGCXX.h
CGCall.cpp As per Chris' request, return the Instruction from EmitCall and add the metadata in the caller. 2010-05-02 13:41:58 +00:00
CGCall.h Remember the regparm attribute in FunctionType::ExtInfo. 2010-03-30 22:15:11 +00:00
CGClass.cpp simplify EmitAggMemberInitializer a bit and make it work in 32-bit mode, 2010-05-06 06:35:23 +00:00
CGDebugInfo.cpp Fix thinko in yesterday's fix. 2010-05-14 16:55:25 +00:00
CGDebugInfo.h If given location is invalid then use current location. 2010-05-12 23:46:38 +00:00
CGDecl.cpp Implement a simple form of the C++ named return value optimization for 2010-05-15 06:46:45 +00:00
CGDeclCXX.cpp For thread-safe static initialization of local statics with 2010-05-05 15:38:32 +00:00
CGException.cpp Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI 2010-04-30 01:15:21 +00:00
CGExpr.cpp Minor refactoring of my last patch. 2010-05-11 16:31:10 +00:00
CGExprAgg.cpp Emit an lvalue dynamic_cast even if the result is not used. Another 2010-05-14 21:31:02 +00:00
CGExprCXX.cpp Recognize when the named return value optimization applies in a 2010-05-15 00:13:29 +00:00
CGExprComplex.cpp Code gen for compound assignment of complex 2010-03-23 18:43:00 +00:00
CGExprConstant.cpp Move ContainsPointerToDataMember to CodeGenTypes. No functionality change. 2010-05-14 19:41:56 +00:00
CGExprScalar.cpp Make sure that value-initialized pointers to data members are initialized correctly. 2010-05-14 15:05:19 +00:00
CGObjC.cpp Implement semantic analysis and an AST representation for the named 2010-05-15 06:01:05 +00:00
CGObjCGNU.cpp Tweaked selector mangling again (GNU runtime). 2010-05-09 01:01:43 +00:00
CGObjCMac.cpp Merged Elaborated and QualifiedName types. 2010-05-11 21:36:43 +00:00
CGObjCRuntime.h Changed signature of GenerateMessageSend() function to pass the ObjCInterfaceDecl for class messages and removed the boolean IsClassMessage argument, which wasn't used anywhere. 2010-04-28 19:33:36 +00:00
CGRTTI.cpp Fix -fno-rtti -fexceptions by forcing the emission of (non-"builtin") RTTI 2010-04-30 01:15:21 +00:00
CGRecordLayout.h Fix comments. 2010-04-27 14:51:07 +00:00
CGRecordLayoutBuilder.cpp Use a more appropriate LLVM type for the vtable pointer. 2010-05-05 05:47:36 +00:00
CGStmt.cpp Implement a simple form of the C++ named return value optimization for 2010-05-15 06:46:45 +00:00
CGTemporaries.cpp Add the same 'ForVirtualBase' parameter to EmitCXXDestructorCall. 2010-05-02 23:29:11 +00:00
CGVTT.cpp The global variable for the VTT might not have external linkage; allow 2010-05-06 22:18:21 +00:00
CGVTables.cpp Rework when and how vtables are emitted, by tracking where vtables are 2010-05-13 16:44:06 +00:00
CGVTables.h Rework when and how vtables are emitted, by tracking where vtables are 2010-05-13 16:44:06 +00:00
CGValue.h CodeGen: Shrink RValue. 4 words -> 2 words. 2010-05-02 14:59:10 +00:00
CMakeLists.txt Unbreak CMake build. 2010-05-05 05:41:05 +00:00
CodeGenFunction.cpp Don't copy or initialize empty classes. Fixes PR7012. 2010-05-03 01:20:20 +00:00
CodeGenFunction.h Remove an unused function. 2010-05-14 19:48:27 +00:00
CodeGenModule.cpp Disable the available_externally optimization for inline virtual 2010-05-13 21:36:56 +00:00
CodeGenModule.h Rework when and how vtables are emitted, by tracking where vtables are 2010-05-13 16:44:06 +00:00
CodeGenTypes.cpp Move ContainsPointerToDataMember to CodeGenTypes. No functionality change. 2010-05-14 19:41:56 +00:00
CodeGenTypes.h Move ContainsPointerToDataMember to CodeGenTypes. No functionality change. 2010-05-14 19:41:56 +00:00
GlobalDecl.h Use the correct function info for constructors when applying function attributes. Fixes PR6245. 2010-02-06 02:44:09 +00:00
Makefile Allow users to set CPPFLAGS and CXXFLAGS on the make command line. 2010-03-12 22:55:16 +00:00
Mangle.cpp Reapplying patch to change StmtNodes.def to StmtNodes.td, this time 2010-05-05 15:24:00 +00:00
Mangle.h Vtable -> VTable renames across the board. 2010-04-17 20:15:18 +00:00
ModuleBuilder.cpp Rework when and how vtables are emitted, by tracking where vtables are 2010-05-13 16:44:06 +00:00
README.txt
TargetInfo.cpp C++/ABI/x86_64: Member pointers should be classified as INTEGER. 2010-05-15 00:00:37 +00:00
TargetInfo.h Implement __builtin_dwarf_sp_column for i386 (Darwin and not), x86-64 (all), 2010-03-06 00:35:14 +00:00

README.txt

IRgen optimization opportunities.

//===---------------------------------------------------------------------===//

The common pattern of
--
short x; // or char, etc
(x == 10)
--
generates an zext/sext of x which can easily be avoided.

//===---------------------------------------------------------------------===//

Bitfields accesses can be shifted to simplify masking and sign
extension. For example, if the bitfield width is 8 and it is
appropriately aligned then is is a lot shorter to just load the char
directly.

//===---------------------------------------------------------------------===//

It may be worth avoiding creation of alloca's for formal arguments
for the common situation where the argument is never written to or has
its address taken. The idea would be to begin generating code by using
the argument directly and if its address is taken or it is stored to
then generate the alloca and patch up the existing code.

In theory, the same optimization could be a win for block local
variables as long as the declaration dominates all statements in the
block.

NOTE: The main case we care about this for is for -O0 -g compile time
performance, and in that scenario we will need to emit the alloca
anyway currently to emit proper debug info. So this is blocked by
being able to emit debug information which refers to an LLVM
temporary, not an alloca.

//===---------------------------------------------------------------------===//

We should try and avoid generating basic blocks which only contain
jumps. At -O0, this penalizes us all the way from IRgen (malloc &
instruction overhead), all the way down through code generation and
assembly time.

On 176.gcc:expr.ll, it looks like over 12% of basic blocks are just
direct branches!

//===---------------------------------------------------------------------===//