[LLVMdev] String attributes for function arguments and return values

Reid Kleckner rnk at google.com
Tue Jul 14 16:48:00 PDT 2015


This sounds more like a use case for metadata. Can we attach metadata to
function arguments, or does that not work currently?

On Mon, Jul 13, 2015 at 7:42 AM, Artur Pilipenko <apilipenko at azulsystems.com
> wrote:

>  Hi,
>
>  On 13 Jul 2015, at 15:59, Hal Finkel <hfinkel at anl.gov> wrote:
>
> ----- Original Message -----
>
> From: "Artur Pilipenko" <apilipenko at azulsystems.com>
> To: llvmdev at cs.uiuc.edu
> Cc: "Hal Finkel" <hfinkel at anl.gov>
> Sent: Monday, July 13, 2015 6:45:35 AM
> Subject: String attributes for function arguments and return values
>
> Hi,
>
> I’d like to support string attributes on function arguments and
> return values. We are going to use them in our tree to express
> higher level language types.
>
>
> How do you expect to use this information? Will you need the inliner to do
> something special with these?
>
> Type information is required for Java specific optimizations, like
> devirtualization, subtype check optimizations, etc. There are no plans to
> upstream them, because they are too specific to Java.
>
>  W.r.t inlining I don’t think that these attributes will require any
> special handling.
>
>  Artur
>
>
> Thanks again,
> Hal
>
>
> Internally attributes framework have everything to do this, it’s even
> possible to generate string attributes via API right now:
> Function *function;
> function->setAttributes(function->getAttributes().addAttribute(context,
> i, "attribute"));
> But because it’s not supported in LLParser if you dump the function
> and try to parse it back it will fail. I have a patch to fix this
> problem:
> http://reviews.llvm.org/D11058
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11058&d=AwMGaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=QxcZ1dQY-4Fptsg8J_QZvUH5zX3_zJfFtYe_mFFV434&s=yDXYh5H5eycn3Yn6A7bDimwo8jVbqaGav2FdRRIz0lg&e=>
> I consider this part as a bug fix for existing functionality.
>
> The second patch is to add accessors to string attributes to Argument
> and Function classes:
> http://reviews.llvm.org/D10872
> This part is optional because there no code in upstream will make use
> of it. But if we support string attributes syntax it makes sense to
> provide API support as well.
>
> Does anyone have any objections?
>
> Thanks,
> Artur
>
>
>
>
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150714/36d973b7/attachment.html>


More information about the llvm-dev mailing list