On Wed, 18 Mar 2009, Joern Rennecke wrote: > It would be easier to implement if C++ with virtual member functions > would be allowed for the target vector. Then, where this is not already > readily available, we can tweak the optimizers and/or the code so that > we obtain de-virtualization and inlining of the function calls with > appropriate procedure (or part thereof) cloning of the callers.
Whether C or C++ is used is a fairly minor detail in implementing a multi-target compiler. In either case, one major piece of the work is converting all the target macros to be function or data members of the target vector instead. (There are several other substantial pieces of work. For example, target macros from tm.h are also used in gcc.c, collect2, libgcc and libobjc, not just in the compiler proper, and subtargets for the same architecture have their own macros that need handling.) > A large part of the backend are C files (insn-* etc.) that are generated > from the *.md files. These files would have to get separate file and > function names for each backend; pointers to the non-static functions > of these files might then be stored in the target vector. Yes, that's another thing that would need doing for a multi-target compiler. Again, the compiler driver also has generated data. -- Joseph S. Myers jos...@codesourcery.com