clang-1/lib/CodeGen
Chris Lattner 3ae9f48ae0 Teach sema and codegen about the difference between address of labels,
which is a common idiom to improve PIC'ness of code using the addr of
label extension.  This implementation is a gross hack, but the only other
alternative would be to teach evalutate about this horrid combination.
While GCC allows things like "&&foo - &&bar + 1", people don't use this
in practice.  This implements PR5131.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-13 07:14:16 +00:00
..
ABIInfo.h x86-64 ABI: If a type is a C++ record with either a non-trivial destructor or a non-trivial copy constructor, it should be passed in a pointer. Daniel, plz review. 2009-09-16 15:53:40 +00:00
CGBlocks.cpp Implement a FIXME. This improves codegen just a tad. 2009-10-01 22:29:41 +00:00
CGBlocks.h Improve debug info generation for __block variables. 2009-09-22 02:12:52 +00:00
CGBuilder.h Disable generation of basic block names in NDEBUG mode. 2008-11-12 00:01:12 +00:00
CGBuiltin.cpp Implement __builtin_unreachable(), a GCC 4.5 extension. 2009-09-21 03:09:59 +00:00
CGCXX.cpp Even more devirtualization cleverness. 2009-10-12 19:59:15 +00:00
CGCXX.h Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
CGCXXClass.cpp Change GetAddressCXXOfBaseClass to use CXXBasePaths for calculating base class offsets. Fix the code to handle virtual bases as well. 2009-10-06 22:43:30 +00:00
CGCXXExpr.cpp Fix a lame regression in IR gen for C++ delete expressions. PR5102 2009-10-01 05:49:51 +00:00
CGCXXTemp.cpp If a function call returns a reference, don't bind it to a temporary. 2009-09-14 01:30:44 +00:00
CGCall.cpp Use new predicates for some type equality tests. 2009-10-05 13:47:21 +00:00
CGCall.h Change CodeGenModule::ConstructTypeAttributes to return the calling convention 2009-09-12 00:59:20 +00:00
CGDebugInfo.cpp Encode long double. 2009-10-12 22:28:31 +00:00
CGDebugInfo.h Add support to attach debug info to an instruction. 2009-10-06 18:36:08 +00:00
CGDecl.cpp Revert 83567. 2009-10-09 22:06:15 +00:00
CGExpr.cpp There is no need to attach debug location info with alloca instruction. 2009-10-12 22:29:02 +00:00
CGExprAgg.cpp Move the vtable builder to CGVtable.cpp, general cleanup. 2009-10-11 22:13:54 +00:00
CGExprComplex.cpp Change all the Type::getAsFoo() methods to specializations of Type::getAs(). 2009-09-21 23:43:11 +00:00
CGExprConstant.cpp Teach sema and codegen about the difference between address of labels, 2009-10-13 07:14:16 +00:00
CGExprScalar.cpp Generate weak read barriers when reading a weak __block 2009-10-10 20:07:56 +00:00
CGObjC.cpp IRgen/ObjC: Make the target method decl available to GenerateMessageSendSuper. 2009-09-17 04:01:22 +00:00
CGObjCGNU.cpp Patch fixes a code gen. bug in generation of objc_assign_ivar 2009-09-24 22:25:38 +00:00
CGObjCMac.cpp Patch fixes a code gen. bug in generation of objc_assign_ivar 2009-09-24 22:25:38 +00:00
CGObjCRuntime.h Patch fixes a code gen. bug in generation of objc_assign_ivar 2009-09-24 22:25:38 +00:00
CGRecordLayoutBuilder.cpp Store the key function of a record decl inside CGRecordLayout. 2009-10-12 21:16:22 +00:00
CGRecordLayoutBuilder.h Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
CGRtti.cpp Change mangleCXXVtable and mangleCXXRtti to take CXXRecordDecls instead of QualTypes. 2009-10-11 21:24:51 +00:00
CGStmt.cpp reimplement codegen for indirect goto with the following advantages: 2009-10-13 06:55:33 +00:00
CGValue.h Patch fixes a code gen. bug in generation of objc_assign_ivar 2009-09-24 22:25:38 +00:00
CGVtable.cpp Remove dead variable. 2009-10-11 22:57:54 +00:00
CGVtable.h Move the vtable builder to CGVtable.cpp, general cleanup. 2009-10-11 22:13:54 +00:00
CMakeLists.txt Add CGVtable.cpp to CMakeLists. 2009-10-11 22:22:38 +00:00
CodeGenFunction.cpp reimplement codegen for indirect goto with the following advantages: 2009-10-13 06:55:33 +00:00
CodeGenFunction.h reimplement codegen for indirect goto with the following advantages: 2009-10-13 06:55:33 +00:00
CodeGenModule.cpp Move the vtable builder to CGVtable.cpp, general cleanup. 2009-10-11 22:13:54 +00:00
CodeGenModule.h Enable "debug info attached to an instruction" mode. 2009-10-12 23:31:25 +00:00
CodeGenTypes.cpp Use the qualified name for tag types. 2009-09-26 19:03:24 +00:00
CodeGenTypes.h Store the key function of a record decl inside CGRecordLayout. 2009-10-12 21:16:22 +00:00
Makefile Allow customization for the producer information in the debug output. 2009-10-09 18:38:12 +00:00
Mangle.cpp Change mangleCXXVtable and mangleCXXRtti to take CXXRecordDecls instead of QualTypes. 2009-10-11 21:24:51 +00:00
Mangle.h Change mangleCXXVtable and mangleCXXRtti to take CXXRecordDecls instead of QualTypes. 2009-10-11 21:24:51 +00:00
ModuleBuilder.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
README.txt These IRgen improvements have been done. 2009-07-23 03:03:07 +00:00
TargetABIInfo.cpp Use ABIArgInfo::getDirect() for all types that have a pointer representation. 2009-09-26 03:56:53 +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!

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