1 /*-------------------------------------------------------------------------
2 SDCCgen.h - header file for target code generation common functions
4 Copyright (C) 2012, Borut Razem
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 -------------------------------------------------------------------------*/
26 #include <SDCCicode.h>
28 #define initGenLineElement() memset (&genLine.lineElement, 0, sizeof (lineElem_t))
29 #define labelKey2num(key) ((key) + 100)
31 /* can be inherited by each port */
32 typedef struct asmLineNodeBase
40 typedef struct lineElem_s
44 unsigned int isInline
:1;
45 unsigned int isComment
:1;
46 unsigned int isDebug
:1;
47 unsigned int isLabel
:1;
48 unsigned int visited
:1;
53 typedef struct lineNode_s
55 #ifdef UNNAMED_STRUCT_TAG
58 /* exactly the same members as of struct lineElem_s */
61 unsigned int isInline
:1;
62 unsigned int isComment
:1;
63 unsigned int isDebug
:1;
64 unsigned int isLabel
:1;
65 unsigned int visited
:1;
68 struct lineNode_s
*prev
;
69 struct lineNode_s
*next
;
73 typedef struct genLine_s
75 /* double linked list of lines */
80 lineElem_t lineElement
;
83 extern genLine_t genLine
;
89 lineNode
*newLineNode (const char *line
);
90 lineNode
*connectLine (lineNode
* pl1
, lineNode
* pl2
);
91 void destroy_line_list (void);
92 const char *format_opcode (const char *inst
, const char *fmt
, va_list ap
);
93 void emit_raw (const char *line
);
94 void va_emitcode (const char *inst
, const char *fmt
, va_list ap
);
95 void emitcode (const char *inst
, const char *fmt
, ...);
96 void emitLabel (const symbol
* tlbl
);
97 void genInline (iCode
* ic
);
98 void printLine (lineNode
*, struct dbuf_s
*);
99 iCode
*ifxForOp (const operand
*op
, const iCode
*ic
);