aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
AgeCommit message (Collapse)AuthorFilesLines
2016-04-28[OPENMP] Simplified interface for codegen of tasks, NFC.Alexey Bataev1-12/+3
Reduced number of arguments in member functions of runtime support library for task-based directives. llvm-svn: 267863
2016-04-27[OPENMP] Fix for codegen of captured variables in inlined directives.Alexey Bataev1-0/+5
Currently there is a problem with codegen of inlined directives inside lambdas, it may cause a crash during codegen because of incorrect capturing of variables. Patch fixes this problem. llvm-svn: 267677
2016-04-25[OPENMP 4.5] Codegen for 'taskloop' directive.Alexey Bataev1-0/+20
The taskloop construct specifies that the iterations of one or more associated loops will be executed in parallel using OpenMP tasks. The iterations are distributed across tasks created by the construct and scheduled to be executed. The next code will be generated for the taskloop directive: #pragma omp taskloop num_tasks(N) lastprivate(j) for( i=0; i<N*GRAIN*STRIDE-1; i+=STRIDE ) { int th = omp_get_thread_num(); #pragma omp atomic counter++; #pragma omp atomic th_counter[th]++; j = i; } Generated code: task = __kmpc_omp_task_alloc(NULL,gtid,1,sizeof(struct task),sizeof(struct shar),&task_entry); psh = task->shareds; psh->pth_counter = &th_counter; psh->pcounter = &counter; psh->pj = &j; task->lb = 0; task->ub = N*GRAIN*STRIDE-2; task->st = STRIDE; __kmpc_taskloop( NULL, // location gtid, // gtid task, // task structure 1, // if clause value &task->lb, // lower bound &task->ub, // upper bound STRIDE, // loop increment 0, // 1 if nogroup specified 2, // schedule type: 0-none, 1-grainsize, 2-num_tasks N, // schedule value (ignored for type 0) (void*)&__task_dup_entry // tasks duplication routine ); llvm-svn: 267395
2016-04-22[OPENMP] Fix for LCV in simd directives in explicit clauses.Alexey Bataev1-1/+13
If loop control variable for simd-based directives is explicitly marked as linear/lastprivate in clauses, codegen for such construct would crash. Patch fixes this problem. llvm-svn: 267101
2016-04-08revert SVN r265702, r265640Saleem Abdulrasool1-1/+1
Revert the two changes to thread CodeGenOptions into the TargetInfo allocation and to fix the layering violation by moving CodeGenOptions into Basic. Code Generation is arguably not particularly "basic". This addresses Richard's post-commit review comments. This change purely does the mechanical revert and will be followed up with an alternate approach to thread the desired information into TargetInfo. llvm-svn: 265806
2016-04-07Basic: move CodeGenOptions from FrontendSaleem Abdulrasool1-1/+1
This is a mechanical move of CodeGenOptions from libFrontend to libBasic. This fixes the layering violation introduced earlier by threading CodeGenOptions into TargetInfo. It should also fix the modules based self-hosting builds. NFC. llvm-svn: 265702
2016-04-06NFC: make AtomicOrdering an enum classJF Bastien1-2/+4
Summary: See LLVM change D18775 for details, this change depends on it. Reviewers: jyknight, reames Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18776 llvm-svn: 265569
2016-04-04IRGen-level lowering for the Swift calling convention.John McCall1-2/+2
llvm-svn: 265324
2016-03-29[OPENMP] Allow runtime insert its own code inside OpenMP regions.Alexey Bataev1-0/+7
Solution unifies interface of RegionCodeGenTy type to allow insert runtime-specific code before/after main codegen action defined in CGStmtOpenMP.cpp file. Runtime should not define its own RegionCodeGenTy for general OpenMP directives, but must be allowed to insert its own (required) code to support target specific codegen. llvm-svn: 264700
2016-03-28Revert "[OPENMP] Allow runtime insert its own code inside OpenMP regions."Alexey Bataev1-7/+0
Reverting because of failed tests. llvm-svn: 264577
2016-03-28[OPENMP] Allow runtime insert its own code inside OpenMP regions.Alexey Bataev1-0/+7
Solution unifies interface of RegionCodeGenTy type to allow insert runtime-specific code before/after main codegen action defined in CGStmtOpenMP.cpp file. Runtime should not define its own RegionCodeGenTy for general OpenMP directives, but must be allowed to insert its own (required) code to support target specific codegen. llvm-svn: 264576
2016-03-28Revert "[OPENMP] Allow runtime insert its own code inside OpenMP regions."Alexey Bataev1-7/+0
This reverts commit 3ee791165100607178073f14531a0dc90c622b36. llvm-svn: 264570
2016-03-28[OPENMP] Allow runtime insert its own code inside OpenMP regions.Alexey Bataev1-0/+7
Solution unifies interface of RegionCodeGenTy type to allow insert runtime-specific code before/after main codegen action defined in CGStmtOpenMP.cpp file. Runtime should not define its own RegionCodeGenTy for general OpenMP directives, but must be allowed to insert its own (required) code to support target specific codegen. llvm-svn: 264569
2016-03-21Revert "Convert some ObjC msgSends to runtime calls."Pete Cooper1-6/+2
This reverts commit r263607. This change caused more objc_retain/objc_release calls in the IR but those are then incorrectly optimized by the ARC optimizer. Work is going to have to be done to ensure the ARC optimizer doesn't optimize user written RR, but that should land before this change. This change will also need to be updated to take account for any changes required to ensure that user written calls to RR are distinct from those inserted by ARC. llvm-svn: 263984
2016-03-16Convert some ObjC msgSends to runtime calls.Pete Cooper1-2/+6
It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions. This patch adds support for converting messages to retain/release/alloc/autorelease to their equivalent runtime calls. Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions. Reviewed by John McCall. Differential Revision: http://reviews.llvm.org/D14737 llvm-svn: 263607
2016-03-10EmitCXXStructorCall -> EmitCXXDestructorCall. NFC.Alexey Samsonov1-5/+4
This function is only used in Microsoft ABI and only to emit destructors. Rename/simplify it accordingly. llvm-svn: 263081
2016-03-09[OPENMP 4.5] Codegen for data members in 'linear' clauseAlexey Bataev1-1/+3
OpenMP 4.5 allows privatization of non-static data members in OpenMP constructs. Patch adds proper codegen support for data members in 'linear' clause llvm-svn: 263003
2016-03-07Reapply r262741 [OPENMP] Codegen for distribute directiveCarlo Bertolli1-0/+8
This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling. http://reviews.llvm.org/D17170 llvm-svn: 262832
2016-03-04Revert r262741 - [OPENMP] Codegen for distribute directiveSamuel Antao1-8/+0
Was causing a failure in one of the buildbot slaves. llvm-svn: 262744
2016-03-04[OPENMP] Codegen for distribute directiveCarlo Bertolli1-0/+8
This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling. http://reviews.llvm.org/D17170 llvm-svn: 262741
2016-03-03Add code generation for teams directive inside target regionCarlo Bertolli1-0/+2
llvm-svn: 262652
2016-03-01[MSVC Compat] Correctly handle finallys nested within finallysDavid Majnemer1-4/+3
We'd lose track of the parent CodeGenFunction, leading us to get confused with regard to which function a nested finally belonged to. Differential Revision: http://reviews.llvm.org/D17752 llvm-svn: 262379
2016-02-24Add whole-program vtable optimization feature to Clang.Peter Collingbourne1-1/+7
This patch introduces the -fwhole-program-vtables flag, which enables the whole-program vtable optimization feature (D16795) in Clang. Differential Revision: http://reviews.llvm.org/D16821 llvm-svn: 261767
2016-02-16[OPENMP] Improved handling of pseudo-captured expressions in OpenMP.Alexey Bataev1-1/+1
Expressions inside 'schedule'|'dist_schedule' clause must be captured in combined directives to avoid possible crash during codegen. Patch improves handling of such constructs llvm-svn: 260954
2016-02-04[PGO] cc1 option name change for profile instrumentationRong Xu1-1/+1
This patch changes cc1 option -fprofile-instr-generate to an enum option -fprofile-instrument={clang|none}. It also changes cc1 options -fprofile-instr-generate= to -fprofile-instrument-path=. The driver level option -fprofile-instr-generate and -fprofile-instr-generate= remain intact. This change will pave the way to integrate new PGO instrumentation in IR level. Review: http://reviews.llvm.org/D16730 llvm-svn: 259811
2016-02-04[OPENMP 4.0] Fixed support of array sections/array subscripts.Alexey Bataev1-0/+4
Codegen for array sections/array subscripts worked only for expressions with arrays as base. Patch fixes codegen for bases with pointer/reference types. llvm-svn: 259776
2016-02-03[OpenMP] Parsing + sema for target parallel for directive.Arpith Chacko Jacob1-0/+2
Summary: This patch adds parsing + sema for the target parallel for directive along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16759 llvm-svn: 259654
2016-01-27Emit calls to objc_unsafeClaimAutoreleasedReturnValue whenJohn McCall1-0/+6
reclaiming a call result in order to ignore it or assign it to an __unsafe_unretained variable. This avoids adding an unwanted retain/release pair when the return value is not actually returned autoreleased (e.g. when it is returned from a nonatomic getter or a typical collection accessor). This runtime function is only available on the latest Apple OS releases; the backwards-compatibility story is that you don't get the optimization unless your deployment target is recent enough. Sorry. rdar://20530049 llvm-svn: 258962
2016-01-26[OpenMP] Parsing + sema for target parallel directive.Arpith Chacko Jacob1-0/+1
Summary: This patch adds parsing + sema for the target parallel directive and its clauses along with testcases. Reviewers: ABataev Differential Revision: http://reviews.llvm.org/D16553 Rebased to current trunk and updated test cases. llvm-svn: 258832
2016-01-26[OPENMP 4.5] Allow arrays in 'reduction' clause.Alexey Bataev1-0/+2
OpenMP 4.5, alogn with array sections, allows to use variables of array type in reductions. llvm-svn: 258804
2016-01-25[cfi] Cross-DSO CFI diagnostic mode (clang part)Evgeniy Stepanov1-2/+7
* Runtime diagnostic data for cfi-icall changed to match the rest of cfi checks * Layout of all CFI diagnostic data changed to put Kind at the beginning. There is no ABI stability promise yet. * Call cfi_slowpath_diag instead of cfi_slowpath when needed. * Emit __cfi_check_fail function, which dispatches a CFI check faliure according to trap/recover settings of the current module. * A tiny driver change to match the way the new handlers are done in compiler-rt. llvm-svn: 258745
2016-01-23[CUDA] Make printf work.Justin Lebar1-0/+2
Summary: The code in CGCUDACall is largely based on a patch written by Eli Bendersky: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140324/210218.html That patch implemented an LLVM pass lowering printf to vprintf; this one does something similar, but in Clang codegen. Reviewers: echristo Subscribers: cfe-commits, jhen, tra, majnemer Differential Revision: http://reviews.llvm.org/D16372 llvm-svn: 258642
2016-01-21[OPENMP] Fix crash on reduction for complex variables.Alexey Bataev1-0/+2
reworked codegen for reduction operation for complex types to avoid crash llvm-svn: 258394
2016-01-19[OpenMP] Parsing + sema for "target exit data" directive.Samuel Antao1-0/+1
Patch by Arpith Jacob. Thanks! llvm-svn: 258177
2016-01-19[OpenMP] Parsing + sema for "target enter data" directive.Samuel Antao1-0/+1
Patch by Arpith Jacob. Thanks! llvm-svn: 258165
2016-01-16Introduce -fsanitize-stats flag.Peter Collingbourne1-0/+3
This is part of a new statistics gathering feature for the sanitizers. See clang/docs/SanitizerStats.rst for further info and docs. Differential Revision: http://reviews.llvm.org/D16175 llvm-svn: 257971
2015-12-31[OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic ↵Alexey Bataev1-5/+5
modifiers. OpenMP 4.5 adds support for monotonic/nonmonotonic modifiers in 'schedule' clause. Add codegen for these modifiers. llvm-svn: 256666
2015-12-15Cross-DSO control flow integrity (Clang part).Evgeniy Stepanov1-0/+5
Clang-side cross-DSO CFI. * Adds a command line flag -f[no-]sanitize-cfi-cross-dso. * Links a runtime library when enabled. * Emits __cfi_slowpath calls is bitset test fails. * Emits extra hash-based bitsets for external CFI checks. * Sets a module flag to enable __cfi_check generation during LTO. This mode does not yet support diagnostics. llvm-svn: 255694
2015-12-14Add parse and sema of OpenMP distribute directive with all clauses except ↵Carlo Bertolli1-0/+1
dist_schedule llvm-svn: 255498
2015-12-12Update clang to use the updated LLVM EH instructionsDavid Majnemer1-3/+5
Depends on D15139. Reviewers: rnk Differential Revision: http://reviews.llvm.org/D15140 llvm-svn: 255423
2015-12-09Revert r255001, "Add parse and sema for OpenMP distribute directive and all ↵NAKAMURA Takumi1-1/+0
its clauses excluding dist_schedule." It causes memory leak. Some tests in test/OpenMP would fail. llvm-svn: 255094
2015-12-08Add parse and sema for OpenMP distribute directive and all its clauses ↵Carlo Bertolli1-0/+1
excluding dist_schedule. llvm-svn: 255001
2015-12-03[OPENMP 4.5] Parsing/sema support for 'omp taskloop simd' directive.Alexey Bataev1-0/+1
OpenMP 4.5 adds directive 'taskloop simd'. Patch adds parsing/sema analysis for 'taskloop simd' directive and its clauses. llvm-svn: 254597
2015-12-02Add the `pass_object_size` attribute to clang.George Burgess IV1-0/+18
`pass_object_size` is our way of enabling `__builtin_object_size` to produce high quality results without requiring inlining to happen everywhere. A link to the design doc for this attribute is available at the Differential review link below. Differential Revision: http://reviews.llvm.org/D13263 llvm-svn: 254554
2015-12-02[OpenMP] Update target directive codegen to use 4.5 implicit data mappings.Samuel Antao1-5/+2
Summary: This patch implements the 4.5 specification for the implicit data maps. OpenMP 4.5 specification changes the default way data is captured into a target region. All the non-aggregate kinds are passed by value by default. This required activating the capturing by value during SEMA for the target region. All the non-aggregate values that can be encoded in the size of a pointer are properly casted and forwarded to the runtime library. On top of fixing the previous weird behavior for mapping pointers in nested data regions (an explicit map was always required), this also improves performance as the number of allocations/transactions to the device per non-aggregate map are reduced from two to only one - instead of passing a reference and the value, only the value passed. Explicit maps will be added later on once firstprivate, private, and map clauses' SEMA and parsing are available. Reviewers: hfinkel, rjmccall, ABataev Subscribers: cfe-commits, carlo.bertolli Differential Revision: http://reviews.llvm.org/D14940 llvm-svn: 254521
2015-12-01[OPENMP 4.5] Parsing/sema analysis for 'taskloop' directive.Alexey Bataev1-0/+1
Adds initial parsing and semantic analysis for 'taskloop' directive. llvm-svn: 254367
2015-11-23CodeGenFunction.h: Prune a \param in r253926. [-Wdocumentation]NAKAMURA Takumi1-3/+0
llvm-svn: 253938
2015-11-23Preserve exceptions information during calls code generation.Samuel Antao1-6/+4
This patch changes the generation of CGFunctionInfo to contain the FunctionProtoType if it is available. This enables the code generation for call instructions to look into this type for exception information and therefore generate better quality IR - it will not create invoke instructions for functions that are know not to throw. llvm-svn: 253926
2015-11-12In preparation to use it in more places renameEric Christopher1-3/+1
checkBuiltinTargetFeatures to checkTargetFeatures and sink the error handling into the function. llvm-svn: 252832
2015-11-11Extract out a function onto CodeGenModule for getting the map ofEric Christopher1-0/+2
features for a particular function, then use it to clean up some code. llvm-svn: 252819