This is an archive of the discontinued LLVM Phabricator instance.

Update Kaleidoscope tutorial and improve Windows support
ClosedPublic

Authored by mkroll on Feb 11 2017, 10:10 AM.

Details

Summary

Many quoted code blocks were not in sync with the actual toy.cpp files.
Improved tutorial text slightly in several places.
Added some step descriptions crucial to avoid crashes (like InitializeNativeTarget* calls).
Solve/workaround problems with Windows (JIT'ed method not found, using custom and standard library functions from host process)

Diff Detail

Event Timeline

mkroll created this revision.Feb 11 2017, 10:10 AM
mehdi_amini added inline comments.Feb 11 2017, 11:04 AM
docs/tutorial/LangImpl03.rst
536–537

80 cols?
(and in multiple places below)

Wilfred accepted this revision.Feb 11 2017, 11:08 AM

Looks fine from my perspective. :)

This revision is now accepted and ready to land.Feb 11 2017, 11:08 AM
mkroll updated this revision to Diff 88105.Feb 11 2017, 1:21 PM

Fixed some too long lines

mkroll marked an inline comment as done.Feb 11 2017, 1:24 PM
mehdi_amini accepted this revision.Feb 11 2017, 1:25 PM

LGTM overall. I trust you to have tested the windows part.

Do you have commit access?

Sure, the Windows specific changes work fine on Windows.

No, I don't have commit access.

This revision was automatically updated to reflect the committed changes.

I wish if this patch were split to;

  • Documentation fixes
  • Tweaks for current implementation
  • Win32 changes

(I don't know how to process multiple patchset on phab in better way, though)

llvm/trunk/examples/Kaleidoscope/Chapter7/toy.cpp
1119 ↗(On Diff #88108)

It requires TransformUtils. Fixed in r294881.

I would also prefer to provide a patch set to have sensibly grouped changes like with git.

About TransformUtils, sorry, I'm building with MSVC and already had all libraries in my project from step 8.
The tutorial steps don't mention the make file, but they use llvm-config to select the libraries.
So "clang++ -g toy.cpp llvm-config --cxxflags --ldflags --system-libs --libs core mcjit native -O3 -o toy" should be updated to "clang++ -g toy.cpp llvm-config --cxxflags --ldflags --system-libs --libs core mcjit native transformutils -O3 -o toy".
I created a patch for this: https://reviews.llvm.org/D29875