Mail Archives: djgpp/1994/10/10/04:16:13
> main()
> {
> long a = 10, b = 20, c = 0;
>
> c = a + b;
> }
>
> When compiled with borland using "bcc -S -3 tst.c" the output was:
>
> mov dword ptr [bp-4],large 10
> mov dword ptr [bp-8],large 20
> mov dword ptr [bp-12],large 0
> mov eax,dword ptr [bp-4]
> add eax,dword ptr [bp-8]
> mov dword ptr [bp-12],eax
>
> The assembler syntax is different, but it looks like they both use
> 32 bit registers for 32 bit integers. Notice however that Borland C 3.1
> uses bp (16 bits) to hold a *pointer*, while djgpp uses ebp (32 bits).
This fragment may mislead someone to think that BC produces essentually the
same code GCC does. The truth is, there is nothing farther from the reality
than this conclusion. The above context shows just about everything BC
can do with 32-bit code, which is use 32-bit registers for add/subtract
instead of add/adc pair of instructions it uses without -3 command-line
switch. The big loss is the fact it won't place a far pointer into a
register even under -3. I even think it won't use 32-bit registers for
register variables, even in the above context (but I'm not sure).
Eli Zaretskii
- Raw text -