comparison gen/binops.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 4d1e9eb001e0
children a95056b3c996
comparison
equal deleted inserted replaced
212:4c2689d57ba4 213:7816aafeea3c
8 8
9 ////////////////////////////////////////////////////////////////////////////// 9 //////////////////////////////////////////////////////////////////////////////
10 10
11 DValue* DtoBinAdd(DValue* lhs, DValue* rhs) 11 DValue* DtoBinAdd(DValue* lhs, DValue* rhs)
12 { 12 {
13 llvm::Value* v = gIR->ir->CreateAdd(lhs->getRVal(), rhs->getRVal(), "tmp"); 13 LLValue* v = gIR->ir->CreateAdd(lhs->getRVal(), rhs->getRVal(), "tmp");
14 return new DImValue( lhs->getType(), v ); 14 return new DImValue( lhs->getType(), v );
15 } 15 }
16 16
17 ////////////////////////////////////////////////////////////////////////////// 17 //////////////////////////////////////////////////////////////////////////////
18 18
19 DValue* DtoBinSub(DValue* lhs, DValue* rhs) 19 DValue* DtoBinSub(DValue* lhs, DValue* rhs)
20 { 20 {
21 llvm::Value* v = gIR->ir->CreateSub(lhs->getRVal(), rhs->getRVal(), "tmp"); 21 LLValue* v = gIR->ir->CreateSub(lhs->getRVal(), rhs->getRVal(), "tmp");
22 return new DImValue( lhs->getType(), v ); 22 return new DImValue( lhs->getType(), v );
23 } 23 }
24 24
25 ////////////////////////////////////////////////////////////////////////////// 25 //////////////////////////////////////////////////////////////////////////////
26 26
27 DValue* DtoBinMul(DValue* lhs, DValue* rhs) 27 DValue* DtoBinMul(DValue* lhs, DValue* rhs)
28 { 28 {
29 llvm::Value* v = gIR->ir->CreateMul(lhs->getRVal(), rhs->getRVal(), "tmp"); 29 LLValue* v = gIR->ir->CreateMul(lhs->getRVal(), rhs->getRVal(), "tmp");
30 return new DImValue( lhs->getType(), v ); 30 return new DImValue( lhs->getType(), v );
31 } 31 }
32 32
33 ////////////////////////////////////////////////////////////////////////////// 33 //////////////////////////////////////////////////////////////////////////////
34 34
36 { 36 {
37 Type* t = lhs->getType(); 37 Type* t = lhs->getType();
38 llvm::Value *l, *r; 38 llvm::Value *l, *r;
39 l = lhs->getRVal(); 39 l = lhs->getRVal();
40 r = rhs->getRVal(); 40 r = rhs->getRVal();
41 llvm::Value* res; 41 LLValue* res;
42 if (t->isfloating()) 42 if (t->isfloating())
43 res = gIR->ir->CreateFDiv(l, r, "tmp"); 43 res = gIR->ir->CreateFDiv(l, r, "tmp");
44 else if (!t->isunsigned()) 44 else if (!t->isunsigned())
45 res = gIR->ir->CreateSDiv(l, r, "tmp"); 45 res = gIR->ir->CreateSDiv(l, r, "tmp");
46 else 46 else
54 { 54 {
55 Type* t = lhs->getType(); 55 Type* t = lhs->getType();
56 llvm::Value *l, *r; 56 llvm::Value *l, *r;
57 l = lhs->getRVal(); 57 l = lhs->getRVal();
58 r = rhs->getRVal(); 58 r = rhs->getRVal();
59 llvm::Value* res; 59 LLValue* res;
60 if (t->isfloating()) 60 if (t->isfloating())
61 res = gIR->ir->CreateFRem(l, r, "tmp"); 61 res = gIR->ir->CreateFRem(l, r, "tmp");
62 else if (!t->isunsigned()) 62 else if (!t->isunsigned())
63 res = gIR->ir->CreateSRem(l, r, "tmp"); 63 res = gIR->ir->CreateSRem(l, r, "tmp");
64 else 64 else