Mercurial > projects > ldc
comparison gen/asm-x86-64.h @ 1101:8bf8b058944a
Clean up asm code a bit.
- Use vector instead of Array, reducing allocations.
- Use vectors instead of deques since we only push_back and index.
- Remove redundant typedefs of iterators.
- Comment out unused variable (used only in commented-out GDC code).
- A few whitespace changes.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Thu, 12 Mar 2009 14:08:57 +0100 |
parents | b3a0cf072ed0 |
children | ae950bd712d3 |
comparison
equal
deleted
inserted
replaced
1100:b3a0cf072ed0 | 1101:8bf8b058944a |
---|---|
531 /* Op_FidR_P */ { D|mem,rfp, 0, FPInt_Types, Clb_ST }, // push and pop, fild so also 64 bit | 531 /* Op_FidR_P */ { D|mem,rfp, 0, FPInt_Types, Clb_ST }, // push and pop, fild so also 64 bit |
532 /* Op_Ffd */ { D|mfp, 0, 0, FP_Types, 0, Next_Form, Op_FfdR }, // only 16bit and 32bit, DMD defaults to 16bit, reg form doesn't need type | 532 /* Op_Ffd */ { D|mfp, 0, 0, FP_Types, 0, Next_Form, Op_FfdR }, // only 16bit and 32bit, DMD defaults to 16bit, reg form doesn't need type |
533 /* Op_FfdR */ { D|rfp, 0, 0 }, | 533 /* Op_FfdR */ { D|rfp, 0, 0 }, |
534 /* Op_Ffd_P */ { D|mfp, 0, 0, FP_Types, Clb_ST, Next_Form, Op_FfdR_P }, // pop, fld so also 80 bit, " | 534 /* Op_Ffd_P */ { D|mfp, 0, 0, FP_Types, Clb_ST, Next_Form, Op_FfdR_P }, // pop, fld so also 80 bit, " |
535 /* Op_FfdR_P */ { D|rfp, 0, 0, 0, Clb_ST, Next_Form, Op_FfdRR_P }, | 535 /* Op_FfdR_P */ { D|rfp, 0, 0, 0, Clb_ST, Next_Form, Op_FfdRR_P }, |
536 /* Op_FfdRR_P */ { D|mfp|rfp,rfp,0, 0, Clb_ST }, | 536 /* Op_FfdRR_P */ { D|mfp|rfp,rfp,0, 0, Clb_ST }, |
537 /* Op_Fd_P */ { D|mem, 0, 0, 0, Clb_ST }, // " | 537 /* Op_Fd_P */ { D|mem, 0, 0, 0, Clb_ST }, // " |
538 /* Op_FdST */ { D|rfp, 0, 0 }, | 538 /* Op_FdST */ { D|rfp, 0, 0 }, |
539 /* Op_FMath */ { mfp, 0, 0, FP_Types, Clb_ST, Next_Form, Op_FMath0 }, // and only single or double prec | 539 /* Op_FMath */ { mfp, 0, 0, FP_Types, Clb_ST, Next_Form, Op_FMath0 }, // and only single or double prec |
540 /* Op_FMath0 */ { 0, 0, 0, 0, Clb_ST, Next_Form, Op_FMath2 }, // pops | 540 /* Op_FMath0 */ { 0, 0, 0, 0, Clb_ST, Next_Form, Op_FMath2 }, // pops |
541 /* Op_FMath2 */ { D|rfp, rfp, 0, 0, Clb_ST, Next_Form, Op_FdST0ST1 }, // and only single or double prec | 541 /* Op_FMath2 */ { D|rfp, rfp, 0, 0, Clb_ST, Next_Form, Op_FdST0ST1 }, // and only single or double prec |
542 /* Op_FdSTiSTi */ { D|rfp, rfp, 0, }, | 542 /* Op_FdSTiSTi */ { D|rfp, rfp, 0, }, |
543 /* Op_FdST0ST1 */ { 0, 0, 0, }, | 543 /* Op_FdST0ST1 */ { 0, 0, 0, }, |
544 /* Op_FPMath */ { D|rfp, rfp, 0, 0, Clb_ST, Next_Form, Op_F0_P }, // pops | 544 /* Op_FPMath */ { D|rfp, rfp, 0, 0, Clb_ST, Next_Form, Op_F0_P }, // pops |
545 /* Op_FCmp */ { mfp, 0, 0, FP_Types, 0, Next_Form, Op_FCmp1 }, // DMD defaults to float ptr | 545 /* Op_FCmp */ { mfp, 0, 0, FP_Types, 0, Next_Form, Op_FCmp1 }, // DMD defaults to float ptr |
546 /* Op_FCmp1 */ { rfp, 0, 0, 0, 0, Next_Form, Op_0 }, | 546 /* Op_FCmp1 */ { rfp, 0, 0, 0, 0, Next_Form, Op_0 }, |
1675 } | 1675 } |
1676 } | 1676 } |
1677 else | 1677 else |
1678 { | 1678 { |
1679 insnTemplate->writestring ( ( char* ) fmt ); | 1679 insnTemplate->writestring ( ( char* ) fmt ); |
1680 insnTemplate->printf ( "<<%s%d>>", ( mode==Mode_Input ) ?"in":"out", asmcode->args.dim ); | 1680 insnTemplate->printf ( "<<%s%d>>", ( mode==Mode_Input ) ?"in":"out", asmcode->args.size() ); |
1681 asmcode->args.push ( new AsmArg ( type, e, mode ) ); | 1681 asmcode->args.push_back ( AsmArg ( type, e, mode ) ); |
1682 } | 1682 } |
1683 } | 1683 } |
1684 void addOperand2 ( const char * fmtpre, const char * fmtpost, AsmArgType type, Expression * e, AsmCode * asmcode, AsmArgMode mode = Mode_Input ) | 1684 void addOperand2 ( const char * fmtpre, const char * fmtpost, AsmArgType type, Expression * e, AsmCode * asmcode, AsmArgMode mode = Mode_Input ) |
1685 { | 1685 { |
1686 assert ( !sc->func->naked ); | 1686 assert ( !sc->func->naked ); |
1687 insnTemplate->writestring ( ( char* ) fmtpre ); | 1687 insnTemplate->writestring ( ( char* ) fmtpre ); |
1688 insnTemplate->printf ( "<<%s%d>>", ( mode==Mode_Input ) ?"in":"out", asmcode->args.dim ); | 1688 insnTemplate->printf ( "<<%s%d>>", ( mode==Mode_Input ) ?"in":"out", asmcode->args.size() ); |
1689 insnTemplate->writestring ( ( char* ) fmtpost ); | 1689 insnTemplate->writestring ( ( char* ) fmtpost ); |
1690 asmcode->args.push ( new AsmArg ( type, e, mode ) ); | 1690 asmcode->args.push_back ( AsmArg ( type, e, mode ) ); |
1691 } | 1691 } |
1692 | 1692 |
1693 void addLabel ( char* id ) | 1693 void addLabel ( char* id ) |
1694 { | 1694 { |
1695 insnTemplate->writestring ( sc->func->mangle() ); | 1695 insnTemplate->writestring ( sc->func->mangle() ); |