summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-20 08:06:05 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-20 08:06:35 +0100
commitb19ebd8c84c58c3b19c13a20f4efe180e41ac540 (patch)
tree7f8d25e783a345fda6ee283aa308f534fac5eb9d
parent9933b78872f59fd092be0b473d9ca7e7f757e1c3 (diff)
parent6bbd00570d30de615e695f00f40c6592b76fd8ed (diff)
downloadsparse-b19ebd8c84c58c3b19c13a20f4efe180e41ac540.tar.gz
Merge branch 'cleanup'
* small build cleanup related to LLVM * build: only need includedir from llvm-config * build: check if sparse-llvm needs libc++ * small cleanup * remove unneeded declarations in "compat.h" * remove unused arg in add_branch() * allocate BBs only after initial checks in linearize_short_conditional()
-rw-r--r--Makefile3
-rw-r--r--compat.h2
-rw-r--r--linearize.c12
3 files changed, 9 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 01342343..e3e9bc64 100644
--- a/Makefile
+++ b/Makefile
@@ -160,9 +160,10 @@ ifeq ($(shell expr "$(LLVM_VERSION)" : '[3-9]\.'),2)
LLVM_PROGS := sparse-llvm
$(LLVM_PROGS): LD := g++
LLVM_LDFLAGS := $(shell $(LLVM_CONFIG) --ldflags)
-LLVM_CFLAGS := $(shell $(LLVM_CONFIG) --cflags | sed -e "s/-DNDEBUG//g" | sed -e "s/-pedantic//g")
+LLVM_CFLAGS := -I$(shell $(LLVM_CONFIG) --includedir)
LLVM_LIBS := $(shell $(LLVM_CONFIG) --libs)
LLVM_LIBS += $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null)
+LLVM_LIBS += $(shell $(LLVM_CONFIG) --cxxflags | grep -F -q -e '-stdlib=libc++' && echo -lc++)
PROGRAMS += $(LLVM_PROGS)
INST_PROGRAMS += sparse-llvm sparsec
sparse-llvm-cflags := $(LLVM_CFLAGS)
diff --git a/compat.h b/compat.h
index 9814ae3e..4bba47ad 100644
--- a/compat.h
+++ b/compat.h
@@ -10,8 +10,6 @@
* - "string to long double" (C99 strtold())
* Missing in Solaris and MinGW
*/
-struct stream;
-struct stat;
/*
* Our "blob" allocator works on chunks that are multiples
diff --git a/linearize.c b/linearize.c
index ac913131..d0b0d3a8 100644
--- a/linearize.c
+++ b/linearize.c
@@ -756,7 +756,7 @@ static struct basic_block * add_label(struct entrypoint *ep, struct symbol *labe
return bb;
}
-static void add_branch(struct entrypoint *ep, struct expression *expr, pseudo_t cond, struct basic_block *bb_true, struct basic_block *bb_false)
+static void add_branch(struct entrypoint *ep, pseudo_t cond, struct basic_block *bb_true, struct basic_block *bb_false)
{
struct basic_block *bb = ep->active;
struct instruction *br;
@@ -1646,16 +1646,18 @@ static pseudo_t linearize_short_conditional(struct entrypoint *ep, struct expres
{
pseudo_t src1, src2;
struct basic_block *bb_false;
- struct basic_block *merge = alloc_basic_block(ep, expr->pos);
+ struct basic_block *merge;
pseudo_t phi1, phi2;
if (!expr_false || !ep->active)
return VOID;
bb_false = alloc_basic_block(ep, expr_false->pos);
+ merge = alloc_basic_block(ep, expr->pos);
+
src1 = linearize_expression(ep, cond);
phi1 = alloc_phi(ep->active, src1, expr->ctype);
- add_branch(ep, expr, src1, merge, bb_false);
+ add_branch(ep, src1, merge, bb_false);
set_activeblock(ep, bb_false);
src2 = linearize_expression(ep, expr_false);
@@ -1790,7 +1792,7 @@ static pseudo_t linearize_cond_branch(struct entrypoint *ep, struct expression *
case EXPR_COMPARE:
cond = linearize_compare(ep, expr);
- add_branch(ep, expr, cond, bb_true, bb_false);
+ add_branch(ep, cond, bb_true, bb_false);
break;
case EXPR_PREOP:
@@ -1799,7 +1801,7 @@ static pseudo_t linearize_cond_branch(struct entrypoint *ep, struct expression *
/* fall through */
default: {
cond = linearize_expression_to_bool(ep, expr);
- add_branch(ep, expr, cond, bb_true, bb_false);
+ add_branch(ep, cond, bb_true, bb_false);
return VOID;
}