Mercurial > projects > ldc
comparison gen/dvalue.cpp @ 213:7816aafeea3c trunk
[svn r229] Updated the object.d implementation to the latest Tango.
Fixed a bunch of the built-in typeinfos for arrays, they did not inherit TypeInfo_Array.
Applied patch to tango/text/convert/Layout.d by fvbommel, closes #47 .
Cleaned up some type code.
Replaced uses of llvm::Type with LLType (a typedef), same for Value and Constant.
Fixed a few cases where typeinfo for user structs could be emitted multiple times, seems to still be some cases of this :/
author | lindquist |
---|---|
date | Fri, 30 May 2008 19:32:04 +0200 |
parents | 68a7dd38c03c |
children | 20446d22f832 |
comparison
equal
deleted
inserted
replaced
212:4c2689d57ba4 | 213:7816aafeea3c |
---|---|
8 #include "gen/dvalue.h" | 8 #include "gen/dvalue.h" |
9 | 9 |
10 ///////////////////////////////////////////////////////////////////////////////////////////////// | 10 ///////////////////////////////////////////////////////////////////////////////////////////////// |
11 ///////////////////////////////////////////////////////////////////////////////////////////////// | 11 ///////////////////////////////////////////////////////////////////////////////////////////////// |
12 | 12 |
13 DVarValue::DVarValue(VarDeclaration* vd, llvm::Value* llvmValue, bool lvalue) | 13 DVarValue::DVarValue(VarDeclaration* vd, LLValue* llvmValue, bool lvalue) |
14 { | 14 { |
15 var = vd; | 15 var = vd; |
16 val = llvmValue; | 16 val = llvmValue; |
17 rval = 0; | 17 rval = 0; |
18 lval = lvalue; | 18 lval = lvalue; |
19 type = var->type; | 19 type = var->type; |
20 } | 20 } |
21 | 21 |
22 DVarValue::DVarValue(Type* t, llvm::Value* lv, llvm::Value* rv) | 22 DVarValue::DVarValue(Type* t, LLValue* lv, LLValue* rv) |
23 { | 23 { |
24 var = 0; | 24 var = 0; |
25 val = lv; | 25 val = lv; |
26 rval = rv; | 26 rval = rv; |
27 lval = true; | 27 lval = true; |
28 type = t; | 28 type = t; |
29 } | 29 } |
30 | 30 |
31 DVarValue::DVarValue(Type* t, llvm::Value* llvmValue, bool lvalue) | 31 DVarValue::DVarValue(Type* t, LLValue* llvmValue, bool lvalue) |
32 { | 32 { |
33 var = 0; | 33 var = 0; |
34 val = llvmValue; | 34 val = llvmValue; |
35 rval = 0; | 35 rval = 0; |
36 lval = lvalue; | 36 lval = lvalue; |
37 type = t; | 37 type = t; |
38 } | 38 } |
39 | 39 |
40 llvm::Value* DVarValue::getLVal() | 40 LLValue* DVarValue::getLVal() |
41 { | 41 { |
42 assert(val && lval); | 42 assert(val && lval); |
43 return val; | 43 return val; |
44 } | 44 } |
45 | 45 |
46 llvm::Value* DVarValue::getRVal() | 46 LLValue* DVarValue::getRVal() |
47 { | 47 { |
48 assert(rval || val); | 48 assert(rval || val); |
49 if (DtoIsPassedByRef(type)) { | 49 if (DtoIsPassedByRef(type)) { |
50 if (rval) return rval; | 50 if (rval) return rval; |
51 return val; | 51 return val; |
61 } | 61 } |
62 | 62 |
63 ///////////////////////////////////////////////////////////////////////////////////////////////// | 63 ///////////////////////////////////////////////////////////////////////////////////////////////// |
64 ///////////////////////////////////////////////////////////////////////////////////////////////// | 64 ///////////////////////////////////////////////////////////////////////////////////////////////// |
65 | 65 |
66 DFuncValue::DFuncValue(FuncDeclaration* fd, llvm::Value* v, llvm::Value* vt) | 66 DFuncValue::DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt) |
67 { | 67 { |
68 func = fd; | 68 func = fd; |
69 type = func->type; | 69 type = func->type; |
70 val = v; | 70 val = v; |
71 vthis = vt; | 71 vthis = vt; |
72 cc = (unsigned)-1; | 72 cc = (unsigned)-1; |
73 } | 73 } |
74 | 74 |
75 llvm::Value* DFuncValue::getLVal() | 75 LLValue* DFuncValue::getLVal() |
76 { | 76 { |
77 assert(0); | 77 assert(0); |
78 return 0; | 78 return 0; |
79 } | 79 } |
80 | 80 |
81 llvm::Value* DFuncValue::getRVal() | 81 LLValue* DFuncValue::getRVal() |
82 { | 82 { |
83 assert(val); | 83 assert(val); |
84 return val; | 84 return val; |
85 } | 85 } |
86 | 86 |
87 ///////////////////////////////////////////////////////////////////////////////////////////////// | 87 ///////////////////////////////////////////////////////////////////////////////////////////////// |
88 ///////////////////////////////////////////////////////////////////////////////////////////////// | 88 ///////////////////////////////////////////////////////////////////////////////////////////////// |
89 | 89 |
90 llvm::Value* DConstValue::getRVal() | 90 LLValue* DConstValue::getRVal() |
91 { | 91 { |
92 assert(c); | 92 assert(c); |
93 return c; | 93 return c; |
94 } | 94 } |
95 | 95 |