annotate gcc/go/gofrontend/README @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 See ../README.
kono
parents:
diff changeset
2
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
3 The frontend is written in C++. It can only be used in conjunction
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
4 with a full compiler backend. Currently the backend interface has
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
5 been implemented with GCC (known as gccgo) and with LLVM (known as
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
6 GoLLVM).
111
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 The frontend lexes and parses the input into an IR specific to this
kono
parents:
diff changeset
9 frontend known as gogo. It then runs a series of passes over the
kono
parents:
diff changeset
10 code.
kono
parents:
diff changeset
11
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
12 Finally it converts gogo to the backend IR. This is done via the
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
13 interface described in backend.h. The backend must implement that
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
14 interface. When used with GCC, the interface is implemented in
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
15 gcc/go/go-gcc.cc.
111
kono
parents:
diff changeset
16
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
17 Source locations are represented using the interface described in
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
18 go-linemap.h. The backend is expected to provide a header file
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
19 go-location.h that defines a Location type.
111
kono
parents:
diff changeset
20
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
21 The frontend does not start by itself. It expects something to call
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
22 go_create_gogo passing in a Backend and a Linemap, as well as other
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
23 options. Then it expects something to call go_parse_input_files
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
24 passing in the input files. Finally, a call to go_write_globals will
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
25 cause all global definitions to be written out via the Backend
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
26 interface.
111
kono
parents:
diff changeset
27
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
28 The backend is expected to provide the functions defined at the
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
29 bottom of go-diagnostics.h: go_be_error_at, etc. These will be used
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
30 for error messages.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
31
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
32 This compiler works, but the code is a work in progress. The frontend
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
33 pays little attention to its memory usage and rarely frees any memory.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
34 The code could use a general cleanup which we have not had time to do.
111
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 Contributing
kono
parents:
diff changeset
37 =============
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 To contribute patches to the files in this directory, please see
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
40 https://golang.org/doc/gccgo_contribute.html .
111
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 The master copy of these files is hosted at
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
43 https://go.googlesource.com/gofrontend . There is a mirror at
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
44 https://github.com/golang/gofrontend . Changes to these files require
111
kono
parents:
diff changeset
45 signing a Google contributor license agreement. If you are the
kono
parents:
diff changeset
46 copyright holder, you will need to agree to the individual contributor
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
47 https://cla.developers.google.com/about/google-individual . This
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
48 agreement can be completed online.
111
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 If your organization is the copyright holder, the organization will
kono
parents:
diff changeset
51 need to agree to the corporate contributor license agreement at
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
52 https://cla.developers.google.com/about/google-corporate .
111
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 If the copyright holder for your code has already completed the
kono
parents:
diff changeset
55 agreement in connection with another Google open source project, it
kono
parents:
diff changeset
56 does not need to be completed again.