hanchenye-llvm-project/clang/lib/CodeGen
Daniel Dunbar 389325715b Refactor how attributes are set on values.
- Pull out SetCommonAttributes, which handles the things common to
   aliases, methods, functions, and variables.

 - Pull out SetLLVMFunctionAttributesForDefinition, which handles the
   LLVM attributes which we only want to apply to a definition (like
   noinline and alwaysinline).

 - Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
   and specialized).

 - Kill SetFunctionAttributesForDefinition (inlined into sole caller).

 - Inline SetGVDefinitionAttributes into SetMethodAttributes and
   specialize.

 - Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.

This is supposed to be a no functionality change commit, but I may
have made a mistake.

llvm-svn: 69036
2009-04-14 08:05:55 +00:00
..
ABIInfo.h Pull CodeGenFunction::EmitVAArg into target specific ABIInfo classes. 2009-02-10 21:44:36 +00:00
CGBlocks.cpp Audit __private_extern__ handling. 2009-04-14 02:25:56 +00:00
CGBlocks.h Fixup copy/dispose helpers for Objective-C. Radar 6756504 2009-04-10 23:09:55 +00:00
CGBuilder.h Disable generation of basic block names in NDEBUG mode. 2008-11-12 00:01:12 +00:00
CGBuiltin.cpp Update to use hasAttr() instead of getAttr(). 2009-04-13 21:08:27 +00:00
CGCXX.cpp Use the new guard variable mangling function and get rid of the old code. 2009-04-13 18:03:33 +00:00
CGCall.cpp Update to use hasAttr() instead of getAttr(). 2009-04-13 21:08:27 +00:00
CGCall.h Unbreak CGFunctionInfo::Profile method and reenable caching of ABI 2009-02-05 00:00:23 +00:00
CGDebugInfo.cpp Propagate the ASTContext to various AST traversal and lookup functions. 2009-04-09 21:40:53 +00:00
CGDebugInfo.h Add support to emit debug info for objective-c interfaces. 2009-02-26 21:10:26 +00:00
CGDecl.cpp Audit __private_extern__ handling. 2009-04-14 02:25:56 +00:00
CGExpr.cpp Use hasAttr instead of getAttr for conditionals. 2009-04-14 02:45:29 +00:00
CGExprAgg.cpp Minor work related to removing the assumption that value initialization 2009-04-13 21:47:26 +00:00
CGExprComplex.cpp Change compound assignment operators to keep track of both the promoted 2009-03-28 01:22:36 +00:00
CGExprConstant.cpp Minor work related to removing the assumption that value initialization 2009-04-13 21:47:26 +00:00
CGExprScalar.cpp Make sure value is initialized when built w/o asserts. 2009-04-08 16:23:09 +00:00
CGObjC.cpp Update to use hasAttr() instead of getAttr(). 2009-04-13 21:08:27 +00:00
CGObjCGNU.cpp Propagate the ASTContext to various AST traversal and lookup functions. 2009-04-09 21:40:53 +00:00
CGObjCMac.cpp Clean up handling of visibility. 2009-04-14 06:00:08 +00:00
CGObjCRuntime.h Some "prep" work for handling ObjC @-string constants that contain UTF-8. No functionality change. 2009-03-31 16:53:37 +00:00
CGStmt.cpp Minor simplification. 2009-04-13 21:41:57 +00:00
CGValue.h Handle case of none gc'able objects regardless of their 2009-02-21 00:30:43 +00:00
CMakeLists.txt Fix cmake builds. 2009-02-13 15:42:50 +00:00
CodeGenFunction.cpp Update to use hasAttr() instead of getAttr(). 2009-04-13 21:08:27 +00:00
CodeGenFunction.h Remove asserts that weren't really useful, and that would fire in case the CleanupEntries vector needed to be reallocated. 2009-04-10 22:49:13 +00:00
CodeGenModule.cpp Refactor how attributes are set on values. 2009-04-14 08:05:55 +00:00
CodeGenModule.h Refactor how attributes are set on values. 2009-04-14 08:05:55 +00:00
CodeGenTypes.cpp Propagate the ASTContext to various AST traversal and lookup functions. 2009-04-09 21:40:53 +00:00
CodeGenTypes.h Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379. 2009-04-08 02:55:55 +00:00
Makefile Build system changes to use TableGen to generate the various 2009-03-16 23:06:59 +00:00
Mangle.cpp Update to use hasAttr() instead of getAttr(). 2009-04-13 21:08:27 +00:00
Mangle.h Add support for mangling guard variables. 2009-04-13 18:02:10 +00:00
ModuleBuilder.cpp Push DeclGroup much farther throughout the compiler. Now the various 2009-03-29 16:50:03 +00:00
README.txt Add note on theoretical IRgen improvement. 2009-03-15 06:39:56 +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!

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

There are some more places where we could avoid generating unreachable code. For
example:
  void f0(int a) { abort(); if (a) printf("hi"); }
still generates a call to printf. This doesn't occur much in real
code, but would still be nice to clean up.

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

Deferred generation of statics incurs some additional
overhead. Currently it is even possible to construct test cases with
O(N^2) behavior! For at least simple cases where we can tell a global
is used, it is probably not worth deferring it. This doesn't solve the
O(N^2) cases, ,though...

PR3810

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