annotate gen/irstate.cpp @ 1650:40bd4a0d4870

Update to work with LLVM 2.7. Removed use of dyn_cast, llvm no compiles without exceptions and rtti by default. We do need exceptions for the libconfig stuff, but rtti isn't necessary (anymore). Debug info needs to be rewritten, as in LLVM 2.7 the format has completely changed. To have something to look at while rewriting, the old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means that you have to define this to compile at the moment. Updated tango 0.99.9 patch to include updated EH runtime code, which is needed for LLVM 2.7 as well.
author Tomas Lindquist Olsen
date Wed, 19 May 2010 12:42:32 +0200
parents 7f728c52e63c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
1 /* DMDFE backend stubs
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
2 * This file contains the implementations of the backend routines.
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
3 * For dmdfe these do nothing but print a message saying the module
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
4 * has been parsed. Substitute your own behaviors for these routimes.
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
5 */
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
6
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
7 #include <cstdarg>
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
8
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
9 #include "gen/llvm.h"
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
10
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
11 #include "mtype.h"
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
12 #include "declaration.h"
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 262
diff changeset
13 #include "statement.h"
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
14
4
e116aa1488e6 [svn r8] changed backend includes to always use the gen/<foo>.h prefix
lindquist
parents: 1
diff changeset
15 #include "gen/irstate.h"
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
16 #include "tollvm.h"
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
17
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
18 IRState* gIR = 0;
988
2667e3a145be - Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
19 llvm::TargetMachine* gTargetMachine = 0;
73
b706170e24a9 [svn r77] Fixed foreach on slice.
lindquist
parents: 54
diff changeset
20 const llvm::TargetData* gTargetData = 0;
988
2667e3a145be - Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
21 TargetABI* gABI = 0;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
22
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
23 //////////////////////////////////////////////////////////////////////////////////////////
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
24 IRScope::IRScope()
1535
61f12f4651b5 Don't use llvm::getGlobalContext() anymore
Benjamin Kramer <benny.kra@gmail.com>
parents: 1529
diff changeset
25 : builder(gIR->context())
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
26 {
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
27 begin = end = NULL;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
28 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
29
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
30 IRScope::IRScope(llvm::BasicBlock* b, llvm::BasicBlock* e)
1529
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
31 : builder(b)
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
32 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
33 begin = b;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
34 end = e;
1529
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
35 }
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
36
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
37 const IRScope& IRScope::operator=(const IRScope& rhs)
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
38 {
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
39 begin = rhs.begin;
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
40 end = rhs.end;
ad7f2f1862d6 Adjust LDC to work with the LLVMContext LLVM changes.
Christian Kamm <kamm incasoftware de>
parents: 1141
diff changeset
41 builder.SetInsertPoint(begin);
1586
7f728c52e63c Fix several 'reaches end of function' warnings by making fatal noreturn.
Christian Kamm <kamm incasoftware de>
parents: 1535
diff changeset
42 return *this;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
43 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
44
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
45 //////////////////////////////////////////////////////////////////////////////////////////
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1013
diff changeset
46 IRTargetScope::IRTargetScope()
145
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
47 {
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
48 }
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
49
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1013
diff changeset
50 IRTargetScope::IRTargetScope(Statement* s, EnclosingHandler* enclosinghandler, llvm::BasicBlock* continueTarget, llvm::BasicBlock* breakTarget)
145
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
51 {
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
52 this->s = s;
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 262
diff changeset
53 this->enclosinghandler = enclosinghandler;
1141
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1013
diff changeset
54 this->breakTarget = breakTarget;
f99a3b393c03 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
Christian Kamm <kamm incasoftware de>
parents: 1013
diff changeset
55 this->continueTarget = continueTarget;
145
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
56 }
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
57
8f704cb9969b [svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents: 136
diff changeset
58 //////////////////////////////////////////////////////////////////////////////////////////
946
1714836f2c0b Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Christian Kamm <kamm incasoftware de>
parents: 493
diff changeset
59 IRState::IRState(llvm::Module* m)
1714836f2c0b Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Christian Kamm <kamm incasoftware de>
parents: 493
diff changeset
60 : module(m), difactory(*m)
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
61 {
161
3a891cfcd249 [svn r177] moved variable for interface info type from being local static to being within IRState
ChristianK
parents: 148
diff changeset
62 interfaceInfoType = NULL;
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 262
diff changeset
63 mutexType = NULL;
323
0d52412d5b1a [svn r344] Fixed some very minor issues with the usage listing when calling llvmdc with no arguments.
lindquist
parents: 315
diff changeset
64 moduleRefType = NULL;
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 262
diff changeset
65
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
66 dmodule = 0;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
67 emitMain = false;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
68 mainFunc = 0;
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
69 ir.state = this;
233
76ee1bbe487e [svn r249] Changed inline asm clobbers to a set instead of a list so we don't get duplicate clobbers.
lindquist
parents: 232
diff changeset
70 asmBlock = NULL;
252
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 233
diff changeset
71
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 233
diff changeset
72 dwarfCUs = NULL;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 233
diff changeset
73 dwarfSPs = NULL;
e3355ce5444b [svn r269] Fixed dwarf debug info for structs.
lindquist
parents: 233
diff changeset
74 dwarfGVs = NULL;
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
75 }
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
76
136
0e28624814e8 [svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents: 113
diff changeset
77 IrFunction* IRState::func()
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
78 {
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
79 assert(!functions.empty() && "Function stack is empty!");
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
80 return functions.back();
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
81 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
82
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
83 llvm::Function* IRState::topfunc()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
84 {
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
85 assert(!functions.empty() && "Function stack is empty!");
100
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 94
diff changeset
86 return functions.back()->func;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
87 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
88
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
89 TypeFunction* IRState::topfunctype()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
90 {
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
91 assert(!functions.empty() && "Function stack is empty!");
100
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 94
diff changeset
92 return functions.back()->type;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
93 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
94
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
95 llvm::Instruction* IRState::topallocapoint()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
96 {
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
97 assert(!functions.empty() && "AllocaPoint stack is empty!");
100
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 94
diff changeset
98 return functions.back()->allocapoint;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
99 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
100
136
0e28624814e8 [svn r140] did a lot of the work towards being able to pass multiple modules on the command line. not complete yet though
lindquist
parents: 113
diff changeset
101 IrStruct* IRState::topstruct()
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
102 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
103 assert(!structs.empty() && "Struct vector is empty!");
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
104 return structs.back();
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
105 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
106
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
107 IRScope& IRState::scope()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
108 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
109 assert(!scopes.empty());
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
110 return scopes.back();
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
111 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
112
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
113 llvm::BasicBlock* IRState::scopebb()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
114 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
115 IRScope& s = scope();
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
116 assert(s.begin);
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
117 return s.begin;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
118 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
119 llvm::BasicBlock* IRState::scopeend()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
120 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
121 IRScope& s = scope();
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
122 assert(s.end);
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
123 return s.end;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
124 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
125 bool IRState::scopereturned()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
126 {
14
0e86428ee567 [svn r18] * Initial support for switch statements - No string switches yet.
lindquist
parents: 6
diff changeset
127 //return scope().returned;
0e86428ee567 [svn r18] * Initial support for switch statements - No string switches yet.
lindquist
parents: 6
diff changeset
128 return !scopebb()->empty() && scopebb()->back().isTerminator();
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
129 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
130
1013
8c73ff5f69e0 Use llvm::CallSite instead of custom CallOrInvoke class.
Frits van Bommel <fvbommel wxs.nl>
parents: 988
diff changeset
131 LLCallSite IRState::CreateCallOrInvoke(LLValue* Callee, const char* Name)
315
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
132 {
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
133 LLSmallVector<LLValue*, 1> args;
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
134 return CreateCallOrInvoke(Callee, args.begin(), args.end(), Name);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
135 }
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
136
1013
8c73ff5f69e0 Use llvm::CallSite instead of custom CallOrInvoke class.
Frits van Bommel <fvbommel wxs.nl>
parents: 988
diff changeset
137 LLCallSite IRState::CreateCallOrInvoke(LLValue* Callee, LLValue* Arg1, const char* Name)
315
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
138 {
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
139 LLSmallVector<LLValue*, 1> args;
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
140 args.push_back(Arg1);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
141 return CreateCallOrInvoke(Callee, args.begin(), args.end(), Name);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
142 }
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
143
1013
8c73ff5f69e0 Use llvm::CallSite instead of custom CallOrInvoke class.
Frits van Bommel <fvbommel wxs.nl>
parents: 988
diff changeset
144 LLCallSite IRState::CreateCallOrInvoke2(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, const char* Name)
315
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
145 {
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
146 LLSmallVector<LLValue*, 2> args;
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
147 args.push_back(Arg1);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
148 args.push_back(Arg2);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
149 return CreateCallOrInvoke(Callee, args.begin(), args.end(), Name);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
150 }
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
151
1013
8c73ff5f69e0 Use llvm::CallSite instead of custom CallOrInvoke class.
Frits van Bommel <fvbommel wxs.nl>
parents: 988
diff changeset
152 LLCallSite IRState::CreateCallOrInvoke3(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, const char* Name)
315
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
153 {
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
154 LLSmallVector<LLValue*, 3> args;
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
155 args.push_back(Arg1);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
156 args.push_back(Arg2);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
157 args.push_back(Arg3);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
158 return CreateCallOrInvoke(Callee, args.begin(), args.end(), Name);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
159 }
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
160
1013
8c73ff5f69e0 Use llvm::CallSite instead of custom CallOrInvoke class.
Frits van Bommel <fvbommel wxs.nl>
parents: 988
diff changeset
161 LLCallSite IRState::CreateCallOrInvoke4(LLValue* Callee, LLValue* Arg1, LLValue* Arg2, LLValue* Arg3, LLValue* Arg4, const char* Name)
315
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
162 {
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
163 LLSmallVector<LLValue*, 4> args;
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
164 args.push_back(Arg1);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
165 args.push_back(Arg2);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
166 args.push_back(Arg3);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
167 args.push_back(Arg4);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
168 return CreateCallOrInvoke(Callee, args.begin(), args.end(), Name);
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
169 }
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
170
a9697749e898 [svn r336] Made sure calls within a landing pad area are invokes.
ChristianK
parents: 311
diff changeset
171
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
172 //////////////////////////////////////////////////////////////////////////////////////////
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
173
493
017ca8645a1f Make llvmdc work with llvm 2.4svn revision 54614. Breaks compatibility with llvm 2.3.
Christian Kamm <kamm incasoftware de>
parents: 334
diff changeset
174 IRBuilder<>* IRBuilderHelper::operator->()
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
175 {
493
017ca8645a1f Make llvmdc work with llvm 2.4svn revision 54614. Breaks compatibility with llvm 2.3.
Christian Kamm <kamm incasoftware de>
parents: 334
diff changeset
176 IRBuilder<>& b = state->scope().builder;
40
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
177 assert(b.GetInsertBlock() != NULL);
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
178 return &b;
8b0e809563df [svn r44] Lots of bug fixes.
lindquist
parents: 31
diff changeset
179 }