Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
263 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
build/ | ||
Makefile.in | ||
INSTALL | ||
aclocal.m4 | ||
autom4te.cache/ | ||
configure | ||
depcomp | ||
install-sh | ||
missing | ||
configure.scan | ||
autoscan.log | ||
ylwrap | ||
/INSTALL | ||
/aclocal.m4 | ||
/autom4te.cache/ | ||
/configure | ||
/depcomp | ||
/install-sh | ||
/missing | ||
/configure.scan | ||
/autoscan.log | ||
/ylwrap | ||
/compile | ||
*.o | ||
*~ | ||
TAGS | ||
TAGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
aclocal | ||
aclocal -I m4 | ||
autoconf | ||
automake -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# =========================================================================== | ||
# http://www.gnu.org/software/autoconf-archive/ax_llvm.html | ||
# =========================================================================== | ||
# | ||
# SYNOPSIS | ||
# | ||
# AX_LLVM([llvm-libs]) | ||
# | ||
# DESCRIPTION | ||
# | ||
# Test for the existance of llvm, and make sure that it can be linked with | ||
# the llvm-libs argument that is passed on to llvm-config i.e.: | ||
# | ||
# llvm --libs <llvm-libs> | ||
# | ||
# llvm-config will also include any libraries that are depended apon. | ||
# | ||
# LICENSE | ||
# | ||
# Copyright (c) 2008 Andy Kitchen <agimbleinthewabe@gmail.com> | ||
# | ||
# Copying and distribution of this file, with or without modification, are | ||
# permitted in any medium without royalty provided the copyright notice | ||
# and this notice are preserved. This file is offered as-is, without any | ||
# warranty. | ||
|
||
# | ||
# Modified by Nick Gasson to work with the C bindings | ||
# | ||
|
||
#serial 12 | ||
|
||
AC_DEFUN([AX_LLVM_C], | ||
[ | ||
AC_ARG_WITH([llvm], | ||
AS_HELP_STRING([--with-llvm@<:@=DIR@:>@], [use llvm (default is yes) - it is possible to specify the root directory for llvm (optional)]), | ||
[ | ||
if test "$withval" = "no"; then | ||
want_llvm="no" | ||
elif test "$withval" = "yes"; then | ||
want_llvm="yes" | ||
ac_llvm_config_path=`which llvm-config` | ||
else | ||
want_llvm="yes" | ||
ac_llvm_config_path="$withval" | ||
fi | ||
], | ||
[want_llvm="yes"]) | ||
succeeded=no | ||
if test -z "$ac_llvm_config_path"; then | ||
ac_llvm_config_path=`which llvm-config` | ||
fi | ||
if test "x$want_llvm" = "xyes"; then | ||
if test -e "$ac_llvm_config_path"; then | ||
LLVM_CFLAGS=`$ac_llvm_config_path --cflags` | ||
LLVM_CXXFLAGS=`$ac_llvm_config_path --cxxflags` | ||
LLVM_LDFLAGS="$($ac_llvm_config_path --ldflags)" | ||
LLVM_LIBS="$($ac_llvm_config_path --libs $1)" | ||
AC_REQUIRE([AC_PROG_CXX]) | ||
CFLAGS_SAVED="$CFLAGS" | ||
CFLAGS="$CFLAGS $LLVM_CFLAGS" | ||
export CFLAGS | ||
CXXFLAGS_SAVED="$CXXFLAGS" | ||
CXXFLAGS="$CXXFLAGS $LLVM_CXXFLAGS" | ||
export CXXFLAGS | ||
LDFLAGS_SAVED="$LDFLAGS" | ||
LDFLAGS="$LDFLAGS $LLVM_LDFLAGS" | ||
export LDFLAGS | ||
LIBS_SAVED="$LIBS" | ||
LIBS="$LIBS $LLVM_LIBS" | ||
export LIBS | ||
AC_CACHE_CHECK(for LLVM ([$1]), | ||
ax_cv_llvm, | ||
[AC_LANG_PUSH([C++]) | ||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[@%:@include <llvm-c/Core.h> | ||
]], | ||
[[LLVMModuleCreateWithName("test"); return 0;]])], | ||
ax_cv_llvm=yes, ax_cv_llvm=no) | ||
AC_LANG_POP([C++]) | ||
]) | ||
if test "x$ax_cv_llvm" = "xyes"; then | ||
succeeded=yes | ||
fi | ||
CFLAGS="$CFLAGS_SAVED" | ||
CXXFLAGS="$CXXFLAGS_SAVED" | ||
LDFLAGS="$LDFLAGS_SAVED" | ||
LIBS="$LIBS_SAVED" | ||
else | ||
succeeded=no | ||
fi | ||
fi | ||
if test "$succeeded" != "yes" ; then | ||
AC_MSG_ERROR([[We could not detect the llvm libraries make sure that llvm-config is on your path or specified by --with-llvm.]]) | ||
else | ||
AC_SUBST(LLVM_CFLAGS) | ||
AC_SUBST(LLVM_LDFLAGS) | ||
AC_SUBST(LLVM_LIBS) | ||
AC_DEFINE(HAVE_LLVM,,[define if the llvm library is available]) | ||
fi | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
bin_PROGRAMS = nhdl | ||
lib_LIBRARIES = libnhdl.a | ||
noinst_LIBRARIES = libcgen.a | ||
|
||
AM_CFLAGS = -Wall -Werror | ||
AM_YFLAGS = -d --locations | ||
AM_LDFLAGS = -rdynamic | ||
AM_LDFLAGS = -rdynamic $(LLVM_LDFLAGS) | ||
|
||
BUILT_SOURCES = parse.h | ||
|
||
libnhdl_a_SOURCES = lib.c util.c ident.c parse.y lexer.l tree.c type.c \ | ||
sem.c elab.c | ||
|
||
libcgen_a_SOURCES = cgen.c | ||
libcgen_a_CFLAGS = $(LLVM_CFLAGS) | ||
|
||
nhdl_SOURCES = nhdl.c | ||
|
||
nhdl_LDADD = libnhdl.a | ||
# Force C++ linking | ||
nodist_EXTRA_nhdl_SOURCES = dummy.cxx | ||
|
||
nhdl_LDADD = libnhdl.a libcgen.a $(LLVM_LIBS) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Copyright (C) 2011 Nick Gasson | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
|
||
#include "phase.h" | ||
#include "util.h" | ||
|
||
#include <llvm-c/Core.h> | ||
#include <llvm-c/BitWriter.h> | ||
|
||
static LLVMModuleRef module = NULL; | ||
|
||
void cgen(tree_t top) | ||
{ | ||
if (tree_kind(top) != T_ELAB) | ||
fatal("cannot generate code for tree kind %d", tree_kind(top)); | ||
|
||
LLVMModuleCreateWithName("nhdl"); | ||
|
||
LLVMDisposeModule(module); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ | |
#include "tree.h" | ||
|
||
tree_t elab(tree_t top); | ||
void cgen(tree_t top); | ||
|
||
#endif // _PHASE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.