do you know any open source C compiler for mips, in addition to gcc ? - Page 1
Forum section: electronics / general

author: legacy
author_rank: Super Contributor
timestamp: August 01, 2014, 05:36:48 pm
content: hi guysi know and use gcc for mips but i do not like it at all, i guess if an other open source C compiler is existing in addition to gcc.do you know any ?i used SDCC for tiny 8 bit machine, such as intel 8051 core, especially dal semi 80C390/80C400, and it is great! Also its sources are well written. I HATE the GNU complexity about design and sources, so let me know.my target is a SoftCore MIPS1 (R3000 compliant)

author: rob77
author_rank: Super Contributor
timestamp: August 01, 2014, 05:46:09 pm
content: actually i'm not aware of any other usable open source compilers than the GCC family and SDCCbtw.. what's wrong with GCC ?

author: gxti
author_rank: Frequent Contributor
timestamp: August 01, 2014, 06:22:26 pm
content: It looks like Clang LLVM might have some MIPS support.

author: c4757p
author_rank: Super Contributor
timestamp: August 01, 2014, 06:31:28 pm
content: Quote from: legacy on August 01, 2014, 05:36:48 pmWhatcomplexity? GCC's codebase itself is positively huge, sure - but it's complex to use?

author: rob77
author_rank: Super Contributor
timestamp: August 01, 2014, 08:54:46 pm
content: well.... i would suggest to BUY yourself a commercial compiler for MIPS then...if GCC is such a crap , then stop using open source software , because the vast majority of the open source software is compiled with GCC.or probably you should write your own compiler if you're such an expert and you know it better how to write compilers.

author: c4757p
author_rank: Super Contributor
timestamp: August 01, 2014, 09:31:07 pm
content: Most of your gripes seem to be related to building and developing for GCC. Don't you just want touseit?

author: rob77
author_rank: Super Contributor
timestamp: August 02, 2014, 10:11:07 am
content: consuming and bitching about the quality -> that's suitable for commercial products.consuming, improving, sharing the improvements -> that's open-sourceif you know how to improve it, then share your ideas with the worlds, or eventually propose a patch/fix. bitching at some open source product will not help you.

author: snoopy
author_rank: Frequent Contributor
timestamp: August 02, 2014, 01:44:09 pm
content: Quote from: legacy on August 02, 2014, 11:45:18 amIsn't the latest PIC32 micros based on the MIPS 5000 core ?cheers

author: Bored@Work
author_rank: Super Contributor
timestamp: August 02, 2014, 01:53:42 pm
content: Quote from: legacy on August 01, 2014, 08:49:28 pmThen pay for professional support.Let's see, who owns MIPS now?Ah, Imagination Tech.What do they recommend as tools, where should you deliver your money to?Aha,http://www.imgtec.com/tools/mips-tools/points to Mentor Sourcery.What is Mentor Sourcery based on?Ups, GNU GCC.So here you have it. Don't want to mess with your own GNU compiler build? Pay Mentor to do it for you.By the way GCC was always THE MIPS compiler. Even when MIPS was still an own company they did recommended GCC, maintained the MIPS part of GCC, and even delivered an own build, then called SDE. In other words, whatever you think about GCC, it is unlikely you get a better MIPS compiler than it.

author: WarSim
author_rank: Frequent Contributor
timestamp: August 02, 2014, 02:38:02 pm
content: Interesting, You are the first person in the programming field I have heard of having these issues. I did get some info from between the rants, I'll ask some past colleagues still working about them if I get the chance. Just because I find this interesting.

author: zapta
author_rank: Super Contributor
timestamp: August 02, 2014, 02:39:02 pm
content: We got the point. The universe owes you a compiler for your liking.

author: c4757p
author_rank: Super Contributor
timestamp: August 02, 2014, 02:43:39 pm
content: If I were having a whole bunch of show-stopping problems with a well-established piece of software that's generally liked, I'd start to consider a PEBCAK.Hmm... if only other compilers were as "shitty" as GCC. *frowns at Microchip's xc8*

author: AlfBaz
author_rank: Super Contributor
timestamp: August 02, 2014, 02:45:39 pm
content: Microsoft have a mips C/C++ compiler as part of their suite of "Compilers for Smart Devices"http://msdn.microsoft.com/en-us/library/bb187718(v=vs.80).aspxI have no idea howshitit is

author: nctnico
author_rank: Super Contributor
timestamp: August 02, 2014, 03:06:18 pm
content: Quote from: c4757p on August 02, 2014, 02:43:39 pmOnly a couple of billion devices (including set-top boxes with MIPS processors) run software compiled with GCC so GCC must be shit

author: andersm
author_rank: Super Contributor
timestamp: August 02, 2014, 03:07:36 pm
content: Quote from: snoopy on August 02, 2014, 01:44:09 pmPIC32MX uses the M4K core, PIC32MZ uses M14K (or "microAptiv").

author: dannyf
author_rank: Super Contributor
timestamp: August 02, 2014, 03:23:33 pm
content: QuoteI would suggest that you focus on finding a compiler that works for you, be it open source or otherwise.Unless philosophical arguments are more important to you.

author: Bored@Work
author_rank: Super Contributor
timestamp: August 02, 2014, 04:06:36 pm
content: Lets see. You decided to use a MIPS soft core. Now you have great pains finding a compiler that suits your royal highness. Wouldn't the choice of a MIPS softcore count as a self inflicting wound? A Court Martial offense in some circles ...

author: bwat
author_rank: Frequent Contributor
timestamp: August 02, 2014, 06:17:06 pm
content: Quote from: Bored@Work on August 02, 2014, 04:06:36 pmI didn't want to be the one to bring this up but since you did, there are parallels between his VHDL processor model and his compiler:i) both were free,ii) both don't seem to work right, andiii) he needs other people to fix them.

author: zapta
author_rank: Super Contributor
timestamp: August 02, 2014, 06:23:39 pm
content: Quote from: c4757p on August 02, 2014, 02:43:39 pmFirst time I hear this term. I like it ;-)

author: bingo600
author_rank: Super Contributor
timestamp: August 02, 2014, 09:49:57 pm
content: Normally i would not bother.....But this is to much ...@op but a commercial compiler , and stop whining aboout gcc.Have fun if ever building Linux on a non gcc tc/BingoOhh and latest isn't greatest on mipsel

author: legacy
author_rank: Super Contributor
timestamp: August 02, 2014, 10:07:56 pm
content: Quote from: bingo600 on August 02, 2014, 09:49:57 pmmy Atlas board was developed by MIPS Inc. around linux 2.4 and in their "companion CD" it comes supported by an old version of gcc (it may be 2.95, i don't remember), what is surprising my is that in an ideal wonderland the kernel is written in C, and C should be portable by its definition, so i fuss why the hell on a modern linux distro, which comes with gcc-4.5 i can't recompile the kernel linux 2.4, which was compiled with an old (GNU)-c compiler, with a modern (GNU)-c-compiler. Probably because GCC is so "pretty" that is incompatible with itself

author: legacy
author_rank: Super Contributor
timestamp: August 02, 2014, 10:20:33 pm
content: Quote from: Bored@Work on August 02, 2014, 04:06:36 pmin short, i have a commercial C compiler that is excellent and i am very happy with it, unfortunately it requires a license and it runs on a SGI workstation, so my problem is supporting other people (i mean who wants to collaborate to the SoftCore project), for example i can't ask a guy to buy an SGI workstation and installing IRIX (which means paying for a flex license of MIPS/PRO) in order to help me about the development.

author: legacy
author_rank: Super Contributor
timestamp: August 02, 2014, 10:29:04 pm
content: @bwatto be honest was not interested about speaking about gcc, how it is shit, and other things, i was simply asking if someone has read/seen/used an alternative C compiler for MIPS, people here seems to use only gcc so i'd better look alternatives by myself.

author: zapta
author_rank: Super Contributor
timestamp: August 02, 2014, 10:42:20 pm
content: Quote from: legacy on August 02, 2014, 10:07:56 pmOk, got it, you are a troll, and I I failed for it. Good job.

author: WarSim
author_rank: Frequent Contributor
timestamp: August 02, 2014, 10:59:44 pm
content: Quote from: legacy on August 02, 2014, 10:29:04 pmThank you for this response. Now I know never to listen to you ever again. A rant is not a request for advice. Now I am convinced that your out of scope and misuse of terms are not a language barrier, you just love to hear yourself rant.And to answer one of you issues. Yes there are several compilers that can be retargeted to MIPS, so go look for them.I am not waisting any more of my time nor my friends time on you so I will thank you not to try to ask anything more from me.Goodbye

author: zapta
author_rank: Super Contributor
timestamp: August 02, 2014, 11:03:26 pm
content: Quote from: legacy on August 02, 2014, 10:48:58 pmSo, it has a bug, on the other hand it runs the world. I would be more respectful, especially that it's free.

author: legacy
author_rank: Super Contributor
timestamp: August 02, 2014, 11:06:34 pm
content: Quote from: WarSim on August 02, 2014, 10:59:44 pmexactly when you have helped/suggested me ?i have opened this thread asking for an alternative of gccand people is hardly talking aboutwhat i do not want to use!> Topic: do you know any open source C compiler for mips, in addition to gcc ? <> answer: there are several compilers that can be retargeted to MIPS, use gcc <that ismy time trashed, first of all !edit:btw i have cleared all i have written in this threadand about time trashing ... it seems to me like when i posted my filesystem sourcesasking for advices and suggestions and i got very useful offensive responses

author: WarSim
author_rank: Frequent Contributor
timestamp: August 02, 2014, 11:11:38 pm
content: Yes you are right.I said I would ask my colleagues, got your answer.Came back to this thread and read the rest of the thread.Then did not pass on their collective answer.So yes I have not ever helped you, just waisted my time.

author: snoopy
author_rank: Frequent Contributor
timestamp: August 03, 2014, 01:46:10 am
content: Quote from: legacy on August 02, 2014, 11:06:34 pmDid you ever consider that there is no solution to your problem ?

author: westfw
author_rank: Super Contributor
timestamp: August 03, 2014, 04:22:26 am
content: QuoteI'll have to admit that I've been screwed over by gratuitously incompatible changes between versions of gcc.(Examples: the disallowing of newlines inside of string constants. The clarification that attributes cannot be part of a typedef (all the avr-libc prog_uchar mess.) Changes in the ordering of macro expansion/stringification.)Overall, I think the rate of such occurences has been about the same as the rate of annoying changes to the C standards, and somewhat less frequent than being screwed by compiler vendors going out of business, or dropping a compiler (proud owner of Borland C, Think C for 68k Macs, and Codewarrior IDE for Mac 68k/PPC. For example.)If you can stomach gcc if you don't have to build it, you might try downloading the PicKit development environment (Arduino-like IDE) for PIC32. That's a gcc for MIPS, and it comes pre-compiled for linux/mac/windows.(BTW, I'd describe the problems with gcc as being "typical" of large products and vendors, and "in contrast" with the different problems you get with smaller vendors. When I worked with <big company>, we were a bit used to pushing vendors around; saying "we want X" and having the vendor say "ok, we'll go figure out how to do x." It was a bit of a shock to start working with a vendor of equal size (Intel) who would just say "No. We won't do that." (but not necessarily a bad thing.) Sometimes you just have to put up with the way that things are, rather than the way you'd ideally like them to be.)

author: rob77
author_rank: Super Contributor
timestamp: August 03, 2014, 08:50:40 am
content: i don't get it Guys....why are you bitching about incompatibilities between GCC versions ? if a version of GCC works for you, then what on earth is pushing you to upgrade ? especially when talking about self-compiling GCC. compile your toolchain and once you're satisfied with your toolchain, then "freeze" it - don't upgrade anything within the toolchain. that's a best way of being able to provide bug fixes for your "firmware" later-on.i did a lot of embedded stuff in the past (ok. mainly x86 - boards with Crusoe processor, and some arm stuff as well) but i was never bitching at gcc.... it's not as easy to build the GCC as other autotooled software, but it's not a problem if you know how to do it. if you don't know how to build it, then use a pre-compiled one or ask google to tell you how to compile it.regarding changes in syntax and other restrictions - that's not a fault of GCC - the GCC guys are just following the rest of the world and changes in the standards.so instead of bitching and desperately searching for a replacement, it's far better to adapt ourselves - that's the way of least time & effort spent

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 02:30:47 pm
content: Quote from: rob77 on August 03, 2014, 08:50:40 ambecause there are patches for a specific gcc version, for exampleONLYgcc-v2.95 has patches to compile OpenBeos/Haiku, as gcc v4.1.2 has working patches to compile RTEMS; these patches are hard to be ported to modern versions of gcc, the same happens to the patches required by the BDM driver about gdb, and the same happens with patches used in SDE about the Atlas support.Linux has the same problem, especially if it has custom care adds on: it happened, for example, with Atheros (MIPS32 SoC used in home router) where Fonosphera gave her help to the kernel providing things (used by openWRT, for the most) there are not in the current linux-kernel tree. It means YOU have to port them, and it is very hard time consuming activity.edit:the same happens, just to provide an other example, with motorola 68hc11, see that everything up to gcc-3.4.6 is simply broken and not supported and it is practically impossible to apply/port the old patches in order to support such a CPU.

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 02:31:52 pm
content: Quote from: westfw on August 03, 2014, 04:22:26 amexactly, a lot of changes in sources are showing you that the gcc development is not aligned with itself, also it is not aligned with ANSI C, that auses projects to be gcc-dependent in oder to be built!It is known to fellows who want to try to compile Haiku or Amiga open kernels with an other gcc compiler or with an not-gcc-compiler! It is simply impossible without hardly patching sources, that is unbelievable, unacceptable, because it is long time consuming!Quote from: westfw on August 03, 2014, 04:22:26 amexactly, but that is only the beginning of the mother of all the issues, trust me, there are many and many more, and not only with gcc but also with binutils, glibc and so on.Quote from: westfw on August 03, 2014, 04:22:26 amfrom my point of view gcc aims to be THE standard, especially for embedded C and C++, that means it could be a rolling standard, changing things by itself an then forcing others to follow them.Quote from: westfw on August 03, 2014, 04:22:26 amyeah, i think this is an other big reason, also consider that gcc has not exactly the bad-effect of TurboC, or CodeWarrior, or SierraC, that means …. if coders do not be strict with-inANSI-Cstandard in their sources, then the result code is becoming "compiler-dependent", that means gcc-dependent, TurboC-dependent, and so on. Ugly situations in where a lot of effort is required to re-allign things.what i really hate about GNU is that it seems to me their guys do it on purpose!Quote from: westfw on August 03, 2014, 04:22:26 amunfortunately i need to build it, especially if i have to support gentoo OverLay's buildsQuote from: westfw on August 03, 2014, 04:22:26 amthere are also other reasons why i can't/want to do that1) my soft core is not MIPS_32 compliant, it is MIPS_1 which could be considered a reduced subset (see the diagram)2) the compiler should also run on linux/PowerPC and freeBSD/x86 machines (my friends love them)3) i have to modify the code-machine generate of the mips-c-compiler in oder to support my soft core's features (which could also be considered as a mirage of mips1 and mips32, i am grabbing what is useful form my purpose, i can't implement the full MIPS32 ISA). I'd like to do that, especially to support fixed point without dirty tricks. I need to modify the c compiler but i simply do not want to try this with gcc because it is very very very complex.Quote from: westfw on August 03, 2014, 04:22:26 amyeah, you are right … but let us take dreams about hobbyQuote from: snoopy on August 03, 2014, 01:46:10 amit seems to me, a solution could be writing a small C compiler by myself, and it could be i will really schedule this activity with my friends using they parsers and know/how.OK, let's go rock

author: zapta
author_rank: Super Contributor
timestamp: August 03, 2014, 02:34:22 pm
content: Quote from: legacy on August 03, 2014, 02:31:52 pmThis sounds very native to me.

author: dannyf
author_rank: Super Contributor
timestamp: August 03, 2014, 02:50:15 pm
content: QuoteYou seem to be more interested in talking about big things rather than completing them.Maybe this is your opportunity to force yourself to actually do something: don't come back to the forum until you have produced a working compiler that you have developed.Like they say, "Just do it".

author: dannyf
author_rank: Super Contributor
timestamp: August 03, 2014, 02:54:12 pm
content: QuoteI remember hearing someone on the LLVM team talking about it being "imminently maturing". That was a few years ago.Today, it is still "imminently maturing".I wouldn't bank on it.Use a tool you have, not a tool that you wish you have.

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 03:07:09 pm
content: (1)Dragon Book's coveri have already writtenpascal-like interpreter-toyand alittle C interpreter(sub ANSI-C compliant). Never written a compiler, but i have seen papers about that fromDr Dobb's's magazine, there is also an old article with a companion CD about small-CC (you have to pay to have their sources, and pdf, but if you pay, they provide them), and i already have a working parser and a minimal know/how about "interpreters" form this book (1)."a compiler is nothing more than a series of transformations of the internal representation of a program" (cit)What's in a compiler?a giant fsm machine composed by1)Lexical Analyzeror "lexer", an engine that recognizes tokens like printf, echo, and "hello world":i have already implemented it in my interpreters2)Parser, an engine that recognizes patterns of tokens and builds an Abstract Syntax Tree (AST):i do not have AST but i have already written a minimal parser in my interpreters, it means to be improved3)Code Generatoraka "back end" aka "cgen", and engine that "walks" the AST and "generates" appropriate code in the target language:never written, i have to learn a lot4) (Optionally, you can add an)optimizerengine that "optimizes" code for size, speed, or architecture, it is, for example, the magic thatgcc-mipsdoes when you put -O0, -O1, -O2, -O3, -OS in its CFlag:i to not need itI have to learn about machine-code-generation, at least. Also my friends are studying the languages and compilers in their computer science courses, so … it may it is possible, it may be not, but we could try. It should be a good experience!btw, removing gcc from the solution space, the possibilities about a solution for the CC in topic are1) write a CC by myself, writing everything and the cgen from scratches, the good of this is that it will be pretty aligned to the soft core purpose instead of being an arrangement of an already existing solution2) try to retarget "lcc", modifying the already existing cgen-mips13) try to retarget "llvm", modifying the already existing cgen-mips1each of these solutions is a trade off and consume time, especially the first has a bad time constraints and i am expecting it could be very time consuming, the good point is: this time should be well used, i mean it should be better spend time "to learn things" than consuming time "to fix things" (perhaps learning how to fix things is already required by the GNU know/how, in order to survive it).

author: andyturk
author_rank: Frequent Contributor
timestamp: August 03, 2014, 03:17:15 pm
content: Quote from: legacy on August 03, 2014, 02:31:52 pmYes, of course. They laid their trap years ago and now you've fallen into it. Sneaky bastards.

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 03:32:29 pm
content: Quote from: dannyf on August 03, 2014, 02:50:15 pminterested about reading if there is a guy who has already done something like that, and in case, reading his advicesinterested about hearing if there is a similar project around, in order to have a good start

author: rob77
author_rank: Super Contributor
timestamp: August 03, 2014, 03:43:12 pm
content: Quote from: andyturk on August 03, 2014, 03:17:15 pmyou nailed it to the cross !

author: andyturk
author_rank: Frequent Contributor
timestamp: August 03, 2014, 04:00:50 pm
content: Quote from: legacy on August 03, 2014, 03:07:09 pmOK, a non-snarky reply...Implementing a compiler is a *huge* effort. The scanner/parser is actually the easiest part. You'll undoubtedly learn a great deal along the way, but be prepared for a year or two of hard work.If you really want to do something like this, I'd suggest starting from the LLVM back-end for MIPS and making it work for your target. One reason is that the LLVM approach is really well done and you'll probably learn what's needed more quickly from LLVM than you will starting from the dragon book. The other is that you won't have to worry about all the parsing stuff--you can focus on going from IR (Intermediate Representation) to machine code for your target.PS. And working with LLVM will make you a C++ commando by the time you're done too.

author: c4757p
author_rank: Super Contributor
timestamp: August 03, 2014, 04:20:21 pm
content: I'll beseriouslyimpressed if a lone coder (or a small group of buddies) in whatever your timeframe is can do better than GCC - and I'd genuinely like to see it if you do.But-Quote from: legacy on August 03, 2014, 03:07:09 pmA basic optimizer is pretty important in getting passable code in an embedded system. This suggests that you're more interested in the compiler's internal structure than having it produce good code, which is fine if you're a programming hobbyist who wants to learn about compilers, but a bit of a WTF if you're looking to replace what you see as a poor compiler...

author: dannyf
author_rank: Super Contributor
timestamp: August 03, 2014, 04:42:37 pm
content: QuoteYou can do yourself a big favor by actually doing it, not talking about doing it.

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 05:31:41 pm
content: Quote from: c4757p on August 03, 2014, 04:20:21 pmin my case, in case i will code such a things, it will be "better" than gcc only about two things1)the way it well be writtenfor the C only support, ANSI C, portable everywhere without all the issues of gcc sources, as i told, i simply hate gcc sources, and you should admit that … gcc's sources are not exactly written in ANSI C as they are not exactly portable, as they are not exactly "easy going", or not ?2)an extremely simplified machine code gen, much more easy to be modified for a new architecture (you should love it especially if you want to toy with HDL), or just to add features to the Soft Core ISA, which, in my case, is a mesh up between MIPS1 and MIPS32, something that the actual gcc-mips is simplynot able to support(without dirty tricks), i mean, the actual profile is gcc-mips1, so i am loosing a lot of the improvement i have grabbed from MIPS32 (see the diagram, not the differences about "legacy" and "modern") and i can't use gcc-mips32 because the soft core is not full MIPS32 compliant, also it has custom instructions about fixed point.gcc will ever be better about1) the languages it supports, e.g. {C++, ADA, objC, ..}2) optimizations space/time/architecture/..3) many and many other features i am not interested aboutwhat i want is a nice piece of code, well written, with the less complexity inside, much more useful for experimental branch about codgen (new architecture features, toying with HDL in soft cores), and much more portable than gcc.that's all, i am not aiming to change the world as it is written in the GNU manifestQuote from: legacy on August 03, 2014, 03:07:09 pmwell, i have put an interactive integer calculator, written in C, on my soft core. I compiled it with gcc-mips in three different profiles, {O0, O1, O2}, then i compared the results. I can assure you that for MIPS1 the real difference between OO and O2 is related to the pipeline optimization, that means the result binaries ratio Otwo : OZero is 1:3 in size, that's a good job done by gcc's optimizer, and you can more improve this result if you profile for MIPS32 insteadYou need to pass the right "CFlgag", and gcc will show you how better it can go with an higher code density! The optimization is performed using the know led of the full MIPS32 ISA instead of a few poor instructions from the tiny MIPS1 ISA, that happens because MIPS32 has many more instructions to be used to save space/time, and the gcc's optimizer knows how to use them.So gcc-mips, about that, seems cool, it still sucks about other things, but it is/will still be superior, btw concerning this discussion there are to more considerations1) the optimization level isstrongly related to implementation, in this case to a 5 level pipelined with an hw delay slot, and … my soft core has no pipeline, my friend's (buggy) implementation has a pipeline, while my soft core is multi cycle without any branch delay slot but with an extremely improved ISA and also with the idea to include a debug processor, something like jtag TAP (see my other thread), i am grabbing the idea from the ZPU.TAP. In short, at the same frequency of my friend's one (@50Mhz), my soft core is offering 1/4 (1:5 stages + stall penalties ~ 1/4) of the performances with more prettiness in the assembly level and a very easygoing behavior about the debug interface, two things i want to be focused on about my hobby purpose!2) I am not interested about thecode-desityand thecode size, i have 96Kbyte of BRAM in my fpga, they are fine with my assembly monitor and this "mini mon" is already fine to bootstrap and to load things from uart, so about "application", i will be fine with an added 64Mbyte chunk of dram. Fortunately my new Avnet Board already has 64Mbyte of DRAM, so I think i'm fine enough.3) the real problem is doing debugging, at the host side ! The O2 optimization is making things warped and understanding the assembly level (like SPIM, if you have ever used it) is much more complex, which is a not-wanted point in this project!for at least such a tree reasons i do not need & want any optimization!

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 05:43:07 pm
content: Quote from: andyturk on August 03, 2014, 04:00:50 pmthat's cool!that's also the kind of advice i have been looking for. I will follow it, thank you

author: magetoo
author_rank: Frequent Contributor
timestamp: August 03, 2014, 05:53:40 pm
content: Was going to recommend clang, but I see that's already been done. Might be worth checking outPCCas well. (PCC is an ancient compiler that was resurrected recently.) TheTODOpage says MIPS is not there yet:Quotebut it's supposedly a pretty clean and simple architecture internally, so if you are inclined to hack on compilers..I feel your pain with the mutually-incompatible GCC versions. Been there, gave up.

author: legacy
author_rank: Super Contributor
timestamp: August 03, 2014, 10:20:07 pm
content: Excellent information ! Also books about compilers, article about algorithms, etc! Very useful, thank you a lot for the link

author: westfw
author_rank: Super Contributor
timestamp: August 03, 2014, 10:44:45 pm
content: QuoteThat and SDCC ARE much simpler compilers, though neither has ever supported MIPS AFAIK. They did produce rather slow and large code; when the first version of gcc came out, we saw something like 15% improvement in both size AND speed moving to it from the PCC we were using.I think you underestimate the importance of "optimization." I'm not talking about the differences between O1 and O3 - I'm talking about the difference between the gross code that a 2nd-semester compiler class compiler produces, vs what gcc produces with -O0. You can look up some of the complaints about the code produced by the Microchip 8-bit compilers in "free" mode, which claimed to "turn off optimization", and produced some truly icky code (whose analysis did in fact lean toward "they didn't do ANY optimization" rather than "intentionally produces bad code.")PCC for 68k is probably a better starting point than SDCC, because the MIPS is more like a 68k (number of registers/etc) than an 8051... (and hey; you can stop messing with gcc on your 68k project, too!)(Now THERE'S an interesting question: has the "state of the art" for BEGINNING compiler projects advanced in the last 30 years or so? A modern "data structures and algorithms" class is MUCH different than the one I took, and an "intro to graphics" is probably different. But I've been assuming that "beginning compilers" is about the same; all parsing and BNF and such, and little code generation...) (You're also likely to discover that C, predating even the 30-y old parsing theory, has a horrible syntax...)

author: magetoo
author_rank: Frequent Contributor
timestamp: August 04, 2014, 06:18:13 pm
content: Quote from: westfw on August 03, 2014, 10:44:45 pmNot sure how PCC does wrt optimizations, but it will compile things a lot faster than GCC. I'm assuming that at least the most trivial optimizations are done, but probably not much more.QuoteI took the introductory compiler theory class that was available to me ten years ago, and I can't imagine much had changed from ten years prior to that. This was in a small regional university and not some place that does actual research in CS, so that might be a factor.I guess if you base a course around the Dragon Book things aren't going to change all that quickly. It's all Java in the latest edition, but that's about it.

author: bwat
author_rank: Frequent Contributor
timestamp: August 05, 2014, 09:06:32 am
content: People who worry about compiler optimisation tend to be people who don't build and use their own compilers. More often than not, a simple code generator is good enough. The simplicity tends to make it easier to implement as well. Of course all this is nonsense if your specification means you're near the limit of instruction throughput for the chosen processor.Also, most effort in compiler development goes into library function development. That's been my experience.

author: dannyf
author_rank: Super Contributor
timestamp: August 05, 2014, 10:40:37 am
content: QuoteOr people who cannot code on an optimizing compiler because they don't understand how it works.

author: bwat
author_rank: Frequent Contributor
timestamp: August 05, 2014, 11:05:09 am
content: Quote from: dannyf on August 05, 2014, 10:40:37 amOh but I do know how to build optimising compilers. Here's one I use almost dailyhttp://barrywatson.se/download/BarrysProlog_x86_64.tar.gz. That one actually includes optimisations based upon a dataflow analysis I've not seen documented elsewhere. I've also worked on optimising compilers that were embedded in a product you've probably used when making telephone calls. It's the AOT compiler in this producthttp://www.ericsson.com/ericsson/corpinfo/publications/review/2001_01/files/2001013.pdf.Now I still stand by my claim. What evidence/experience do you have to back up your claim?