Hello,

For cmake I'd recommend looking at the https://cmake.org/ documentation --
that should give you an overview. We're using cmake with Gollvm since it's
the system used by LLVM.  If you aren't familiar with building and testing
LLVM, that's a good place to start reading, since gollvm is intended to use
the same infrastructure.

In terms of the plumbing and the data flow, let's say that gollvm is
compiling a package "xyz" with two Go source files "xyz.go" and
"xyzconst.go". The sequence of events looks like the following (on the left
is the action taking place, on the right is the location of the code doing
the action, and time increases as you move down the page)

          +----------------------------------+
          | code: llvm/tools/gollvm/driver   |
          |                                  |
          | actions:                         |
          | parse command line options       |
          | locate input files               |
          | general setup                    |
          +----------------------------------+
                         |
                         | list of files to parse
                         | xyz.go xyzconst.go
                         V
          +------------------------------------+
          | code: llvm/tools/gollvm/gofrontend |
          |                                    |
          | actions:                           |
          | parsing, type checking, lowering   |
          | escape analysis, etc               |
          |                                    |
          +------------------------------------+
                         |
                         | sequence of calls
                         | into Backend interface
                         V
          +------------------------------------+
          | code: llvm/tools/gollvm/bridge     |
          |                                    |
          | actions:                           |
          | receive Backend calls and          |
          | generate LLVM IR to implement them |
          |                                    |
          +------------------------------------+
                         |
                         | LLVM IR for xyz package
                         V
          +----------------------------------+
          | code: llvm/tools/gollvm/driver   |
          |                                  |
          | actions:                         |
          | setup LLVM pass pipeline         |
          | kick off LLVM backend            |
          +----------------------------------+
                         |
                         | assembly source
                         V
                       assembler
                       produces xyz.o object file

Hope this helps. A lot of the other things in the gollvm source tree are
built for use in the Go runtime and standard packages. This includes things
in llvm/tools/gollvm/gofrontend/libgo, as well as libffi and libbacktrace.

Hope this helps. If you have specific questions I can try to offer more
focused explanations.

Than


On Tue, Jun 25, 2019 at 11:41 AM eric fang <fangshuimin...@gmail.com> wrote:

> >>I'll write down a more specific list of tips and pointers to the code
>> later today; stay tuned.
>>
>
> Hi Than, I'm also very interested in this work and look forward to your
> update.
>
>  I'm reading the gollvm code, but I haven't figured out the relationship
> between the various modules (llvm, gofrontend, libbacktrace, libffi ... ) ,
> and the direction of the data flow and control flow. I was also confused by
> cmake.
> Could you give me a general introduction about how gollvm combines these
> components and compile, assemble, and link go source files as an executable
> ? I think this will help me have a holistic understanding of the entire
> gollm project. Thanks !
>
> In the process of looking at the code, I found that I spent a lot of time
> in the gofrontend project. For enabling arm64, is there some work to do in
> this sub-project?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/76979ef8-a194-49a2-974e-0753d4247d58%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/76979ef8-a194-49a2-974e-0753d4247d58%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2BUr55Gd8ejginJn21nDE-ah3uCZarxrKz2urqEJ5qu%3DDBNWcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to