[Openmp-dev] [llvm-dev] How to get the function definition of a kmpc_micro call

Dounia Khaldi via Openmp-dev openmp-dev at lists.llvm.org
Sun Jul 31 09:18:50 PDT 2016


Thanks Arpith for this pointer but it did not contain what I was looking
for.

However, I solved my issue by finding that the BitCastInst used when
outlining OpenMP parallel region offers a method for retrieving the
original value within the bitcast via stripPointerCasts().

So what I did to retrieve omp_outlined..45 is:

//bitcast is the third argument of __kmpc_fork_call
Value *vcall = callInst->getArgOperand(2);
//This will return the outlined function in __kmpc_fork_call
Function *f = dyn_cast<Function>(vcall->stripPointerCasts());

f->getName returns ".omp_outlined..45"  So this worked.

Thanks again,
Dounia

On Sat, Jul 30, 2016 at 6:47 PM, Arpith C Jacob <acjacob at us.ibm.com> wrote:

> Hi Dounia,
>
> I work on the NVPTX OpenMP codegen support and we don't use fork() but I
> can point you to where you may be able to find this information.
>
> In the clang sources, have a look at: lib/CodeGen/CGOpenMPRuntime.cpp and
> the function createRuntimeFunction where the call to __kmpc_fork_call() is
> created. The type of the outlined function can be had through the function:
> getKmpc_MicroPointerTy(). Is this what you are looking for?
>
> Regards,
> Arpith
>
> "Openmp-dev" <openmp-dev-bounces at lists.llvm.org> wrote on 07/30/2016
> 12:38:09 PM:
>
> > From: via Openmp-dev <openmp-dev at lists.llvm.org>
> > To: Dounia Khaldi <khaldi.dounia at gmail.com>, openmp-dev at lists.llvm.org
> > Cc: llvmdev at cs.uiuc.edu
> > Date: 07/30/2016 12:38 PM
> > Subject: Re: [Openmp-dev] [llvm-dev] How to get the function
> > definition of a kmpc_micro call
> > Sent by: "Openmp-dev" <openmp-dev-bounces at lists.llvm.org>
>
> >
> > Adding openmp-dev list.
> >
> > 30 июля 2016 г., в 5:09, Dounia Khaldi via llvm-dev <
> llvm-dev at lists.llvm.org
> > > написал(а):
>
> > Hello,
> >
> > The third argument of the OpenMP runtime call __kmpc_fork_call is
> > the outlined function resulting from omp parallel directive; this is
> > of type kmpc_micro. I can get this argument as an LLVM value by
> > using (callInst->getArgOperand...), but once I get this value, i am
> > stuck in knowing its class type. An example of this value can be:
> > void (i32*, i32*, ...)* bitcast (void (i32*, i32*, double**,
> > double**, double**, double**, double**, double*, i32*, double*,
> > double*, i32**, double**, i32**, double*)* @.omp_outlined..45 to
> > void (i32*, i32*, ...)*)
> >
> > I tried bitcast instruction, instruction, function call and did not work.
> >
> > Is there  a clean way (other than manipulating strings) to get the
> > defintion of the outlined function from the call  __kmpc_fork_call?
> > By clean I mean where I can manipulate IR and LLVM methods (and not
> > compare strings).
> >
> > Thanks in advance for any help,
> >
> >
> > --
> > Dounia KHALDI
> > Research Assistant Professor
> > Institute for Advanced Computational Science
> > Stony Brook University
> > Stony Brook, NY 11794-5250
> > www.iacs.stonybrook.edu
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> > _______________________________________________
> > Openmp-dev mailing list
> > Openmp-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>
>


-- 
Dounia KHALDI
Research Assistant Professor
Institute for Advanced Computational Science
Stony Brook University
Stony Brook, NY 11794-5250
www.iacs.stonybrook.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20160731/1de4765a/attachment.html>


More information about the Openmp-dev mailing list