Mercurial > projects > ldc
comparison gen/d-asm-i386.h @ 229:cac3d27ae481 trunk
[svn r245] initial support for labels in inline asm, broken :/
author | lindquist |
---|---|
date | Sat, 07 Jun 2008 21:31:38 +0200 |
parents | 3092a38dddab |
children | 61aa721a6b7f |
comparison
equal
deleted
inserted
replaced
228:52d1e9d27dc6 | 229:cac3d27ae481 |
---|---|
1411 insnTemplate->printf("%d", asmcode->args.dim); | 1411 insnTemplate->printf("%d", asmcode->args.dim); |
1412 asmcode->args.push( new AsmArg(type, e, mode) ); | 1412 asmcode->args.push( new AsmArg(type, e, mode) ); |
1413 } | 1413 } |
1414 | 1414 |
1415 void addLabel(unsigned n) { | 1415 void addLabel(unsigned n) { |
1416 // No longer taking the address of the actual label -- doesn't seem like it would help. | 1416 // No longer taking the address of the actual label -- doesn't seem like it would help. |
1417 char buf[64]; | 1417 char buf[64]; |
1418 | 1418 |
1419 d_format_priv_asm_label(buf, n); | 1419 d_format_priv_asm_label(buf, n); |
1420 insnTemplate->writestring(buf); | 1420 insnTemplate->writestring(buf); |
1421 } | 1421 } |
1422 | 1422 |
1423 /* Determines whether the operand is a register, memory reference | 1423 /* Determines whether the operand is a register, memory reference |
1424 or immediate. Immediate addresses are currently classified as | 1424 or immediate. Immediate addresses are currently classified as |
1425 memory. This function is called before the exact instructions | 1425 memory. This function is called before the exact instructions |
1897 if (isDollar(e)) { | 1897 if (isDollar(e)) { |
1898 unsigned lbl_num = ++d_priv_asm_label_serial; | 1898 unsigned lbl_num = ++d_priv_asm_label_serial; |
1899 addLabel(lbl_num); | 1899 addLabel(lbl_num); |
1900 asmcode->dollarLabel = lbl_num; // could make the dollar label part of the same asm.. | 1900 asmcode->dollarLabel = lbl_num; // could make the dollar label part of the same asm.. |
1901 } else if (e->op == TOKdsymbol) { | 1901 } else if (e->op == TOKdsymbol) { |
1902 LabelDsymbol * lbl = (LabelDsymbol *) ((DsymbolExp *) e)->s; | 1902 // LabelDsymbol * lbl = (LabelDsymbol *) ((DsymbolExp *) e)->s; |
1903 if (! lbl->asmLabelNum) | 1903 // if (! lbl->asmLabelNum) |
1904 lbl->asmLabelNum = ++d_priv_asm_label_serial; | 1904 // lbl->asmLabelNum = ++d_priv_asm_label_serial; |
1905 | 1905 // |
1906 use_star = false; | 1906 // use_star = false; |
1907 addLabel(lbl->asmLabelNum); | 1907 // addLabel(lbl->asmLabelNum); |
1908 use_star = false; | |
1909 addOperand("$", Arg_Pointer, e, asmcode); | |
1908 } else if ((decl && decl->isCodeseg())) { // if function or label | 1910 } else if ((decl && decl->isCodeseg())) { // if function or label |
1909 use_star = false; | 1911 use_star = false; |
1910 addOperand("*$", Arg_Pointer, e, asmcode); | 1912 addOperand("*$", Arg_Pointer, e, asmcode); |
1911 } else { | 1913 } else { |
1912 if (use_star) { | 1914 if (use_star) { |
2387 break; | 2389 break; |
2388 case TOKfloat32v: | 2390 case TOKfloat32v: |
2389 case TOKfloat64v: | 2391 case TOKfloat64v: |
2390 case TOKfloat80v: | 2392 case TOKfloat80v: |
2391 // %% need different types? | 2393 // %% need different types? |
2392 e = new RealExp(stmt->loc, token->float80value, Type::tfloat80); | 2394 if (global.params.useFP80) |
2395 e = new RealExp(stmt->loc, token->float80value, Type::tfloat80); | |
2396 else | |
2397 e = new RealExp(stmt->loc, token->float80value, Type::tfloat64); | |
2393 nextToken(); | 2398 nextToken(); |
2394 break; | 2399 break; |
2395 case TOKidentifier: | 2400 case TOKidentifier: |
2396 { | 2401 { |
2397 ident = token->ident; | 2402 ident = token->ident; |
2628 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx) | 2633 #define XEXP(RTX, N) (RTL_CHECK2 (RTX, N, 'e', 'u').rt_rtx) |
2629 #endif | 2634 #endif |
2630 | 2635 |
2631 // FIXME | 2636 // FIXME |
2632 #define HOST_WIDE_INT long | 2637 #define HOST_WIDE_INT long |
2633 bool getFrameRelativeValue(DValue* decl, HOST_WIDE_INT * result) | 2638 bool getFrameRelativeValue(LLValue* decl, HOST_WIDE_INT * result) |
2634 { | 2639 { |
2635 // FIXME | 2640 // FIXME |
2636 // // Using this instead of DECL_RTL for struct args seems like a | 2641 // // Using this instead of DECL_RTL for struct args seems like a |
2637 // // good way to get hit by a truck because it may not agree with | 2642 // // good way to get hit by a truck because it may not agree with |
2638 // // non-asm access, but asm code wouldn't know what GCC does anyway. */ | 2643 // // non-asm access, but asm code wouldn't know what GCC does anyway. */ |