llvm-project/clang/lib/CodeGen
Johannes Doerfert 095cecbe0d [OpenMP] `omp begin/end declare variant` - part 1, parsing
This is the first part extracted from D71179 and cleaned up.

This patch provides parsing support for `omp begin/end declare variant`,
as defined in OpenMP technical report 8 (TR8) [0].

A major purpose of this patch is to provide proper math.h/cmath support
for OpenMP target offloading. See PR42061, PR42798, PR42799. The current
code was developed with this feature in mind, see [1].

[0] https://www.openmp.org/wp-content/uploads/openmp-TR8.pdf
[1] https://reviews.llvm.org/D61399#change-496lQkg0mhRN

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D74941
2020-03-27 02:30:58 -05:00
..
ABIInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Address.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BackendUtil.cpp [Coroutines] Insert lifetime intrinsics even O0 is used 2020-03-24 13:41:55 +08:00
CGAtomic.cpp [OPENMP50]Add codegen for acq_rel clause in atomic|flush directives. 2020-02-07 15:05:09 -05:00
CGBlocks.cpp [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
CGBlocks.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CGBuilder.h Reapply "[IRBuilder] Virtualize IRBuilder" 2020-02-17 19:04:11 +01:00
CGBuiltin.cpp AMDGPU: Emit llvm.fshr for __builtin_amdgcn_alignbit 2020-03-23 16:51:25 -04:00
CGCUDANV.cpp [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-26 14:44:52 -04:00
CGCUDARuntime.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CGCUDARuntime.h [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-26 14:44:52 -04:00
CGCXX.cpp [Alignment][NFC] Use Align with CreateAlignedLoad 2020-01-27 10:58:36 +01:00
CGCXXABI.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
CGCXXABI.h Improve code generation for thread_local variables: 2019-09-12 20:00:24 +00:00
CGCall.cpp [CodeGen] Add an alignment attribute to all sret parameters 2020-03-24 15:31:57 -04:00
CGCall.h [CodeGen] Emit destructor calls to destruct non-trivial C struct objects 2020-03-20 18:34:22 -07:00
CGClass.cpp [CodeGen] Emit destructor calls to destruct non-trivial C struct objects 2020-03-20 18:34:22 -07:00
CGCleanup.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
CGCleanup.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CGCoroutine.cpp [Coroutines] Do not evaluate InitListExpr of a co_return 2020-03-16 12:42:44 +08:00
CGDebugInfo.cpp Revert "Allow remapping Clang module include paths" 2020-03-24 17:57:34 -07:00
CGDebugInfo.h Avoid including Module.h from ExternalASTSource.h 2020-03-11 13:37:41 -07:00
CGDecl.cpp [clang codegen] Address review comment on comment in constWithPadding. 2020-03-25 10:58:03 -07:00
CGDeclCXX.cpp Avoid Attr.h includes, CodeGen edition 2019-12-09 16:17:18 -08:00
CGException.cpp [clang] Add -fignore-exceptions 2020-02-12 09:56:18 +00:00
CGExpr.cpp Fix -fsanitize=array-bound to treat T[0] union members as flexible array 2020-03-18 15:47:24 -07:00
CGExprAgg.cpp [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-26 14:44:52 -04:00
CGExprCXX.cpp Fix "pointer is null" static analyzer warnings. NFCI. 2020-01-11 16:02:23 +00:00
CGExprComplex.cpp Fix a crash when casting _Complex and ignoring the results. 2020-01-28 13:05:56 -05:00
CGExprConstant.cpp [CodeGen] Emit destructor calls to destruct non-trivial C struct objects 2020-03-20 18:34:22 -07:00
CGExprScalar.cpp [CodeGen] Emit destructor calls to destruct compound literals 2020-03-10 14:08:28 -07:00
CGGPUBuiltin.cpp [Alignment][NFC] Use Align with CreateAlignedStore 2020-01-23 17:34:32 +01:00
CGLoopInfo.cpp Sink more Attr.h inline methods, NFC 2020-03-12 11:54:31 -07:00
CGLoopInfo.h Don't keep stale pointers to LoopInfos. 2019-08-19 13:37:41 +00:00
CGNonTrivialStruct.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
CGObjC.cpp Relax the rules around objc_alloc and objc_alloc_init optimizations. 2020-01-14 19:48:33 -08:00
CGObjCGNU.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
CGObjCMac.cpp Replace getAs with castAs to fix null dereference static analyzer warning. 2020-03-12 18:52:58 +00:00
CGObjCRuntime.cpp [NFC] Remove trailing space 2020-02-18 10:49:13 +08:00
CGObjCRuntime.h Implement __attribute__((objc_direct)), __attribute__((objc_direct_members)) 2019-11-18 11:48:40 -08:00
CGOpenCLRuntime.cpp Fix "pointer is null" static analyzer warning. NFCI. 2020-01-08 17:19:08 +00:00
CGOpenCLRuntime.h [OpenCL] Simplify LLVM IR generated for OpenCL blocks 2019-02-21 11:02:10 +00:00
CGOpenMPRuntime.cpp [OpenMP] `omp begin/end declare variant` - part 1, parsing 2020-03-27 02:30:58 -05:00
CGOpenMPRuntime.h [OPENMP50]Add basic codegen support for ancestor device modifier. 2020-03-18 17:53:18 -04:00
CGOpenMPRuntimeNVPTX.cpp [OpenMP] `omp begin/end declare variant` - part 1, parsing 2020-03-27 02:30:58 -05:00
CGOpenMPRuntimeNVPTX.h [OPENMP50]Full handling of atomic_default_mem_order in requires 2020-02-11 15:42:34 -05:00
CGRecordLayout.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CGRecordLayoutBuilder.cpp P0840R2: support for [[no_unique_address]] attribute 2019-06-20 20:44:45 +00:00
CGStmt.cpp [OPENMP50]Initial support for scan directive. 2020-03-20 07:58:15 -04:00
CGStmtOpenMP.cpp [OPENMP50]Bassic support for exclusive clause. 2020-03-23 13:12:52 -04:00
CGVTT.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CGVTables.cpp [CodeGen] Emit destructor calls to destruct non-trivial C struct objects 2020-03-20 18:34:22 -07:00
CGVTables.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CGValue.h Move verification of Sema::MaximumAlignment to a .cpp file 2020-01-30 13:37:52 -08:00
CMakeLists.txt Generalize the pass registration mechanism used by Polly to any third-party tool 2020-01-02 16:45:31 +01:00
CodeGenABITypes.cpp Fix parameter name comments using clang-tidy. NFC. 2019-07-16 04:46:31 +00:00
CodeGenAction.cpp [remark][diagnostics] [codegen] Fix PR44896 2020-02-25 08:15:17 -08:00
CodeGenFunction.cpp [Clang][SVE] Parse builtin type string for scalable vectors 2020-03-15 14:34:52 +00:00
CodeGenFunction.h [ARM] Enabling range checks on Neon intrinsics' lane arguments 2020-03-19 12:07:23 +00:00
CodeGenModule.cpp [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-26 14:44:52 -04:00
CodeGenModule.h [RISCV] Passing small data limitation value to RISCV backend 2020-03-20 11:03:51 +08:00
CodeGenPGO.cpp [NFC] Fixes -Wrange-loop-analysis warnings 2020-01-01 20:01:37 +01:00
CodeGenPGO.h [CodeGenPGO] Fix shadow variable warning. NFC. 2020-03-02 15:06:34 +00:00
CodeGenTBAA.cpp Fix detection of __attribute__((may_alias)) to properly look through 2019-12-11 14:04:37 -08:00
CodeGenTBAA.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CodeGenTypeCache.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CodeGenTypes.cpp [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-26 14:44:52 -04:00
CodeGenTypes.h IRGen: Remove StructorType; thread GlobalDecl through more code. NFCI. 2019-03-22 23:05:10 +00:00
ConstantEmitter.h [CodeGen] Fix clang crash on aggregate initialization of array of labels 2019-11-28 00:59:25 +01:00
ConstantInitBuilder.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
CoverageMappingGen.cpp Avoid including FileManager.h from SourceManager.h 2020-03-11 13:53:12 -07:00
CoverageMappingGen.h Reland: [Coverage] Revise format to reduce binary size 2020-02-28 18:12:04 -08:00
EHScopeStack.h Revert "EHScopeStack::Cleanup has virtual functions so the destructor should be too." 2020-03-21 21:17:33 -07:00
ItaniumCXXABI.cpp [AIX][Frontend] C++ ABI customizations for AIX boilerplate 2020-02-24 10:26:51 -05:00
MacroPPCallbacks.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MacroPPCallbacks.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MicrosoftCXXABI.cpp [NFC] Let mangler accept GlobalDecl 2020-03-07 23:51:41 -05:00
ModuleBuilder.cpp reland "[DebugInfo] Support to emit debugInfo for extern variables" 2019-12-22 18:28:50 -08:00
ObjectFilePCHContainerOperations.cpp [Alignment][Clang][NFC] Add CharUnits::getAsAlign 2019-10-03 13:00:29 +00:00
PatternInit.cpp Avoid ASTContext.h -> TargetInfo.h dep 2020-02-27 14:35:00 -08:00
PatternInit.h Variable auto-init: also auto-init alloca 2019-04-12 00:11:27 +00:00
README.txt
SanitizerMetadata.cpp Avoid SourceManager.h include in RawCommentList.h, add missing incs 2020-02-27 13:49:40 -08:00
SanitizerMetadata.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SwiftCallingConv.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TargetInfo.cpp [Hexagon] Add support for Linux/Musl ABI (part 2) 2020-03-26 17:19:46 -05:00
TargetInfo.h [cuda][hip] Add CUDA builtin surface/texture reference support. 2020-03-26 14:44:52 -04:00
VarBypassDetector.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
VarBypassDetector.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50: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!

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