* 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.
Unified · Split
| @@ -72,12 +72,6 @@ ST_DATA void *rt_prog_main; · 71 unmodified lines | ||
| 72 | 72 | #endif /* ALL_IN_ONE */ |
| 73 | 73 | |
| 74 | 74 | /********************************************************/ |
| 75 | −#ifndef CONFIG_TCC_ASM_LABEL | |
| 76 | −ST_FUNC void asm_label_instr(CString *) | |
| 77 | −{ | |
| 78 | − error("inline asm() not supported"); | |
| 79 | −} | |
| 80 | −#endif | |
| 81 | 75 | #ifndef CONFIG_TCC_ASM |
| 82 | 76 | ST_FUNC void asm_instr(void) |
| 83 | 77 | { |
| @@ -122,7 +122,6 @@ · 121 unmodified lines | ||
| 122 | 122 | #if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_C67) |
| 123 | 123 | #define CONFIG_TCC_ASM |
| 124 | 124 | #endif |
| 125 | −#define CONFIG_TCC_ASM_LABEL | |
| 126 | 125 | |
| 127 | 126 | /* object format selection */ |
| 128 | 127 | #if defined(TCC_TARGET_C67) |
| @@ -1073,6 +1072,7 @@ ST_FUNC int type_size(CType *type, int *a); · 944 unmodified lines | ||
| 1073 | 1072 | ST_FUNC void mk_pointer(CType *type); |
| 1074 | 1073 | ST_FUNC void vstore(void); |
| 1075 | 1074 | ST_FUNC void inc(int post, int c); |
| 1075 | +ST_FUNC void parse_asm_str(CString *astr); | |
| 1076 | 1076 | ST_FUNC int lvalue_type(int t); |
| 1077 | 1077 | ST_FUNC void indir(void); |
| 1078 | 1078 | ST_FUNC void unary(void); |
| @@ -1196,7 +1196,6 @@ ST_FUNC int tcc_load_coff(TCCState * s1, int fd); · 117 unmodified lines | ||
| 1196 | 1196 | |
| 1197 | 1197 | /* ------------ tccasm.c ------------ */ |
| 1198 | 1198 | ST_FUNC void asm_instr(void); |
| 1199 | −ST_FUNC void asm_label_instr(CString *); | |
| 1200 | 1199 | ST_FUNC void asm_global_instr(void); |
| 1201 | 1200 | |
| 1202 | 1201 | #ifdef CONFIG_TCC_ASM |
| @@ -18,8 +18,6 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | −#ifdef CONFIG_TCC_ASM | |
| 22 | − | |
| 23 | 21 | #include "tcc.h" |
| 24 | 22 | |
| 25 | 23 | ST_FUNC int asm_get_local_label_name(TCCState *s1, unsigned int n) |
| @@ -993,37 +991,6 @@ static void parse_asm_operands(ASMOperand *operands, int *nb_operands_ptr, · 967 unmodified lines | ||
| 993 | 991 | } |
| 994 | 992 | } |
| 995 | 993 | |
| 996 | −#endif | |
| 997 | − | |
| 998 | −static void parse_asm_str(CString *astr) | |
| 999 | −{ | |
| 1000 | − skip('('); | |
| 1001 | − /* read the string */ | |
| 1002 | − if (tok != TOK_STR) | |
| 1003 | − expect("string constant"); | |
| 1004 | − cstr_new(astr); | |
| 1005 | − while (tok == TOK_STR) { | |
| 1006 | − /* XXX: add \0 handling too ? */ | |
| 1007 | − cstr_cat(astr, tokc.cstr->data); | |
| 1008 | − next(); | |
| 1009 | − } | |
| 1010 | − cstr_ccat(astr, '\0'); | |
| 1011 | −} | |
| 1012 | − | |
| 1013 | −/* Parse an asm label and return the label | |
| 1014 | − * Don't forget to free the CString in the caller! */ | |
| 1015 | −static void asm_label_instr(CString *astr) | |
| 1016 | −{ | |
| 1017 | − next(); | |
| 1018 | − parse_asm_str(astr); | |
| 1019 | − skip(')'); | |
| 1020 | −#ifdef ASM_DEBUG | |
| 1021 | − printf("asm_alias: \"%s\"\n", (char *)astr->data); | |
| 1022 | −#endif | |
| 1023 | −} | |
| 1024 | − | |
| 1025 | −#ifdef CONFIG_TCC_ASM | |
| 1026 | − | |
| 1027 | 994 | /* parse the GCC asm() instruction */ |
| 1028 | 995 | ST_FUNC void asm_instr(void) |
| 1029 | 996 | { |
| @@ -1154,5 +1121,3 @@ ST_FUNC void asm_global_instr(void) · 124 unmodified lines | ||
| 1154 | 1121 | |
| 1155 | 1122 | cstr_free(&astr); |
| 1156 | 1123 | } |
| 1157 | − | |
| 1158 | −#endif | |
| @@ -2991,6 +2991,33 @@ static inline void convert_parameter_type(CType *pt) · 2990 unmodified lines | ||
| 2991 | 2991 | } |
| 2992 | 2992 | } |
| 2993 | 2993 | |
| 2994 | +ST_FUNC void parse_asm_str(CString *astr) | |
| 2995 | +{ | |
| 2996 | + skip('('); | |
| 2997 | + /* read the string */ | |
| 2998 | + if (tok != TOK_STR) | |
| 2999 | + expect("string constant"); | |
| 3000 | + cstr_new(astr); | |
| 3001 | + while (tok == TOK_STR) { | |
| 3002 | + /* XXX: add \0 handling too ? */ | |
| 3003 | + cstr_cat(astr, tokc.cstr->data); | |
| 3004 | + next(); | |
| 3005 | + } | |
| 3006 | + cstr_ccat(astr, '\0'); | |
| 3007 | +} | |
| 3008 | + | |
| 3009 | +/* Parse an asm label and return the label | |
| 3010 | + * Don't forget to free the CString in the caller! */ | |
| 3011 | +static void asm_label_instr(CString *astr) | |
| 3012 | +{ | |
| 3013 | + next(); | |
| 3014 | + parse_asm_str(astr); | |
| 3015 | + skip(')'); | |
| 3016 | +#ifdef ASM_DEBUG | |
| 3017 | + printf("asm_alias: \"%s\"\n", (char *)astr->data); | |
| 3018 | +#endif | |
| 3019 | +} | |
| 3020 | + | |
| 2994 | 3021 | static void post_type(CType *type, AttributeDef *ad) |
| 2995 | 3022 | { |
| 2996 | 3023 | int n, l, t1, arg_size, align; |
| @@ -5325,7 +5352,7 @@ ST_FUNC void decl(int l) · 2328 unmodified lines | ||
| 5325 | 5352 | Sym *sym; |
| 5326 | 5353 | AttributeDef ad; |
| 5327 | 5354 | |
| 5328 | − /* | |
| 5355 | + /* | |
| 5329 | 5356 | * type.ref must be either a valid reference or NULL for external_sym to |
| 5330 | 5357 | * work. As type = btype is executed before external_sym is call, setting |
| 5331 | 5358 | * btype.ref to 0 is enough. |