This is an archive of the discontinued LLVM Phabricator instance.

Fix flags for compiling examples/Kaleidoscope/MCJIT
ClosedPublic

Authored by jmed on Jul 21 2014, 3:06 PM.

Details

Summary

This patch contains minor changes I made to get examples/Kaleidoscope/MCJIT/initial/toy.cpp to compile, discussed in the following bug report:
http://llvm.org/bugs/show_bug.cgi?id=20329

Diff Detail

Event Timeline

jmed updated this revision to Diff 11720.Jul 21 2014, 3:06 PM
jmed retitled this revision from to Fix flags for compiling examples/Kaleidoscope/MCJIT/initial.
jmed updated this object.
jmed edited the test plan for this revision. (Show Details)
jmed added a reviewer: rengolin.
jmed set the repository for this revision to rL LLVM.
jmed added a project: deleted.
jmed added a subscriber: Unknown Object (MLST).
rengolin added inline comments.Jul 22 2014, 4:59 AM
examples/Kaleidoscope/MCJIT/initial/Makefile
3

This should be ok, but again, people that have worked on the tutorial should have a better opinion.

examples/Kaleidoscope/MCJIT/initial/toy.cpp
794

It seems that all MCJIT Kaleidoscope files have this, as well as the documentation in docs/tutorial. If you're going to change, better change all.

Also, from other patterns, the DataLayoutPass has the following usage:

new DataLayoutPass(Module)

which is not what you've used. I'm not sure how the pass manager is doing this at the moment, but other people may comment on that. Either way, better change all other files while you're at it.

jmed updated this revision to Diff 11899.Jul 25 2014, 4:14 PM
jmed retitled this revision from Fix flags for compiling examples/Kaleidoscope/MCJIT/initial to Fix flags for compiling examples/Kaleidoscope/MCJIT.

Added fixes for compiling all Kaleidoscope/MCJIT examples (patch made against r213970). Compiled these on x86-64 & ARMv7a and ran as described in the test plan. Summary of changes:

  • Fixed compile flags to use llvm-config --cxxflags instead of llvm-config --cppflags
  • Added -pthread -ldl -lcurses -lz linking flags (zlib is apparently a dependency of libLLVMSupport, should -lz be added to llvm-config?)
  • API update: raw_fd_ostream constructor needs sys::fs::F_None as flags param (prev. value removed)
  • API update: usage of MemoryBuffer::getFile changed
  • API update: RTDyldMemoryManager::getPointerToNamedFunction deprecated; use getSymbolAddress
  • API update: use DataLayoutPass(Module*) instead of DataLayout for FPM (now using the preferred signature which passes the module)

Additionally, the code that enabled object caching wasn't being triggered. I prefixed "IR:" to the module ID to cause the caching to happen. Additionally, -use-object-cache needs to be specified on the command line, which I added to the python scripts generating the timing in MCJIT/cached/genk-timing.py.

rengolin edited edge metadata.Jul 29 2014, 7:30 AM

I can't comment on the other changes, which seem to be variations of the same fix on different files (and why do we have that many similar files bothers me), but I'll let someone that has actually changed Kaleidoscope recently to reply as to its validity.

My concerns were addressed. Thanks!

rengolin accepted this revision.Aug 5 2014, 7:15 AM
rengolin edited edge metadata.

LGTM, but please get Andrew's, Lang's (or someone else closer to MCJIT) to approve.

cheers,
--renato

This revision is now accepted and ready to land.Aug 5 2014, 7:15 AM
rengolin set the repository for this revision to rL LLVM.

Hi,

Has this gone in? Is it still required/desired?

If yes, please ping the appropriate people, if not, please drop it.

Thanks,
--renato

lhames edited edge metadata.Nov 5 2014, 4:30 PM

Apologies for the very tardy review.

This all looks good to me, with one quibble: Where the link lines all include "-pthread -ldl -lcurses -lz", it would be preferable to add the --system-libs option to the llvm-config invocation instead. That should pull in those libraries.

If you have commit access, please go ahead and commit after making that change. If not, just ping me and I will commit it for you.

Thanks very much for your work on this Jesse.

Any progress in this?

rengolin closed this revision.Mar 13 2015, 3:17 AM