From: SourceForge.net <no...@so...> - 2009-07-07 10:56:54
|
Bugs item #2817223, was opened at 2009-07-06 05:02 Message generated for change (Comment added) made by wek_ You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2817223&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: C-Front End Group: non bugs Status: Closed Resolution: Rejected Priority: 5 Private: No Submitted By: martin white (kensenjiha) Assigned to: Maarten Brock (maartenbrock) Summary: too many slocs in DSEG Initial Comment: sdcc 2.9.0 too many slocs in DSEG, even ///////////////////////////////// example code: void taskAIBufferExecute(void) { static data char ch = 0; data float tx, ty; tx = (float)ADCRead(ch); ty = tx * 3.123898E-5 + x[ch][0] * 1.2495591E-4 + x[ch][1] * 1.8743388E-4 + x[ch][2] * 1.2495591E-4 + x[ch][3] * 3.123898E-5 + y[ch][0] * 3.5897338 - y[ch][1] * 4.851276 + y[ch][2] * 2.9240527 - y[ch][3] * 0.6630105; ... sdcc --model-large ///////////////////////////////// lst file: 440 ;-------------------------------------------------------- 441 ; internal ram data 442 ;-------------------------------------------------------- 443 .area DSEG (DATA) 0000 444 _DIOBufferR:: 0000 445 .ds 8 0008 446 _GetAnalogI_fResult_1_1: 0008 447 .ds 4 000C 448 _GetAnalogI_x_1_1: 000C 449 .ds 4 0010 450 _GetAnalogI_xn_1_1: 0010 451 .ds 4 0014 452 _taskAIBufferExecute_ch_1_1: 0014 453 .ds 1 0015 454 _taskAIBufferExecute_tx_1_1: 0015 455 .ds 4 0019 456 _taskAIBufferExecute_ty_1_1: 0019 457 .ds 4 001D 458 _taskAIBufferExecute_sloc0_1_0: 001D 459 .ds 4 0021 460 _taskAIBufferExecute_sloc1_1_0: 0021 461 .ds 4 0025 462 _taskAIBufferExecute_sloc2_1_0: 0025 463 .ds 4 0029 464 _taskAIBufferExecute_sloc3_1_0: 0029 465 .ds 4 002D 466 _taskAIBufferExecute_sloc4_1_0: 002D 467 .ds 4 0031 468 _taskAIBufferExecute_sloc5_1_0: 0031 469 .ds 4 0035 470 _taskAIBufferExecute_sloc6_1_0: 0035 471 .ds 4 0039 472 _taskAIBufferExecute_sloc7_1_0: 0039 473 .ds 4 003D 474 _taskAIBufferExecute_sloc8_1_0: 003D 475 .ds 4 0041 476 _taskAIBufferExecute_sloc9_1_0: 0041 477 .ds 4 0045 478 _taskAIBufferExecute_sloc10_1_0: 0045 479 .ds 4 0049 480 _taskAIBufferExecute_sloc11_1_0: 0049 481 .ds 4 004D 482 _taskAIBufferExecute_sloc12_1_0: 004D 483 .ds 4 0051 484 _taskDIOBufferExecute_cAddrI2C_1_1: 0051 485 .ds 1 ---------------------------------------------------------------------- Comment By: wek (wek_) Date: 2009-07-07 12:56 Message: But, Maarten, while it is undoubtedly true that floating point arithmetic is memory intensive, I see no reason for this expression to use more than two intermediate (potentially spill) variables. Indeed, trying to compile a function containing this expression, SDCC invariably produces only one spill variable (4 bytes). So, there must be something else in the original function which produces the excessive spill. And that might, or might not, reveal a bug in the compiler. That's why I ask the OP to post a complete program to be able to reproduce his findings. JW ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2009-07-07 12:24 Message: Floating point calculations are difficult for an 8051, requiring many registers. Writing such complicated calculations makes it even worse. So the compiler needs many spil locations for intermediate results. And then it is bound to run out of memory. I recommend to split it up so that it uses only one multiplication and one addition per instruction. ---------------------------------------------------------------------- Comment By: wek (wek_) Date: 2009-07-07 08:06 Message: Can you please post a complete program demonstrating the problem? Jan Waclawek ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=100599&aid=2817223&group_id=599 |