llvm-toolchain-10/clang/lib/CodeGen
Lu zhiping 09a9a6e509 Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
..
ABIInfo.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
Address.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
BackendUtil.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGAtomic.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGBlocks.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGBlocks.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGBuilder.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGBuiltin.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCUDANV.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCUDARuntime.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCUDARuntime.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCXX.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCXXABI.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCXXABI.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCall.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCall.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGClass.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCleanup.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCleanup.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGCoroutine.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGDebugInfo.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGDebugInfo.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGDecl.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGDeclCXX.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGException.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGExpr.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGExprAgg.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGExprCXX.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGExprComplex.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGExprConstant.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGExprScalar.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGGPUBuiltin.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGLoopInfo.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGLoopInfo.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGNonTrivialStruct.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGObjC.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGObjCGNU.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGObjCMac.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGObjCRuntime.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGObjCRuntime.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGOpenCLRuntime.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGOpenCLRuntime.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGOpenMPRuntime.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGOpenMPRuntime.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGOpenMPRuntimeNVPTX.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGOpenMPRuntimeNVPTX.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGRecordLayout.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGRecordLayoutBuilder.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGStmt.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGStmtOpenMP.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGVTT.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGVTables.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGVTables.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CGValue.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CMakeLists.txt Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenABITypes.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenAction.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenFunction.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenFunction.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenModule.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenModule.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenPGO.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenPGO.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenTBAA.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenTBAA.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenTypeCache.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenTypes.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CodeGenTypes.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
ConstantEmitter.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
ConstantInitBuilder.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CoverageMappingGen.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
CoverageMappingGen.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
EHScopeStack.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
ItaniumCXXABI.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
MacroPPCallbacks.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
MacroPPCallbacks.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
MicrosoftCXXABI.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
ModuleBuilder.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
ObjectFilePCHContainerOperations.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
PatternInit.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
PatternInit.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
README.txt Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
SanitizerMetadata.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
SanitizerMetadata.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
SwiftCallingConv.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
TargetInfo.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
TargetInfo.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
VarBypassDetector.cpp Import Upstream version 10.0.0 2022-07-16 17:39:34 +08:00
VarBypassDetector.h Import Upstream version 10.0.0 2022-07-16 17:39:34 +08: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!

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