Skip to content

Commit 562516e

Browse files
committed
---
yaml --- r: 15717 b: refs/heads/try c: 1135496 h: refs/heads/master i: 15715: db1d4c4 v: v3
1 parent 474f50b commit 562516e

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 1e410f6206cee9f75cc156fba1e467cad8f16fdc
5+
refs/heads/try: 11354963b3c532f0e4465be62191772398c14c70
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/lib/llvm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ native mod llvm {
766766
fn LLVMAddTargetData(TD: TargetDataRef, PM: PassManagerRef);
767767
/** Returns the size of a type. FIXME: rv is actually a C_Ulonglong! */
768768
fn LLVMStoreSizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
769+
fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
769770
/** Returns the preferred alignment of a type. */
770771
fn LLVMPreferredAlignmentOfType(TD: TargetDataRef,
771772
Ty: TypeRef) -> c_uint;

branches/try/src/rustc/middle/trans/native.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ fn classify_ty(ty: TypeRef) -> [x86_64_reg_class] {
8181
uint::max(a, ty_align(t))
8282
}
8383
}
84+
11 /* array */ {
85+
let elt = llvm::LLVMGetElementType(ty);
86+
ty_align(elt)
87+
}
8488
_ {
8589
fail "ty_size: unhandled type"
8690
}
@@ -100,6 +104,12 @@ fn classify_ty(ty: TypeRef) -> [x86_64_reg_class] {
100104
s + ty_size(t)
101105
}
102106
}
107+
11 /* array */ {
108+
let len = llvm::LLVMGetArrayLength(ty) as uint;
109+
let elt = llvm::LLVMGetElementType(ty);
110+
let eltsz = ty_size(elt);
111+
len * eltsz
112+
}
103113
_ {
104114
fail "ty_size: unhandled type"
105115
}
@@ -187,6 +197,16 @@ fn classify_ty(ty: TypeRef) -> [x86_64_reg_class] {
187197
10 /* struct */ {
188198
classify_struct(struct_tys(ty), cls, i, off);
189199
}
200+
11 /* array */ {
201+
// FIXME: I HAVE NO IDEA WHAT I AM DOING THIS MUST BE WRONG
202+
let len = llvm::LLVMGetArrayLength(ty) as uint;
203+
if len == 0u {
204+
} else {
205+
let elt = llvm::LLVMGetElementType(ty);
206+
let tys = vec::from_elem(len, elt);
207+
classify_struct(tys, cls, i, off);
208+
}
209+
}
190210
_ {
191211
fail "classify: unhandled type";
192212
}

branches/try/src/rustc/middle/trans/shape.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ fn llsize_of_real(cx: @crate_ctxt, t: TypeRef) -> uint {
630630
ret llvm::LLVMStoreSizeOfType(cx.td.lltd, t) as uint;
631631
}
632632

633+
fn llsize_of_alloc(cx: @crate_ctxt, t: TypeRef) -> uint {
634+
ret llvm::LLVMABISizeOfType(cx.td.lltd, t) as uint;
635+
}
636+
633637
// Returns the preferred alignment of the given type for the current target.
634638
// The preffered alignment may be larger than the alignment used when
635639
// packing the type into structs
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Passing enums by value
2+
3+
enum void { }
4+
5+
#[nolink]
6+
native mod bindgen {
7+
fn printf(++v: void);
8+
}
9+
10+
fn main() { }

0 commit comments

Comments
 (0)