Skip to content
Tcl extension for the LLVM C API
Branch: master
Clone or download
Pull request Compare This branch is 101 commits behind jdc8:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is the llvmtcl extension based on the Tcl Extension Architecture (TEA).
Please see the webpage


for more details.

This package is a freely available open source package.  You can do virtually
anything you like with it, such as modifying it, redistributing it, and selling
it either in whole or in part.  See the file "license.terms" for complete


- tcl 8.6
- llvm 3.0


The following is a short description of the files you will find in
the sample extension.	Makefile template.  The configure script uses this file to
		produce the final Makefile.

README		This file.

license.terms   License info for thie package.

aclocal.m4	Generated file.  Do not edit.  Autoconf uses this as input
		when generating the final configure script.  See "tcl.m4"

configure	Generated file.  Do not edit.  This must be regenerated
		anytime or tclconfig/tcl.m4 changes.	Configure script template.  Autoconf uses this file as input
		to produce the final configure script. Package index template.  The configure script will use
		this file as input to create pkgIndex.tcl.

llvmtcl-gen.inp Input for llvmtcl-gen.tcl. It contains reformatted function
                declarations of the llvm C API.

llvmtcl-gen.tcl Script to generate the Tcl API to the llvm C API. The
                llvmtcl-gen.inp is the input for this script.

llvmtcl.c       File containing all non-generated parts of the Tcl API to the
                llvm C API.

llvmtcl.tcl     Scripts using the Tcl API to the llvm C API.

tests           Some tests for the package.

tclconfig/	This directory contains various template files that build
		the configure script.  They should not need modification.

	install-sh	Program used for copying binaries and script files
			to their install locations.

	tcl.m4		Collection of Tcl autoconf macros.  Included by
			aclocal.m4 to define SC_* macros.


This is a C++ extension, so make sure to set the CC environment variable to a
c++ compiler (e.g. g++).

Building under most UNIX systems is easy, just run the configure script
and then run make. For more information about the build process, see
the tcl/unix/README file in the Tcl src dist. The following minimal
example will build and install the extension:

	$ cd llvmtcl
	$ ./configure --with-tcl=... --with-llvm=...
	$ make
        $ make test
	$ make install

Add the llvm lib directory containing the llvm shared object files to the
LD_LIBRARY_PATH environment variable.


Not available.


The installation of a TEA package is structure like so:

          /       \
        lib       bin
         |         |
   PACKAGEx.y   (dependent .dll files on Windows)
  pkgIndex.tcl (.so|.dll files)

The main .so|.dll library file gets installed in the versioned PACKAGE
directory, which is OK on all platforms because it will be directly
referenced with by 'load' in the pkgIndex.tcl file.  Dependent DLL files on
Windows must go in the bin directory (or other directory on the user's
PATH) in order for them to be found.

USING llvmtcl

- to load the extension into a Tcl interpreter:

  package require llvmtcl

- The package makes a llvmtcl ensemble command. The subcommands are the LLVM C
  API functions with LLVM trimmed from the front. All supported types,
  enumerators and functions can be found in:

- Functions taking a pointer argument followed by an unsigned argument to
  specified the number of elements the pointer is pointing to are converted to
  ensemble commands where the pointer and the unsigned argument are replaced by
  a Tcl list.



    Example using the LLVM API to create a factorial function


    Example using the LLVM API to create a function adding 4 and 6 to an
    argument, optimize that function and execute it.


    Example converting Tcl into LLVM


    Example calling functions in shared libraries
You can’t perform that action at this time.