[LLVMdev] Google SOC - Idea

Bill Wendling isanbard at gmail.com
Tue Mar 20 00:16:42 PDT 2007


On Mar 19, 2007, at 5:53 PM, Scott Fortmann-Roe wrote:

Hi Scott!

Some comments inlined:

> ABSTRACT
> ----------------
>
> The purpose of this project is to develop a FORTRAN front-end to the
> Low Level Virtual Machine (LLVM) compiler infrastructure. LLVM is a
> mature collection of tools which provide a powerful resource for
> language developers and end-user programmers. LLVM consists of roughly
> three components. The first is a front-end to a language (such as C,
> C++, or virtually any other) that parsers the language and converts it
>
s/parsers/parses/

> into LLVM's Intermediate Representation (IR). The LLVM IR is a
> language- and target- independent representation. The next component
> of LLVM is a collection of powerful optimization routines that operate
> on the IR. The final module of LLVM is a backend that can compile
> optimized code to a number of platforms including x86 and PowerPC, can
> emit an optimized C representation of the original program, or use a
> Just-In-Time compiler to interpret the program on a variety of
> platforms.
>
If you want, you could put a URL to LLVM's homepage in here somewhere.

> To claim FORTRAN is mature is an understatement. In use for over 50
> years, FORTRAN is utilized in a wide variety of legacy code bases.
> While younger and flashier languages get all the press, FORTAN still
> enjoys wide usage in many scientific fields and other
> businesses—especially when legacy code is involved.
>
Quite true! I've worked at some of these places. :-)

> The implementation of a FORTAN front end would benefit both the
> FORTRAN user-base and the LLMV project. The scientific uses of
> FORTRAN—along with its other applications—are often heavily involved
> simulations and calculations that are very resource demanding and
> could greatly benefit from LLVM's powerful optimization mechanisms.
> The LLVM project will, of course, benefit from having another
> front-end language and the resulting larger "market" available that
> can utilize LLVM. Additionally, the LLVM optimization team will have
> another case study to explore the effectiveness of its optimization
> routines. Especially the development of mixed-language optimization
> routines involving FORTAN and one or more other language may be
> explored and implemented.
>
> Deliverables for this project are:
> * FORTRAN front-end to LLVM
> * Documentation and tools for using the front-end
>
Could you also work on a suites of tests? It doesn't have to be  
compete or full-featured, but it's good to have tests hanging around  
so that you make sure you get things done correctly.

> DETAILED DESCRIPTION
> ----------------------------
>
> The reader should refer to the abstract for a description of the goals
> of this project and their justifications. This section is devoted to
> the applicant's experience, interests, qualifications, and plan for
> completing the project.
>
> * Personal Background
>
> I am a Junior, Environmental Engineering and Economics double major at
> Swarthmore College and do not come from a traditional Computer Science
> background. My story is the standard "taught himself to program at
> twelve, no time for stuffy computer science courses" narrative. My
> programming ideology is one of problem solving: I encounter a problem
> in my life and solve it using whatever tools or resources are needed
> to do so. To this end, I have dabbled in a wide range of fields from
> databases, to statistical analysis, to GUI applications, to web
> applications, and more. Examples of this work are an anti-censorship,
> in-browser web-browser (it's ridiculous, I know, but darn useful)
> [http://palary.com] and Longhand a calculator program for OS X
> [http://longhand.palary.com]. I have also worked for a number of
> clients developing GUI applications, data analysis applications, and
> web applications.
>
> I became interested in the area of language development as a result of
> a desire for better tools to deal with the environmental modeling and
> economical modeling issues that I came into contact with in my
> studies. It seemed to me like these areas could benefit greatly from
> domain specific languages that were tailored to their specific needs
> (such as built in units in the environmental modeling case). I am
> currently working toward developing such a language for my Senior
> Thesis here at Swarthmore.

I don't know how much Google wants in this section. One question I  
come away with is, "How does Fortran relate to your language?"

> * Motivation
>
> To gain the background to carry out the complicated task of developing
> a domain specific modeling language, I have since wiggled my way
> around the pre-requisites and enrolled in an upper-level compiler
> course here at Swarthmore. Additionally, I have actively immersed
> myself in the field. In this immersion I came across the LLVM project
> and I believe that its IR would be an excellent target for the
> language I eventually create.  LLVM is, of course, a complex tool and
> I wish to gain much more familiarity with it.
>
> This is my primary motivation for working on a FORTRAN front-end:
> gaining experience and background. I am here to learn, and if my
> learning allows both the LLVM community and the FORTRAN community to
> receive an excellent tool, as it assuredly will, so much the better.
>
> * The Plan
>
> I will possess roughly three-months this summer to work on the
> front-end, and I am very confident that it will be completed on time
> (I am actually thinking that I could do much more in that period, but
> I learned long ago not to stick my head out on thing like this :).
>
> I am not as familiar with the technologies involved as I would like
> to, so my planning is necessarily imprecise. My rough plan proceeds as
> follows:
>
> =====
> - 2 weeks – Become familiar with the technologies: LLVM, FORTAN (I've
> programmed a lot of languages, but never that), and GCC's FORTAN
> implementation. Do not engage in any direct work on the projects but
> gain experience with the tools. Ascertain what previous work has been
> accomplished towards developing a FORTRAN front-end.
>
> - 4 weeks – Build the FORTRAN front-end.
>
> - 2 weeks – Smooth things out, unit tests, etc…
>
> - 1 week – Documentation, make sure that the front-end can be
> maintained by someone else.
>
I would suggest writing documentation along the way. Even if they are  
just notes to yourself. It will help this week go by faster  
(developers *hate* writing docs).

> - 3 weeks – "Shit Happens"
> =====
>
> I plan on first attempting to implement the FORTRAN front-end by
> co-opting the GCC FORTRAN parser. If that fails, I will build a
> front-end using ANTLR [http://antlr.org] a parser generator with which
> I am familiar and for which a FORTRAN grammar is already available
> (targeting an obsolete version of ANTLR, but it should not be too
> difficult to update).
>
One thing you don't mention is which version of Fortran you want to  
do: Fortran 77, 90, 95, ??. Each has their own challenges. If you're  
going to do a subset of one of the languages, then define how much of  
it you want to do, and then provide a roadmap for future work. I  
think it would be a good idea to scour the web looking for examples  
of Fortran programs out there. Build your front-end using these as  
testcases. Start with the simplest one, get it going, then get more  
complex. It will then be easy to make these small programs into  
testcases to include in the LLVM tester.

> * In Short
>
> I'm psyched :)
>
> I am confident that this is a very manageable project, I will complete
> it on time, and I will learn a great deal in the process of
> implementing it.
>
Awesome! Good luck on it!! :-) A Fortran FE will be a much welcome  
addition.

-bw





More information about the llvm-dev mailing list