aboutsummaryrefslogtreecommitdiff
path: root/src/comp/back
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-09-23 17:16:34 -0700
committerGraydon Hoare <[email protected]>2010-09-23 17:16:34 -0700
commit2db1f864e23e38d26b6dfb1e0a00829122a6aefd (patch)
treea202f8803da270d30401db8d39b0f01b6632df86 /src/comp/back
parentResolve constant types through to their definitions. (diff)
downloadrust-2db1f864e23e38d26b6dfb1e0a00829122a6aefd.tar.xz
rust-2db1f864e23e38d26b6dfb1e0a00829122a6aefd.zip
Declare the global and upcall glues as ValueRefs in rustc's trans.
Diffstat (limited to 'src/comp/back')
-rw-r--r--src/comp/back/abi.rs2
-rw-r--r--src/comp/back/x86.rs28
2 files changed, 15 insertions, 15 deletions
diff --git a/src/comp/back/abi.rs b/src/comp/back/abi.rs
index 157bf876..1a349a7b 100644
--- a/src/comp/back/abi.rs
+++ b/src/comp/back/abi.rs
@@ -34,6 +34,8 @@ const int calltup_elt_iterator_args = 5;
const int worst_case_glue_call_args = 7;
+const int n_upcall_glues = 7;
+
//
// Local Variables:
// mode: rust
diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs
index fcf65cc0..bfe50200 100644
--- a/src/comp/back/x86.rs
+++ b/src/comp/back/x86.rs
@@ -1,15 +1,11 @@
import lib.llvm.llvm;
import lib.llvm.llvm.ModuleRef;
import std._str;
-import std._int;
import std._vec;
+import util.common.istr;
const int wordsz = 4;
-fn istr(int i) -> str {
- ret _int.to_str(i, 10u);
-}
-
fn wstr(int i) -> str {
ret istr(i * wordsz);
}
@@ -122,6 +118,13 @@ fn decl_glue(int align, str prefix, str name, vec[str] insns) -> str {
}
+fn decl_upcall_glue(int align, str prefix, uint n) -> str {
+ let int i = n as int;
+ ret decl_glue(align, prefix,
+ "rust_upcall_" + istr(i),
+ upcall_glue(i));
+}
+
fn get_module_asm() -> str {
auto align = 4;
auto prefix = "";
@@ -133,20 +136,15 @@ fn get_module_asm() -> str {
decl_glue(align, prefix,
"rust_yield_glue",
- rust_yield_glue()));
-
- let int i = 0;
- let int n_upcall_glues = 7;
- while (i < n_upcall_glues) {
- glues += decl_glue(align, prefix,
- "rust_upcall_" + istr(i),
- upcall_glue(i));
- i += 1;
- }
+ rust_yield_glue()))
+
+ + _vec.init_fn[str](bind decl_upcall_glue(align, prefix, _),
+ abi.n_upcall_glues as uint);
ret _str.connect(glues, "\n\n");
}
+
//
// Local Variables:
// mode: rust