carlo.bertolli added inline comments.

================
Comment at: lib/CodeGen/CGOpenMPRuntime.h:759
@@ +758,3 @@
+  ///
+  void emitForStaticInitWithKMPSchedule(CodeGenFunction &CGF,
+                                        SourceLocation Loc,
----------------
carlo.bertolli wrote:
> I added this because OpenMPScheduleClauseKind and 
> OpenMPDistScheduleClauseKind are two different unrelated types. Do you 
> suggest something like the following?
> 
> void emitForStaticInit(CodeGenFunction &CGF, SourceLocation Loc, 
> OpenMPScheduleClauseKind ScheduleKind, OpenMPDistScheduleClauseKind 
> ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, Address IL, 
> Address LB, Address UB, Address ST, llvm::Value *Chunk);
> 
> and for dist_schedule called like:
> 
> OpenMPDistScheduleClauseKind DistScheduleKind = ..;
> 
> RT.emitForStaticInit(*this, S.getLocStart(), OMPC_SCHEDULE_unknown, 
> DistScheduleKind, IVSize, IVSigned, Ordered, IL, LB, UB, ST, Chunk);
> 
> Similarly, for schedule clause:
> 
> OpenMPScheduleClauseKind ScheduleKind = ..;
> 
> RT.emitForStaticInit(*this, S.getLocStart(), ScheduleKind, 
> OMPC_DIST_SCHEDULE_unknown, IVSize, IVSigned, Ordered, IL, LB, UB, ST, Chunk);
> 
> 
Another solution is to have a generic schedule type as a union of the schedule 
and dist_schedule enum types.

```
  union OMPGenericSchedule {
    OpenMPScheduleClauseKind forSchedule;
    OpenMPDistScheduleClauseKind distributeSchedule;
  };
```

Then we can decide which case we are in as following:

```
void CGOpenMPRuntime::emitForStaticInit(CodeGenFunction &CGF,
                                        SourceLocation Loc,
                                        OMPGenericSchedule SchedKind,
                                        bool isForSchedule,
                                        unsigned IVSize, bool IVSigned,
                                        bool Ordered, Address IL, Address LB,
                                        Address UB, Address ST,
                                        llvm::Value *Chunk) {

  OpenMPSchedType Schedule = (isForSchedule) ?
      getRuntimeSchedule(SchedKind.forSchedule, Chunk != nullptr, Ordered) :
      getRuntimeSchedule(SchedKind.distributeSchedule, Chunk != nullptr);
```


Repository:
  rL LLVM

http://reviews.llvm.org/D17170



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to