ubuntu-buildroot/output/build/host-gcc-initial-11.4.0/gcc/go/gofrontend
chenyf 8b0660016e 1 2024-04-01 23:19:46 +08:00
..
LICENSE 1 2024-04-01 23:19:46 +08:00
MERGE 1 2024-04-01 23:19:46 +08:00
PATENTS 1 2024-04-01 23:19:46 +08:00
README 1 2024-04-01 23:19:46 +08:00
ast-dump.cc 1 2024-04-01 23:19:46 +08:00
ast-dump.h 1 2024-04-01 23:19:46 +08:00
backend.h 1 2024-04-01 23:19:46 +08:00
embed.cc 1 2024-04-01 23:19:46 +08:00
escape.cc 1 2024-04-01 23:19:46 +08:00
escape.h 1 2024-04-01 23:19:46 +08:00
export.cc 1 2024-04-01 23:19:46 +08:00
export.h 1 2024-04-01 23:19:46 +08:00
expressions.cc 1 2024-04-01 23:19:46 +08:00
expressions.h 1 2024-04-01 23:19:46 +08:00
go-diagnostics.cc 1 2024-04-01 23:19:46 +08:00
go-diagnostics.h 1 2024-04-01 23:19:46 +08:00
go-dump.cc 1 2024-04-01 23:19:46 +08:00
go-dump.h 1 2024-04-01 23:19:46 +08:00
go-encode-id.cc 1 2024-04-01 23:19:46 +08:00
go-encode-id.h 1 2024-04-01 23:19:46 +08:00
go-linemap.h 1 2024-04-01 23:19:46 +08:00
go-optimize.cc 1 2024-04-01 23:19:46 +08:00
go-optimize.h 1 2024-04-01 23:19:46 +08:00
go-sha1.h 1 2024-04-01 23:19:46 +08:00
go.cc 1 2024-04-01 23:19:46 +08:00
gogo.cc 1 2024-04-01 23:19:46 +08:00
gogo.h 1 2024-04-01 23:19:46 +08:00
import-archive.cc 1 2024-04-01 23:19:46 +08:00
import.cc 1 2024-04-01 23:19:46 +08:00
import.h 1 2024-04-01 23:19:46 +08:00
lex.cc 1 2024-04-01 23:19:46 +08:00
lex.h 1 2024-04-01 23:19:46 +08:00
names.cc 1 2024-04-01 23:19:46 +08:00
operator.h 1 2024-04-01 23:19:46 +08:00
parse.cc 1 2024-04-01 23:19:46 +08:00
parse.h 1 2024-04-01 23:19:46 +08:00
runtime.cc 1 2024-04-01 23:19:46 +08:00
runtime.def 1 2024-04-01 23:19:46 +08:00
runtime.h 1 2024-04-01 23:19:46 +08:00
statements.cc 1 2024-04-01 23:19:46 +08:00
statements.h 1 2024-04-01 23:19:46 +08:00
string-dump.h 1 2024-04-01 23:19:46 +08:00
types.cc 1 2024-04-01 23:19:46 +08:00
types.h 1 2024-04-01 23:19:46 +08:00
unsafe.cc 1 2024-04-01 23:19:46 +08:00
wb.cc 1 2024-04-01 23:19:46 +08:00

README

See ../README.

The frontend is written in C++.  It can only be used in conjunction
with a full compiler backend.  Currently the backend interface has
been implemented with GCC (known as gccgo) and with LLVM (known as
GoLLVM).

The frontend lexes and parses the input into an IR specific to this
frontend known as gogo.  It then runs a series of passes over the
code.

Finally it converts gogo to the backend IR.  This is done via the
interface described in backend.h.  The backend must implement that
interface.  When used with GCC, the interface is implemented in
gcc/go/go-gcc.cc.

Source locations are represented using the interface described in
go-linemap.h.  The backend is expected to provide a header file
go-location.h that defines a Location type.

The frontend does not start by itself.  It expects something to call
go_create_gogo passing in a Backend and a Linemap, as well as other
options.  Then it expects something to call go_parse_input_files
passing in the input files.  Finally, a call to go_write_globals will
cause all global definitions to be written out via the Backend
interface.

The backend is expected to provide the functions defined at the
bottom of go-diagnostics.h: go_be_error_at, etc.  These will be used
for error messages.

This compiler works, but the code is a work in progress.  The frontend
pays little attention to its memory usage and rarely frees any memory.
The code could use a general cleanup which we have not had time to do.

Contributing
=============

To contribute patches to the files in this directory, please see
https://golang.org/doc/gccgo_contribute.html .

The master copy of these files is hosted at
https://go.googlesource.com/gofrontend .  There is a mirror at
https://github.com/golang/gofrontend .  Changes to these files require
signing a Google contributor license agreement.  If you are the
copyright holder, you will need to agree to the individual contributor
https://cla.developers.google.com/about/google-individual .  This
agreement can be completed online.

If your organization is the copyright holder, the organization will
need to agree to the corporate contributor license agreement at
https://cla.developers.google.com/about/google-corporate .

If the copyright holder for your code has already completed the
agreement in connection with another Google open source project, it
does not need to be completed again.