annotate gen/dvalue.cpp @ 1605:1d5721f9ae18

[WIP] Merge DMD r251: bugzilla 111 (appending a dchar to a char[]) This patch needs some work in the code generation, because of the runtime changes (functions "_d_arrayappendcd" and "_d_arrayappendwd" are added). This doesn't affect existing code though, it just makes with patch a little useless, because something like this: char [] s; s ~= '\u6211'; That failed to compile with a nice error message previously to this change, now fails with and ugly error message (a failed assertion). Apparently there is a regression introduced by this patch too, when compiling Dil I get this assertion message: ldc: /home/luca/tesis/ldc/gen/statements.cpp:132: virtual void ReturnStatement::toIR(IRState*): Assertion `p->topfunc()->getReturnType() == llvm::Type::getVoidTy(gIR->context())' failed. 0 ldc 0x08a91628 Thank god we have bisecting capabilities in VCSs now ;) --- dmd/expression.c | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 41 insertions(+), 6 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:19 -0300
parents f5729209a1d4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
1 #include "gen/llvm.h"
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
2
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
3 #include "gen/tollvm.h"
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
4 #include "gen/irstate.h"
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
5 #include "gen/logger.h"
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
6 #include "gen/dvalue.h"
585
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
7 #include "gen/llvmhelpers.h"
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
8
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 334
diff changeset
9 #include "declaration.h"
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 334
diff changeset
10
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
11 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
12 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
13
585
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
14 DVarValue::DVarValue(Type* t, VarDeclaration* vd, LLValue* llvmValue)
1180
f5729209a1d4 Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'
Frits van Bommel <fvbommel wxs.nl>
parents: 1151
diff changeset
15 : DValue(t), var(vd), val(llvmValue)
f5729209a1d4 Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'
Frits van Bommel <fvbommel wxs.nl>
parents: 1151
diff changeset
16 {}
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
17
585
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
18 DVarValue::DVarValue(Type* t, LLValue* llvmValue)
1180
f5729209a1d4 Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'
Frits van Bommel <fvbommel wxs.nl>
parents: 1151
diff changeset
19 : DValue(t), var(0), val(llvmValue)
f5729209a1d4 Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'
Frits van Bommel <fvbommel wxs.nl>
parents: 1151
diff changeset
20 {}
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
21
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 172
diff changeset
22 LLValue* DVarValue::getLVal()
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
23 {
585
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
24 assert(val);
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
25 return val;
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
26 }
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
27
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 172
diff changeset
28 LLValue* DVarValue::getRVal()
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
29 {
585
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
30 assert(val);
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
31 Type* bt = type->toBasetype();
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
32 if (DtoIsPassedByRef(bt))
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
33 return val;
585
fbb1a366cfbc Complex number should now follow the D ABI on x86. They're also treated as first class values now. Big change.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 468
diff changeset
34 return DtoLoad(val);
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
35 }
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
36
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
37 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
38 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
39
715
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
40 LLValue* DSliceValue::getRVal()
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
41 {
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
42 assert(len);
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
43 assert(ptr);
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
44 return DtoAggrPair(len, ptr);
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
45 }
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
46
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
47 /////////////////////////////////////////////////////////////////////////////////////////////////
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
48 /////////////////////////////////////////////////////////////////////////////////////////////////
30b42a283c8e Removed TypeOpaque from DMD.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 601
diff changeset
49
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 172
diff changeset
50 DFuncValue::DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt)
1180
f5729209a1d4 Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'
Frits van Bommel <fvbommel wxs.nl>
parents: 1151
diff changeset
51 : DValue(fd->type), func(fd), val(v), vthis(vt)
f5729209a1d4 Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'
Frits van Bommel <fvbommel wxs.nl>
parents: 1151
diff changeset
52 {}
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
53
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 172
diff changeset
54 LLValue* DFuncValue::getRVal()
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
55 {
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
56 assert(val);
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
57 return val;
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
58 }
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
59
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
60 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
61 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
62
213
7816aafeea3c [svn r229] Updated the object.d implementation to the latest Tango.
lindquist
parents: 172
diff changeset
63 LLValue* DConstValue::getRVal()
88
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
64 {
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
65 assert(c);
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
66 return c;
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
67 }
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
68
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
69 /////////////////////////////////////////////////////////////////////////////////////////////////
058d3925950e [svn r92] Fixed support for statically initialized unions. lots of bugfixes as cleanups too.
lindquist
parents:
diff changeset
70 /////////////////////////////////////////////////////////////////////////////////////////////////