Mercurial > hg > CbC > CbC_gcc
comparison gcc/go/gofrontend/README @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 See ../README. | 1 See ../README. |
2 | 2 |
3 The frontend is written in C++. | 3 The frontend is written in C++. It can only be used in conjunction |
4 with a full compiler backend. Currently the backend interface has | |
5 been implemented with GCC (known as gccgo) and with LLVM (known as | |
6 GoLLVM). | |
4 | 7 |
5 The frontend lexes and parses the input into an IR specific to this | 8 The frontend lexes and parses the input into an IR specific to this |
6 frontend known as gogo. It then runs a series of passes over the | 9 frontend known as gogo. It then runs a series of passes over the |
7 code. | 10 code. |
8 | 11 |
9 Finally it converts gogo to gcc's GENERIC. A goal is to move the gcc | 12 Finally it converts gogo to the backend IR. This is done via the |
10 support code into a gcc-interface subdirectory. The gcc code will be | 13 interface described in backend.h. The backend must implement that |
11 put under the GPL. The rest of the frontend will not include any gcc | 14 interface. When used with GCC, the interface is implemented in |
12 header files. | 15 gcc/go/go-gcc.cc. |
13 | 16 |
14 Issues to be faced in this transition: | 17 Source locations are represented using the interface described in |
18 go-linemap.h. The backend is expected to provide a header file | |
19 go-location.h that defines a Location type. | |
15 | 20 |
16 * Representation of source locations. | 21 The frontend does not start by itself. It expects something to call |
17 + Currently the frontend uses gcc's source_location codes, using the | 22 go_create_gogo passing in a Backend and a Linemap, as well as other |
18 interface in libcpp/line-map.h. | 23 options. Then it expects something to call go_parse_input_files |
24 passing in the input files. Finally, a call to go_write_globals will | |
25 cause all global definitions to be written out via the Backend | |
26 interface. | |
19 | 27 |
20 * Handling of error messages. | 28 The backend is expected to provide the functions defined at the |
21 + Currently the frontend uses gcc's error_at and warning_at | 29 bottom of go-diagnostics.h: go_be_error_at, etc. These will be used |
22 functions. | 30 for error messages. |
23 + Currently the frontend uses gcc's diagnostic formatter, using | |
24 features such as %<%> for appropriate quoting. | |
25 + Localization may be an issue. | |
26 | 31 |
27 This compiler works, but the code is a work in progress. Notably, the | 32 This compiler works, but the code is a work in progress. The frontend |
28 support for garbage collection is ineffective and needs a complete | 33 pays little attention to its memory usage and rarely frees any memory. |
29 rethinking. The frontend pays little attention to its memory usage | 34 The code could use a general cleanup which we have not had time to do. |
30 and rarely frees any memory. The code could use a general cleanup | |
31 which we have not had time to do. | |
32 | 35 |
33 Contributing | 36 Contributing |
34 ============= | 37 ============= |
35 | 38 |
36 To contribute patches to the files in this directory, please see | 39 To contribute patches to the files in this directory, please see |
37 http://golang.org/doc/gccgo_contribute.html . | 40 https://golang.org/doc/gccgo_contribute.html . |
38 | 41 |
39 The master copy of these files is hosted at | 42 The master copy of these files is hosted at |
40 http://code.google.com/p/gofrontend . Changes to these files require | 43 https://go.googlesource.com/gofrontend . There is a mirror at |
44 https://github.com/golang/gofrontend . Changes to these files require | |
41 signing a Google contributor license agreement. If you are the | 45 signing a Google contributor license agreement. If you are the |
42 copyright holder, you will need to agree to the individual contributor | 46 copyright holder, you will need to agree to the individual contributor |
43 license agreement at | 47 https://cla.developers.google.com/about/google-individual . This |
44 http://code.google.com/legal/individual-cla-v1.0.html. This agreement | 48 agreement can be completed online. |
45 can be completed online. | |
46 | 49 |
47 If your organization is the copyright holder, the organization will | 50 If your organization is the copyright holder, the organization will |
48 need to agree to the corporate contributor license agreement at | 51 need to agree to the corporate contributor license agreement at |
49 http://code.google.com/legal/corporate-cla-v1.0.html. | 52 https://cla.developers.google.com/about/google-corporate . |
50 | 53 |
51 If the copyright holder for your code has already completed the | 54 If the copyright holder for your code has already completed the |
52 agreement in connection with another Google open source project, it | 55 agreement in connection with another Google open source project, it |
53 does not need to be completed again. | 56 does not need to be completed again. |