mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
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.
This commit is contained in:
parent
2596273fce
commit
b8adf0090e
6
libtcc.c
6
libtcc.c
@ -72,12 +72,6 @@ ST_DATA void *rt_prog_main;
|
|||||||
#endif /* ALL_IN_ONE */
|
#endif /* ALL_IN_ONE */
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
#ifndef CONFIG_TCC_ASM_LABEL
|
|
||||||
ST_FUNC void asm_label_instr(CString *)
|
|
||||||
{
|
|
||||||
error("inline asm() not supported");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifndef CONFIG_TCC_ASM
|
#ifndef CONFIG_TCC_ASM
|
||||||
ST_FUNC void asm_instr(void)
|
ST_FUNC void asm_instr(void)
|
||||||
{
|
{
|
||||||
|
3
tcc.h
3
tcc.h
@ -122,7 +122,6 @@
|
|||||||
#if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_C67)
|
#if !defined(TCC_TARGET_ARM) && !defined(TCC_TARGET_C67)
|
||||||
#define CONFIG_TCC_ASM
|
#define CONFIG_TCC_ASM
|
||||||
#endif
|
#endif
|
||||||
#define CONFIG_TCC_ASM_LABEL
|
|
||||||
|
|
||||||
/* object format selection */
|
/* object format selection */
|
||||||
#if defined(TCC_TARGET_C67)
|
#if defined(TCC_TARGET_C67)
|
||||||
@ -1073,6 +1072,7 @@ ST_FUNC int type_size(CType *type, int *a);
|
|||||||
ST_FUNC void mk_pointer(CType *type);
|
ST_FUNC void mk_pointer(CType *type);
|
||||||
ST_FUNC void vstore(void);
|
ST_FUNC void vstore(void);
|
||||||
ST_FUNC void inc(int post, int c);
|
ST_FUNC void inc(int post, int c);
|
||||||
|
ST_FUNC void parse_asm_str(CString *astr);
|
||||||
ST_FUNC int lvalue_type(int t);
|
ST_FUNC int lvalue_type(int t);
|
||||||
ST_FUNC void indir(void);
|
ST_FUNC void indir(void);
|
||||||
ST_FUNC void unary(void);
|
ST_FUNC void unary(void);
|
||||||
@ -1196,7 +1196,6 @@ ST_FUNC int tcc_load_coff(TCCState * s1, int fd);
|
|||||||
|
|
||||||
/* ------------ tccasm.c ------------ */
|
/* ------------ tccasm.c ------------ */
|
||||||
ST_FUNC void asm_instr(void);
|
ST_FUNC void asm_instr(void);
|
||||||
ST_FUNC void asm_label_instr(CString *);
|
|
||||||
ST_FUNC void asm_global_instr(void);
|
ST_FUNC void asm_global_instr(void);
|
||||||
|
|
||||||
#ifdef CONFIG_TCC_ASM
|
#ifdef CONFIG_TCC_ASM
|
||||||
|
35
tccasm.c
35
tccasm.c
@ -18,8 +18,6 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_TCC_ASM
|
|
||||||
|
|
||||||
#include "tcc.h"
|
#include "tcc.h"
|
||||||
|
|
||||||
ST_FUNC int asm_get_local_label_name(TCCState *s1, unsigned int n)
|
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,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static 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
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_TCC_ASM
|
|
||||||
|
|
||||||
/* parse the GCC asm() instruction */
|
/* parse the GCC asm() instruction */
|
||||||
ST_FUNC void asm_instr(void)
|
ST_FUNC void asm_instr(void)
|
||||||
{
|
{
|
||||||
@ -1154,5 +1121,3 @@ ST_FUNC void asm_global_instr(void)
|
|||||||
|
|
||||||
cstr_free(&astr);
|
cstr_free(&astr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
27
tccgen.c
27
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)
|
static void post_type(CType *type, AttributeDef *ad)
|
||||||
{
|
{
|
||||||
int n, l, t1, arg_size, align;
|
int n, l, t1, arg_size, align;
|
||||||
|
Loading…
Reference in New Issue
Block a user