[LLVMdev] Anyone is building a DSP-C frontend?

John Criswell criswell at cs.uiuc.edu
Tue Aug 30 07:33:37 PDT 2005

Tzu-Chien Chiu wrote:
> Hi,
> DSP-C is an extension to ISO C to support specific hardware features
> in DSP, e.g. fixed-point typer, memory spaces and circular pointers.
> It's generic for different DSP's.
> - http://www.dsp-c.org
> How difficult is it to extending the llvm-gcc for this extension? 

I am not sure.  There are two issues with what you want to do:

1) Changing the C frontend to compile the C extensions into LLVM.
2) Mapping the extensions into LLVM code.

The first issue is simply changing llvm-gcc.  llvm-gcc is based on a 
developmental version of GCC 3.4.  We haven't documented our changes to 
llvm-gcc, but the GCC people have written a document that explains the 
internals of GCC (http://gcc.gnu.org/onlinedocs/gccint).  If you browse 
that document and then look at the llvm-* source files in our llvm-gcc 
source distribution, you can probably figure out what to do.  If you 
have questions about the code, please don't hesitate to email the list.

As far as how difficult this is, it depends on who you are.  If you're 
comfortable working on GCC internals, it probably won't be too bad. 
Otherwise, I think you could say that it's hard.

The second issue is the stickier one.  Your changes in the GCC frontend 
need to map these extensions into LLVM code.  Briefly looking over the 
DSP-C specification, I believe LLVM can represent fixed point types and 
circular pointers without modification.  I'm not sure about the memory 
spaces, though.

If you can't think of a way to map your extensions to LLVM code and 
think that you need to extend LLVM to support your extensions, email the 
llvmdev list with what you want to extend and why you think it needs to 
be extended.  We can offer feedback on whether the extension is 
necessary and may be able to offer suggestions that will make the work 

> Any document like "hitchhiker's guide to extend the GCC fronted" ?
> (just like the guide for adding instructions and intrinsics)

I think such a document would get outsold by the Encyclopedia Galatica.

-- John T.

John T. Criswell
Research Programmer
University of Illinois at Urbana-Champaign
"It's today!" said Piglet. "My favorite day," said Pooh.

More information about the llvm-dev mailing list