Email list just for front end developers?

If anyone is creating it… I’d be happy to join.

It might be better for the llvm-team also (fewer non llvm-dev emails) and for us front-end users/developers (even though is interesting, fewer main team discussions emails).

Hi Perry,

I’ve noticed that requests for help by people like me who are developing front ends are often lost in the noise in the llvm-dev list. Although LLVM is a wonderful and very productive framework, I’ve found that getting help on my front end has been very difficult, and learning necessary detail about the APIs and the like is often very, very challenging. Perhaps it would be good to set up a mailing list just for front end developers to provide mutual assistance to one another?

I think that it would be fine to post such questions on llvm-dev; if we tag them with, say [frontend-dev], then people that aren’t interested can filter them out easily enough. This would have the effect of allowing us to have a “separate” mailing list/community while also having the benefit of not fragmenting the mailing list.

That way we would not have to bother people working on optimizers or the back end with our stupid beginner questions, but there would still be a place to go to get assistance.

People shouldn’t be worried about asking beginner questions. Maybe we can tag beginner questions with [beginner] as well? That way people interested in helping beginners can quickly find such questions as well. (It would also probably increase the confidence of newcomers posting on the list.)

We could even add a list of standard tags to the mailing list pages. For example, https://lists.llvm.org/mailman/listinfo/llvm-dev could also include a list of common tags to add to emails.

It might also be nice to have a Wiki. I’ve learned a bunch of things about how to use the APIs over the last weeks as I’ve been fighting with the code, but I don’t really have any good place to share the information I’ve learned with other people, so others can’t learn from my experience. Some of the things I figured out took hours of work to figure out, and it would be nice to document them so other people don’t have to do the same thing.

Please write down everything that confuses you! Even write out a blog post or something! I’d personally be very interested in seeing what you’ve learned/what’s confused you.

  • Jessica

So in writing this, I want to emphasize, in advance, that I'm grateful
to the LLVM team for having created LLVM, I do not feel I am in any
way entitled to anyone else's help, etc. The purpose of my original
post was just to suggest that there be a way for people who are
struggling with some parts of the APIs to find each other and answer
each other's questions. If any of the following sounds like I'm
demanding anything, that's not my intent. This may be longer than it
should be, too.

> I'm still unclear about what sorts of questions/discussion this
> audience is interested in. Can you provide a few examples of
> questions that might be asked, or links to discussions/blog posts
> on the net that exemplify the type of thing that you would want to
> happen in the "frontend authors using LLVM" medium you are thinking
> of?
>
> For example, looking at the post you linked (
> http://lists.llvm.org/pipermail/llvm-dev/2017-March/111526.html the
> author of which is in this thread I think, hi!), there's not much
> LLVM-specific about it. In order to generate LLVM IR, it is
> necessary to understand its semantics. The semantics are mostly
> C-like, and so the answer to questions like those in the post:
>
> - How to assign a text to a string variable?
> - How to access for example the 4th element in a heap-allocated
> array?
> - How to create local variables which are not part of the global
> scope?
> - How to create complex structures like classes and objects?
>
> is basically "how would you do it in C"?

I think you're missing the import of his questions. This isn't "how
you would do it in C". He's asking effectively how to use the
IRBuilder APIs to do these things, not what in principle you want the
machine to do or what you might write into a file of text form IR if
you were bypassing the IRBuilder.

The "how do I construct a string constant in the API" one cost me
hours to figure out until someone on IRC took pity on me, which was
unusual, and steered me to the right call (CreateGlobalString).

Now I know what you're thinking. "Why didn't you just look for
something like CreateGlobalString to begin with?" And the answer is,
because I had no idea what I was looking for, what form it would take,
or what it was called, and googling at random wasn't helping. I knew
what sort of IR output I wanted but I didn't know how to generate it
in the API.

And yes, a naive newcomer can literally spend hours trying to figure
out that just one call they wanted was CreateGlobalString. Maybe I
missed the part of the extant documentation or the tutorial that
pointed there, but that's kind of the point, isn't it? If it was
there, I didn't find it, and I needed to ask for help.

If you remember, can you explain what process you were using to try to find
out how to do it? Also, if you remember / have IRC logs, it would be useful
to see how you posed the question. I'm guessing that you didn't actually
phrase it like "does IRBuilder have a method that creates a global string
constant?" since if I go to
http://llvm.org/docs/doxygen/html/classllvm_1_1IRBuilder.html and search
for "string" that's basically the first result, and you would have found it
yourself in that case.

Was it unclear whether IRBuilder had a helper method like that and you
would instead have to manually create a global and an array constant etc.?
One thing to keep in mind is that IRBuilder is just a helper around
lower-level IR construction calls, so you can always use the lower-level
calls (e.g. look at the the implementation of
IRBuilder::CreateGlobalString:
http://llvm.org/docs/doxygen/html/IRBuilder_8cpp_source.html#l00027 it
isn't unreasonable to directly use those API's).

I'm trying to hone in on the details of when you say "I had no idea what I
was looking for, what form it would take,or what it was called". Surely you
had some starting point, and I'd like to figure out what was missing
between that and formulating the right question, because I think getting to
the question "does IRBuilder have a method that creates a global string
constant?" is really more important than its answer, since the answer is
easy to find.

It would have been nice to have a place where I could have
dropped the question and no one would have thought twice about just
answering.

And thus, my desire for a place for mutual aid for people who are
figuring out front end stuff or who have already figured it out and
are willing to help others.

> For example, to assign text to a "string variable", you first have
> to have a struct that represents you string type, then you do some
> C-level code to manipulate that data structure.

That's not what he's asking, or at least I don't think he is. He's
asking about how to generate the right IR. He probably was looking for
CreateGlobalString and how to put it together with other stuff. His
other messages made that seem clear to someone else who had been
struggling recently with the same issues,.

> For some of the specifics of LLVM IR's SSA form (like phi nodes)
> working through the Kaleidoscope tutorial should give a feel for
> how to do it.

A feel isn't enough to write code that compiles and does the right
stuff. It gives you a tantalizing hint of what you want, but you need
more than that. The tutorial makes it all look really easy, but it
skips even a lot of details about what it is doing, and then you start
to ask questions that go slightly past the edge of the tutorial and
the answers _really_ aren't obvious.

Here's just one a of a million examples:

This example is really interesting. I'd love to hear more. I still don't
quite have a feel for exactly how to help. From this email, my general
feeling is that what is missing is not documentation about "how to do X"
(multiplied by a large number of specific things) but more general advice
about how to navigate LLVM and discover things for yourself (such as the
trick for feeding C code to Clang, then working backward to find what you
want). I.e. what's missing is more "teach a person to fish" than "give a
person a fish". Could you give a couple more examples?

in a real compiler you don't
want to just parse a number into a machine int or double or what have
you, you want to use arbitrary precision stuff that's machine
independent, and of course, LLVM has that because it needs it.

Unluckily, even once you know it is there, it takes a while to figure
out what you need to use it, and there's very little documentation at
all. There was a point where I wanted to just punt and let the APFloat
API parse a string from my front end's scanner (after all, why
duplicate that code and less well?), only there's no documentation on
what sorts of float formats it parses. If someone could have answered
that, or if there had been a paragraph or two in the doxygen output,
it would have saved me lots of time reading code. As it was, the best
someone had to suggest to me was read the tests, so I went off and
slogged through. (And yah, it turns out that it handles a variety of
standard C-like formats including hex floats, which was something I
wanted to figure out but couldn't just read in the doxygen docs
because it isn't there.)

To be fair, I don't think that any LLVM developer would have very much more
of a clue (possibly not even the person who wrote it) without doing
essentially what you did (stare at the current code / tinker with it).

That being said, I'm obligated to ask: did you send a patch updating the
doxygen docs to have the information you were originally looking for?
For issues in our doxygen documentation, sending patches to llvm-commits
fixing them is 100% the right way to go.

-- Sean Silva

Hi Perry,

I've noticed that requests for help by people like me who are developing
front ends are often lost in the noise in the llvm-dev list. Although LLVM
is a wonderful and very productive framework, I’ve found that getting help
on my front end has been very difficult, and learning necessary detail
about the APIs and the like is often very, very challenging. Perhaps it
would be good to set up a mailing list just for front end developers to
provide mutual assistance to one another?

I think that it would be fine to post such questions on llvm-dev; if we
tag them with, say [frontend-dev], then people that aren’t interested can
filter them out easily enough. This would have the effect of allowing us to
have a “separate” mailing list/community while *also* having the benefit of
not fragmenting the mailing list.

Using tags is a really good idea! For example, lld and compiler-rt use tags
to differentiate themselves on the llvm mailing lists, and there's a lot of
benefit to not having the mailing list fragmented.

-- Sean Silva

Hi,