annotate gen/dvalue.cpp @ 1351:8d501abecd24

Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Thu, 14 May 2009 17:20:17 +0200
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 /////////////////////////////////////////////////////////////////////////////////////////////////