History

inline asm: accept concatenated strings in constraints

This really should be handled implicitly in the preprocessor, but for now this is enough.

Michael Matz committed 10 years ago

Commit bbce3151 parent f9423ff4 files · +8 −7Browse files

Unified · Split

4 files
  1. tcc.h +1 −0
  2. tccasm.c +5 −5
  3. tccgen.c +1 −1
  4. tests/tcctest.c +1 −1
tcc.h+1−0
@@ -1283,6 +1283,7 @@ ST_FUNC int type_size(CType *type, int *a); · 1282 unmodified lines
1283ST_FUNC void mk_pointer(CType *type);1283ST_FUNC void mk_pointer(CType *type);
1284ST_FUNC void vstore(void);1284ST_FUNC void vstore(void);
1285ST_FUNC void inc(int post, int c);1285ST_FUNC void inc(int post, int c);
1286ST_FUNC void parse_mult_str (CString *astr, const char *msg);
1286ST_FUNC void parse_asm_str(CString *astr);1287ST_FUNC void parse_asm_str(CString *astr);
1287ST_FUNC int lvalue_type(int t);1288ST_FUNC int lvalue_type(int t);
1288ST_FUNC void indir(void);1289ST_FUNC void indir(void);
tccasm.c+5−5
@@ -1079,6 +1079,7 @@ static void parse_asm_operands(ASMOperand *operands, int *nb_operands_ptr, · 1078 unmodified lines
1079 if (tok != ':') {1079 if (tok != ':') {
1080 nb_operands = *nb_operands_ptr;1080 nb_operands = *nb_operands_ptr;
1081 for(;;) {1081 for(;;) {
1082 CString astr;
1082 if (nb_operands >= MAX_ASM_OPERANDS)1083 if (nb_operands >= MAX_ASM_OPERANDS)
1083 tcc_error("too many asm operands");1084 tcc_error("too many asm operands");
1084 op = &operands[nb_operands++];1085 op = &operands[nb_operands++];
@@ -1091,11 +1092,10 @@ static void parse_asm_operands(ASMOperand *operands, int *nb_operands_ptr, · 6 unmodified lines
1091 next();1092 next();
1092 skip(']');1093 skip(']');
1093 }1094 }
1094 if (tok != TOK_STR)1095 parse_mult_str(&astr, "string constant");
1095 expect("string constant");1096 op->constraint = tcc_malloc(astr.size);
1096 op->constraint = tcc_malloc(tokc.str.size);1097 strcpy(op->constraint, astr.data);
1097 strcpy(op->constraint, tokc.str.data);1098 cstr_free(&astr);
1098 next();
1099 skip('(');1099 skip('(');
1100 gexpr();1100 gexpr();
1101 if (is_output) {1101 if (is_output) {
tccgen.c+1−1
@@ -2982,7 +2982,7 @@ ST_FUNC void inc(int post, int c) · 2981 unmodified lines
2982 vpop(); /* if post op, return saved value */2982 vpop(); /* if post op, return saved value */
2983}2983}
2984 2984
2985static void parse_mult_str (CString *astr, const char *msg)2985ST_FUNC void parse_mult_str (CString *astr, const char *msg)
2986{2986{
2987 /* read the string */2987 /* read the string */
2988 if (tok != TOK_STR)2988 if (tok != TOK_STR)
tests/tcctest.c+1−1
@@ -2544,7 +2544,7 @@ static __inline__ __const__ unsigned int swab32(unsigned int x) · 2543 unmodified lines
2544 __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */2544 __asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
2545 "rorl $16,%0\n\t" /* swap words */2545 "rorl $16,%0\n\t" /* swap words */
2546 "xchgb %b0,%h0" /* swap higher bytes */2546 "xchgb %b0,%h0" /* swap higher bytes */
2547 :"=q" (x)2547 :"=" "q" (x)
2548 : "0" (x));2548 : "0" (x));
2549 return x;2549 return x;
2550}2550}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t