Skip to content
This repository has been archived by the owner on Dec 20, 2019. It is now read-only.

Commit

Permalink
Add llvm-cbe project (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkyte authored and luhenry committed Dec 5, 2018
1 parent 6cf8276 commit 2c2cffe
Show file tree
Hide file tree
Showing 139 changed files with 8,545 additions and 0 deletions.
21 changes: 21 additions & 0 deletions projects/llvm-cbe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
2 changes: 2 additions & 0 deletions projects/llvm-cbe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(lib)
add_subdirectory(tools)
57 changes: 57 additions & 0 deletions projects/llvm-cbe/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
==============================================================================
LLVM Release License
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2014 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyrights and Licenses for Third Party Software Distributed with LLVM:
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:
Program Directory
------- ---------
Autoconf llvm/autoconf
llvm/projects/ModuleMaker/autoconf
llvm/projects/sample/autoconf
Google Test llvm/utils/unittest/googletest
OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
14 changes: 14 additions & 0 deletions projects/llvm-cbe/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##===- projects/sample/lib/Makefile ------------------------*- Makefile -*-===##

#
# Relative path to the top of the source tree.
#
LEVEL := ../..
include $(LEVEL)/Makefile.config

#
# List all of the subdirectories that we will compile.
#
DIRS := lib tools

include $(PROJ_SRC_ROOT)/Makefile.rules
72 changes: 72 additions & 0 deletions projects/llvm-cbe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
llvm-cbe
========

resurrected LLVM "C Backend", with improvements


INSTALLATION INSTRUCTIONS
=========================

This version of the LLVM-CBE library works with LLVM 6.0 and 7.0. You will have
to compile this version of LLVM before you try to use LLVM-CBE. This
guide will walk you through the compilation and installation of both
tools and show usage statements to verify that the LLVM-CBE library is
compiled correctly.

The library is known to compile on various Linux versions (Redhat,
Mageia, Ubuntu, Debian), Mac OS X, and Windows (Mingw-w64).

Step 1: Installing LLVM
=======================

LLVM-CBE relies on specific LLVM internals, and so it is best to use
it with a specific revision of the LLVM development tree. Currently,
llvm-cbe works with the LLVM 6.0 and 7.0 release versions and autotools.

Note: to convert C to LLVM IR to run the tests, you will also need a C compiler such as clang.

The first step is to compile LLVM on your machine
(this assumes an in-tree build, but out-of-tree will also work):

cd $HOME
git clone https://github.com/llvm-mirror/llvm
cd llvm
git checkout release_37
mkdir build
cd build
../configure
make

Step 2: Compiling LLVM-CBE
==========================

Next, download and compile llvm-cbe from the same folder:

cd $HOME/llvm/projects
git clone https://github.com/JuliaComputing/llvm-cbe
cd ../build
make

Step 3: Usage Examples
======================

If llvm-cbe compiles, you should be able to run it with the following commands.
```
$ cd $HOME/llvm/projects/llvm-cbe/test/selectionsort
$ ls
main.c
$ clang -S -emit-llvm main.c
$ ls
main.c main.ll
$ $(HOME)/llvm/build/Debug+Asserts/bin/llvm-cbe main.ll
```

Compile Generated C-Code and Run
================================

```
$ gcc -o main.cbe main.cbe.c
$ ls
main.c main.cbe main.cbe.c main.ll
$ ./main.cbe
```
6 changes: 6 additions & 0 deletions projects/llvm-cbe/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<body>
<h1>SAMPLE PROJECT DOCUMENTATION</h1>
<p>This is just a placeholder</p>
</body>
</html>
8 changes: 8 additions & 0 deletions projects/llvm-cbe/include/sample.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* File: sample.h
*
* This is a sample header file that is global to the entire project.
* It is located here so that everyone will find it.
*/
extern int compute_sample (int a);

1 change: 1 addition & 0 deletions projects/llvm-cbe/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(Target)
14 changes: 14 additions & 0 deletions projects/llvm-cbe/lib/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
##===- projects/sample/lib/Makefile ------------------------*- Makefile -*-===##

#
# Relative path to the top of the source tree.
#
LEVEL := ../../..
include $(LEVEL)/Makefile.config

#
# List all of the subdirectories that we will compile.
#
DIRS := Target

include $(PROJ_SRC_ROOT)/Makefile.rules
Loading

0 comments on commit 2c2cffe

Please sign in to comment.