[LLVMdev] Re: LLVM Visual Studio Project files

Jeff Cohen jeffc at jolt-lang.org
Thu Nov 4 19:56:43 PST 2004


Solved it.  Looking at the source of bison, I found an undocumented
environment variable M4 that points to the m4 binary.  Setting it to the
absolute path did the job.  When not present, it ought to find it in the
path as it uses execvp.  At least on Unix.  I have no idea what it does
on Windows as I could not get the source used to build the Windows
version (the installer claimed it installed the source, but it didn't).

The link of tablegen fails still fails, though, complaining of a missing
support.lib.  This is due to a bug in the debug configuration of
tablegen (and is not present in the release configuration).  Patch
attached.

Watching this thing build, what comes to mind is that it would go a
whole lot faster if we could use precompiled header files.
Unfortunately, there's no way to do this with VC++ without modifying
every *.cpp file.  On the other hand, doesn't gcc support precompiled
header files also?  Not that it necessarily does it in even remotely the
same way...

The build finally gets to Fibonacci and fails with:

c:\llvm\examples\Fibonacci\fibonacci.cpp(111) : error C2065: 'args' : undeclared identifier
c:\llvm\examples\Fibonacci\fibonacci.cpp(111) : error C2228: left of '.IntVal' must have class/struct/union type

I don't how this compiles with gcc.  "args" is mispelled.  Should be
"Args".  Patch attached for this also.

Also, the llvm.suo file should not be in the repository.  This has
per-user configuration settings for VS.  I'm surprised you even knew it
was there to be checked in, as it's a hidden file.  This file had
hard-coded paths to Morten's setup, and even had his breakpoints in it.

So...  once these problems are fixed, I run fibonacci and get the
following output:

---------

implementation   ; Functions:

int %fib(int %AnArg) {
EntryBlock:
        %cond = setle int %AnArg, 2             ; <bool> [#uses=1]
        br bool %cond, label %return, label %recurse

return:         ; preds = %EntryBlock
        ret int 1

recurse:                ; preds = %EntryBlock
        %arg = sub int %AnArg, 1                ; <int> [#uses=1]
        %fibx1 = call int %fib( int %arg )              ; <int> [#uses=1]
        %arg1 = sub int %AnArg, 2               ; <int> [#uses=1]
        %fibx2 = call int %fib( int %arg1 )             ; <int> [#uses=1]
        %addresult = add int %fibx1, %fibx2             ; <int> [#uses=1]
        ret int %addresult
}
---------
starting fibonacci(10) with JIT...
Result: 55


I assume this is correct.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: win.diffs
Type: application/octet-stream
Size: 1204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20041104/4e4d4aef/attachment.obj>


More information about the llvm-dev mailing list