aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorThomas Preud'homme <thomas.preudhomme@celest.fr>2010-09-14 19:17:39 +0200
committerThomas Preud'homme <thomas.preudhomme@celest.fr>2010-09-14 23:21:15 +0200
commitb8adf0090e984d93b6fb3af635fedbbbebfa92e4 (patch)
tree501865bea4cbbfad336af9b7221e001c0b264bd0 /tccgen.c
parent2596273fce52e1f9db1b03d495537614fd56cef5 (diff)
downloadtinycc-b8adf0090e984d93b6fb3af635fedbbbebfa92e4.tar.gz
tinycc-b8adf0090e984d93b6fb3af635fedbbbebfa92e4.tar.bz2
Move asm label functions from tccasm.c to tccgen.c
* Move functions parse_asm_str and asm_label_instr from tccasm.c to tccgen.c * Remove CONFIG_TCC_ASM_LABEL macro as asm label are available on all archs. See: http://lists.nongnu.org/archive/html/tinycc-devel/2010-09/msg00026.html for the rationale.
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/tccgen.c b/tccgen.c
index 656c334..ce7a420 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2991,6 +2991,33 @@ static inline void convert_parameter_type(CType *pt)
}
}
+ST_FUNC void parse_asm_str(CString *astr)
+{
+ skip('(');
+ /* read the string */
+ if (tok != TOK_STR)
+ expect("string constant");
+ cstr_new(astr);
+ while (tok == TOK_STR) {
+ /* XXX: add \0 handling too ? */
+ cstr_cat(astr, tokc.cstr->data);
+ next();
+ }
+ cstr_ccat(astr, '\0');
+}
+
+/* Parse an asm label and return the label
+ * Don't forget to free the CString in the caller! */
+static void asm_label_instr(CString *astr)
+{
+ next();
+ parse_asm_str(astr);
+ skip(')');
+#ifdef ASM_DEBUG
+ printf("asm_alias: \"%s\"\n", (char *)astr->data);
+#endif
+}
+
static void post_type(CType *type, AttributeDef *ad)
{
int n, l, t1, arg_size, align;
@@ -5325,7 +5352,7 @@ ST_FUNC void decl(int l)
Sym *sym;
AttributeDef ad;
- /*
+ /*
* type.ref must be either a valid reference or NULL for external_sym to
* work. As type = btype is executed before external_sym is call, setting
* btype.ref to 0 is enough.