Home   News   Concept   AMIGA-Compatible   Hardware   Forum   Questions+Answers   Pictures   Contact & Team

Welcome to the Natami / Amiga Forum

This forum is for AMIGA fans interested in the new NATAMI platform.
Please read the forum usage manual.



All TopicsNewsQAFeaturesTalkTEAMLogin to post    Create account
Welcome to the Natami lounge.
Meet new AMIGA friends here and enjoy having a friendly chit chat.

C Compilers for the Amiga
Marcel Verdaasdonk
Netherlands

Posts 3979
01 Dec 2011 23:37


Which compiler supports the most amiga functions and libraries?

Anyone heard of DICE?

Thomas Richter
Germany
(MX-Board Owner)
Posts 1425
01 Dec 2011 23:41


Marcel Verdaasdonk wrote:

Which compiler supports the most amiga functions and libraries?

They all support the same, you can always build the necessary files from the Amiga .fd files. Some might create less comfortable calls for those functions that require tags, i.e. they might require the tags as a pointer argument rather than putting the tags right into the function call.

Marcel Verdaasdonk wrote:

  Anyone heard of DICE?

Yes. Though I don't remember its quality. I had experience with Aztec, Lattice (then SAS), and gcc.


Jakob Eriksson
Sweden
(Moderator)
Posts 1097
01 Dec 2011 23:57


I tried DICE just for fun as a cross compiler on Linux, and it seemed to be quite fine. Don't know how good code it generates, but the compiler felt rather modern. Try it, it's open source.

Team Chaos Leader
USA
(Moderator)
Posts 2094
02 Dec 2011 00:21


Marcel Verdaasdonk wrote:

Which compiler supports the most amiga functions and libraries?

SASC is the most Amigatized C compiler.
SASC supports many groovy features such as
__near
__far
__chip
__stack
stackused()
allocsa()
Real debugger that works in C, Asm, or both, locally or over the serial port (remote debugging).

Lots of other Amigatized features.  RTFM :) for more details.

And you can easily call asm functions using a NORMAL calling interface, not that wacked out antifriendly user-hostile gcc abomination.

SASC FTW!


Olaf Schoenweiss
Germany

Posts 782
02 Dec 2011 09:31


Dice is opensource and in Aminet

I have here the list of 68k languages:
EXTERNAL LINK 
and here text-editors:
EXTERNAL LINK

Marcel Verdaasdonk
Netherlands

Posts 3979
02 Dec 2011 09:44


I have the source of DICE i was asking because i wanted to know the pro's and cons against some of the other available compilers.

Jakob Eriksson
Sweden
(Moderator)
Posts 1097
02 Dec 2011 13:13


GCC is GCC, if you are porting stuff chances are much higher it works with GCC than any other compiler.

Ceti 331
United Kingdom

Posts 282
02 Dec 2011 13:34


Generally curious here.
From my experience using MS's compiler (xbox360 not x86) and gcc,  it seemed GCC was better at keeping temporaries in registers. My guess was, that having spent so long on a multitude of RISC platforms, gcc must have been better at thinking of local variables as registers whereas the MS compiler sharing code with their x86 source base (?) must have been much more Stack based, with register caching an awkward retrofit.
(it did get better with time).
I always recalled guidelines on using 'leaf' functions in C on the R-series cpu's with their lovely 32 reg file. (under certain conditions, last function call could be done with no memory access)

So how did 68k compilers fare? what sort of calling conventions did they use exactly ?
As a CISC machine, but nonetheless with quite a healthy register file, how well did they fare with the decisions about what to place on the stack.
with c++ would it keep a 'this' pointer permanently in reg between function calls

I never used C on the amiga, but I do recall seeing some syntax for specific register allocation in ancient listings (perhaps the earliest compilers were purely stack based and you had to hint it)

Thomas Richter
Germany
(MX-Board Owner)
Posts 1425
02 Dec 2011 20:42


ceti 331 wrote:

  From my experience using MS's compiler (xbox360 not x86) and gcc,  it seemed GCC was better at keeping temporaries in registers. My guess was, that having spent so long on a multitude of RISC platforms, gcc must have been better at thinking of local variables as registers whereas the MS compiler sharing code with their x86 source base (?) must have been much more Stack based, with register caching an awkward retrofit.

This is at least true for gcc 2.95, it somehow changed afterwards because gcc was more and more optimized to the x86. And it will probably change again now that AMD64 added more registers and has a more orthogonal instruction set.

Back in Amiga times, the gcc back then was really pretty good in optimizing code, often better than the SAS/C. It just didn't fit well into the Amiga architecture such as it used its own object code format (no hunks) its own linker (no ALink or BLink), so the whole toolchain was based on ix and not on Amiga. But the code was fine, really.

ceti 331 wrote:

  I always recalled guidelines on using 'leaf' functions in C on the R-series cpu's with their lovely 32 reg file. (under certain conditions, last function call could be done with no memory access)
 
  So how did 68k compilers fare? what sort of calling conventions did they use exactly ?

It was always good to write small compact functions so compilers could keep all locals in the registers. Calling conventions differed, depending on the compiler settings. The early versions used all a stack-based calling convention, then SAS/C in rev.6 changed that offering a convention where the first two integers were passed in d0,d1 and the first two pointers in a0,a1. Return values were always in d0, for MathIEEE floats in d0/d1.

For the later SAS/C, you also had the option to specify the registers where you would want the arguments in, for calling assembly functions.

ceti 331 wrote:

  As a CISC machine, but nonetheless with quite a healthy register file, how well did they fare with the decisions about what to place on the stack.
  with c++ would it keep a 'this' pointer permanently in reg between function calls.

There was never really a C++ compiler for the Amiga. SAS/C came with some early C++-ish type of dialect that worked entirely on the basis of a C++ to C compiler, and hence the compiler back-end did not know anything about "this". The gcc 2.95 did support some "kind of" C++ as well, with many bugs (but not as many as the SAS/C had), and as far as I remembered, didn't keep "this" special in any way.

It is typically not required, either, to have a fixed-wired convention. Let just the optimizer to the job, it will figure out (hopefully) that "this" is the most-used pointer in the member function and place it in a register accordingly.

ceti 331 wrote:

  I never used C on the amiga, but I do recall seeing some syntax for specific register allocation in ancient listings (perhaps the earliest compilers were purely stack based and you had to hint it)

Those were compiler-specific extensions, actually. C doesn't have this, of course.


R. Leffmann
Sweden

Posts 16
03 Dec 2011 14:49


I use VBCC. Portable and neat, very easy to compile and use, and is actively developed.

EXTERNAL LINK 

Matt Hey
USA

Posts 735
03 Dec 2011 16:44


R. Leffmann wrote:

  I use VBCC. Portable and neat, very easy to compile and use, and is actively developed.
 

 
  VBCC is getting better. The latest version has better C99 support and better 68k optimization although not as good as GCC 2.95.3 or the last SAS/C.
 
  + better use of post and pre indexed modes (helps loops)
  + better use of memory to memory copies (helps loops)
  + uses moveq to a register and then op to that register
  + good use of data registers as data registers
  + good use of address registers as address registers
  + uses registers for intermediate values (not just variables)
  + uses include files with inlined assembler as default
  + handles a6 library base register well
  + uses stack instead of stack frame as default (faster and smaller)
  + awesome peephole optimizer in vasm and soon to get better ;)
 
  - some of the 68k compiler link libs code is less than spectacular
  - 68000 code ends up in 68020+ executable like ext.w d0 + ext.l d0
  - movem used with 1 register (some cases get optimized by vasm)
  - jump tables can still be messed up (no crash but big and slow)
  - address registers under used for general purposes
  - constant data not kept in a register for small loops
  - complex addressing modes are used often in loops
  - no use of advanced instructions like bit fields or rtd
  - dead code elimination still doesn't work completely
 
  VBCC is Amiga friendly. It has support for Amiga hunk executables, chip data, small data, IEEE math libraries, resident code, etc. It installs easily with an Amiga installer script. Many people are disappointed by the GCC compatibility and speed of the compiler though.

I don't use "register" variables. Most Amiga compilers do a good job selecting the variables to put in registers until they run out. It does help to create temporary variables in many cases that can be registered (by the compiler) if used several times and a function or loop is not very complex. This is especially helpful with some versions of GCC.


posts 11