/[projet1]/public/pc/tools/osdk/main/compiler/sources/gen.c
Defence Force logotype

Diff of /public/pc/tools/osdk/main/compiler/sources/gen.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1513 by dbug, Sat Apr 13 12:10:31 2019 UTC revision 1514 by dbug, Sat Apr 20 13:05:10 2019 UTC
# Line 16  Line 16 
16   * This 6502 backend aims to be kept as simple as possible by introducing an   * This 6502 backend aims to be kept as simple as possible by introducing an
17   * intermediate language of macros, so that most of the time, there's a one to   * intermediate language of macros, so that most of the time, there's a one to
18   * one correspondence between the Operator Nodes passed by the frontend and   * one correspondence between the Operator Nodes passed by the frontend and
19   * the macros emitted by the backend. Recently, I added a graph output feature   * the macros emitted by the backend. However, lcc's frontend was designed
20   * (-G) and renamed a little the macros to emphasize this one to one   * for working straight forward with backends for RISC processors with
21   * correspondence...   * a load/store architecture and many registers so that operations only take
22   *   * registers operand. The 6502 instead has a single register that can be used
23     * in operations whilst the second operand is in memory. So, I designed this
24     * 6502 backend to use pseudo-registers in zero-page (this seems natural),
25     * but also to propagate addressing-mode information in order to exploit
26     * some 6502 addressing modes. This way it becomes possible to optimize the
27     * generated code by combining the load/store operations provided by the
28     * frontend with the operations on pseudo-registers and/or memory.
29   */   */
30    
31    
32  char *version="/* 16-bit code V1.34 */\n";  char *version="/* 16-bit code V1.35 */\n";
33  #include "c.h"  #include "c.h"
34  #include <string.h>  #include <string.h>
35  #include <stdio.h>  #include <stdio.h>
# Line 297  void defstring(int len, char *s) { Line 303  void defstring(int len, char *s) {
303      if (graph_output) return;      if (graph_output) return;
304      while (len > 0) {      while (len > 0) {
305          if (s[0]==';' || s[0]<32 || s[0]==127) {          if (s[0]==';' || s[0]<32 || s[0]==127) {
306              print("\tDB($%x)\n",*s++);              print("\tDB($%x)\n",(unsigned char)*s++);
307              len--;              len--;
308              while (len>0 && (s[0]==';' || s[0]<32 || s[0]==127)) {              while (len>0 && (s[0]==';' || s[0]<32 || s[0]==127)) {
309                  print("\tDB($%x)\n",*s++);                  print("\tDB($%x)\n",(unsigned char)*s++);
310                  len--;                  len--;
311              }              }
312              print("\n");              print("\n");

Legend:
Removed from v.1513  
changed lines
  Added in v.1514

  ViewVC Help
Powered by ViewVC 1.1.26