aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-05-04 18:28:30 -0700
committerPatrick Walton <[email protected]>2011-05-04 18:29:08 -0700
commit04f966f0bc8d092a000e5b6dad0bdd3353ec4efe (patch)
treec958e9b9b37c6b687312137f34d2b561fb3ad49d
parentAdd stage-specific test targets (make check-stage1 etc.) (diff)
downloadrust-04f966f0bc8d092a000e5b6dad0bdd3353ec4efe.tar.xz
rust-04f966f0bc8d092a000e5b6dad0bdd3353ec4efe.zip
build: Build intrinsics.bc
-rw-r--r--Makefile.in11
-rwxr-xr-xconfigure7
-rw-r--r--mk/stage0.mk6
-rw-r--r--mk/stage1.mk10
-rw-r--r--mk/stage2.mk11
-rw-r--r--mk/stage3.mk9
-rw-r--r--src/rt/intrinsics/intrinsics.ll.in2
7 files changed, 48 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in
index 676b4cfb..fe01d9ac 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -137,6 +137,12 @@ SREQ2 := stage2/rustc$(X) $(LREQ) stage3/glue.o stage3/$(CFG_STDLIB)
export CFG_SRC_DIR
+######################################################################
+# Subprograms
+######################################################################
+
+LLVM_AS := $(CFG_LLVM_BINDIR)/llvm-as
+
######################################################################
# Single-target rules
@@ -145,17 +151,21 @@ export CFG_SRC_DIR
all: rt/$(CFG_RUNTIME) \
rustllvm/$(CFG_RUSTLLVM) \
stage0/$(CFG_STDLIB) \
+ stage0/intrinsics.bc \
stage0/rustc$(X) \
$(GENERATED) \
$(DOCS) \
stage1/$(CFG_STDLIB) \
+ stage1/intrinsics.bc \
stage1/glue.o \
stage1/rustc$(X) \
stage2/$(CFG_STDLIB) \
+ stage2/intrinsics.bc \
stage2/glue.o \
stage2/rustc$(X) \
stage3/$(CFG_STDLIB) \
stage3/glue.o \
+ stage3/intrinsics.bc \
stage3/rustc$(X)
@@ -172,6 +182,7 @@ config.mk: $(S)configure $(S)Makefile.in
# Additional makefiles
######################################################################
+include $(CFG_SRC_DIR)/mk/intrinsics.mk
include $(CFG_SRC_DIR)/mk/stage0.mk
include $(CFG_SRC_DIR)/mk/stage1.mk
include $(CFG_SRC_DIR)/mk/stage2.mk
diff --git a/configure b/configure
index a2d6063a..a359de9c 100755
--- a/configure
+++ b/configure
@@ -122,6 +122,7 @@ need_cmd find
need_cmd uname
need_cmd date
need_cmd tr
+need_cmd sed
msg "inspecting environment"
@@ -215,6 +216,10 @@ then
--version \
| grep version \
| cut -d ' ' -f 5-)
+ CFG_LLVM_TRIPLE=$("$CFG_LLVM_BINDIR/llc" \
+ --version \
+ | grep Host: \
+ | cut -d ' ' -f 4-)
elif [ ! -z "$CFG_LLVM_CONFIG" ]
then
CFG_LLVM_VERSION=$(llvm-config --version)
@@ -224,6 +229,7 @@ then
CFG_LLVM_CXXFLAGS=$(llvm-config --cxxflags)
CFG_LLVM_LDFLAGS=$(llvm-config --ldflags)
CFG_LLVM_LIBS=$(llvm-config --libs)
+ CFG_LLVM_TRIPLE=$(llvm-config --host-target)
else
err "either the \"CFG_LLVM_ROOT\" environment variable must be set, or a \
\"llvm-config\" script must be present"
@@ -244,6 +250,7 @@ putvar CFG_LLVM_LIBDIR
putvar CFG_LLVM_CXXFLAGS
putvar CFG_LLVM_LDFLAGS
putvar CFG_LLVM_LIBS
+putvar CFG_LLVM_TRIPLE
# Munge any paths that appear in config.mk back to posix-y
perl -i.bak -p -e 's@ ([a-zA-Z]):[/\\]@ /\1/@go;' \
diff --git a/mk/stage0.mk b/mk/stage0.mk
index 493f9e00..e79ae843 100644
--- a/mk/stage0.mk
+++ b/mk/stage0.mk
@@ -10,3 +10,9 @@ stage0/glue.o: stage0/rustc$(X)
stage0/$(CFG_STDLIB): stage0/rustc$(X)
$(Q)touch $@
+
+# TODO: Include as part of the snapshot.
+stage0/intrinsics.bc: $(INTRINSICS_BC)
+ @$(call E, cp: $@)
+ $(Q)cp $< $@
+
diff --git a/mk/stage1.mk b/mk/stage1.mk
index e01942a5..eb30e782 100644
--- a/mk/stage1.mk
+++ b/mk/stage1.mk
@@ -1,5 +1,6 @@
stage1/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
- stage0/rustc$(X) stage0/$(CFG_STDLIB) $(LREQ) $(MKFILES)
+ stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
+ $(LREQ) $(MKFILES)
@$(call E, compile: $@)
$(STAGE0) -c --shared -o $@ $<
@@ -12,10 +13,15 @@ stage1/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ0)
@$(call E, compile: $@)
$(STAGE0) -c -o $@ $<
-stage1/glue.o: stage0/rustc$(X) stage0/$(CFG_STDLIB) $(LREQ) $(MKFILES)
+stage1/glue.o: stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
+ $(LREQ) $(MKFILES)
@$(call E, generate: $@)
$(STAGE0) -c -o $@ --glue
+stage1/intrinsics.bc: $(INTRINSICS_BC)
+ @$(call E, cp: $@)
+ $(Q)cp $< $@
+
# Due to make not wanting to run the same implicit rules twice on the same
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
diff --git a/mk/stage2.mk b/mk/stage2.mk
index 600d55e4..74e76c3c 100644
--- a/mk/stage2.mk
+++ b/mk/stage2.mk
@@ -1,4 +1,5 @@
-stage2/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage1/rustc$(X) $(MKFILES)
+stage2/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage1/rustc$(X) \
+ stage1/intrinsics.bc $(MKFILES)
@$(call E, compile: $@)
$(STAGE1) -c --shared -o $@ $<
@@ -11,11 +12,15 @@ stage2/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ1)
@$(call E, compile: $@)
$(STAGE1) -c -o $@ $<
-stage2/glue.o: stage1/rustc$(X) stage1/$(CFG_STDLIB) \
- rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
+stage2/glue.o: stage1/rustc$(X) stage1/$(CFG_STDLIB) stage1/intrinsics.bc \
+ rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
@$(call E, generate: $@)
$(STAGE1) -c -o $@ --glue
+stage2/intrinsics.bc: $(INTRINSICS_BC)
+ @$(call E, cp: $@)
+ $(Q)cp $< $@
+
# Due to make not wanting to run the same implicit rules twice on the same
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
diff --git a/mk/stage3.mk b/mk/stage3.mk
index 8f56637e..427f37f8 100644
--- a/mk/stage3.mk
+++ b/mk/stage3.mk
@@ -1,4 +1,5 @@
-stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage2/rustc$(X) $(MKFILES)
+stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage2/rustc$(X) \
+ stage2/intrinsics.bc $(MKFILES)
@$(call E, compile: $@)
$(STAGE2) -c --shared -o $@ $<
@@ -11,11 +12,15 @@ stage3/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ2)
@$(call E, compile: $@)
$(STAGE2) -c -o $@ $<
-stage3/glue.o: stage2/rustc$(X) stage2/$(CFG_STDLIB) \
+stage3/glue.o: stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/intrinsics.bc \
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
@$(call E, generate: $@)
$(STAGE2) -c -o $@ --glue
+stage3/intrinsics.bc: $(INTRINSICS_BC)
+ @$(call E, cp: $@)
+ $(Q)cp $< $@
+
# Due to make not wanting to run the same implicit rules twice on the same
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
diff --git a/src/rt/intrinsics/intrinsics.ll.in b/src/rt/intrinsics/intrinsics.ll.in
index ebd5d15c..2a05555e 100644
--- a/src/rt/intrinsics/intrinsics.ll.in
+++ b/src/rt/intrinsics/intrinsics.ll.in
@@ -1,6 +1,6 @@
; ModuleID = 'intrinsics.cpp'
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
-target triple = "$(LLVM_TRIPLE)"
+target triple = "@CFG_LLVM_TRIPLE@"
%0 = type { i32, i8**, i32 }
%1 = type { %"struct.hash_map<rust_task *, rust_handle<rust_task> *>::map_entry"* }