annotate ir/irfunction.cpp @ 1042:45af482e3832

Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 04 Mar 2009 17:24:25 +0100
parents 9167d492cbc2
children 32ead42679d1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
309
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 207
diff changeset
1
d59c363fccad [svn r330] Implemented synchronized statements.
lindquist
parents: 207
diff changeset
2 #include "gen/llvm.h"
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:
diff changeset
3 #include "gen/tollvm.h"
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
4 #include "gen/abi.h"
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
5 #include "gen/dvalue.h"
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:
diff changeset
6 #include "ir/irfunction.h"
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:
diff changeset
7
355
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
8 #include <sstream>
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
9
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:
diff changeset
10 //////////////////////////////////////////////////////////////////////////////
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:
diff changeset
11 //////////////////////////////////////////////////////////////////////////////
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:
diff changeset
12 //////////////////////////////////////////////////////////////////////////////
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:
diff changeset
13
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
14 IrFuncTyArg::IrFuncTyArg(Type* t, bool bref, unsigned a)
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
15 {
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
16 type = t;
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
17 ltype = bref ? DtoType(t->pointerTo()) : DtoType(t);
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
18 attrs = a;
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
19 byref = bref;
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
20 rewrite = NULL;
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
21 }
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
22
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
23 //////////////////////////////////////////////////////////////////////////////
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
24 //////////////////////////////////////////////////////////////////////////////
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
26
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
27 llvm::Value* IrFuncTy::putRet(Type* dty, DValue* val)
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
28 {
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
29 assert(!arg_sret);
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
30 if (ret->rewrite)
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
31 return ret->rewrite->put(dty, val);
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
32 return val->getRVal();
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
33 }
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
34
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
35 llvm::Value* IrFuncTy::getRet(Type* dty, DValue* val)
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
36 {
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
37 assert(!arg_sret);
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
38 if (ret->rewrite)
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
39 return ret->rewrite->get(dty, val);
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
40 return val->getRVal();
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
41 }
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
42
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
43 llvm::Value* IrFuncTy::putParam(Type* dty, int idx, DValue* val)
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
44 {
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
45 assert(idx >= 0 && idx < args.size() && "invalid putParam");
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
46 if (args[idx]->rewrite)
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
47 return args[idx]->rewrite->put(dty, val);
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
48 return val->getRVal();
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
49 }
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
50
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
51 llvm::Value* IrFuncTy::getParam(Type* dty, int idx, DValue* val)
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
52 {
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
53 assert(idx >= 0 && idx < args.size() && "invalid getParam");
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
54 if (args[idx]->rewrite)
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
55 return args[idx]->rewrite->get(dty, val);
1042
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
56 return val->getRVal();
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
57 }
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
58
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
59 void IrFuncTy::getParam(Type* dty, int idx, DValue* val, llvm::Value* lval)
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
60 {
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
61 assert(idx >= 0 && idx < args.size() && "invalid getParam");
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
62
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
63 if (args[idx]->rewrite)
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
64 {
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
65 args[idx]->rewrite->getL(dty, val, lval);
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
66 return;
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
67 }
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
68
45af482e3832 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 1024
diff changeset
69 DtoStore(val->getRVal(), lval);
1024
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
70 }
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
71
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
72 //////////////////////////////////////////////////////////////////////////////
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
73 //////////////////////////////////////////////////////////////////////////////
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
74 //////////////////////////////////////////////////////////////////////////////
9167d492cbc2 Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 946
diff changeset
75
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:
diff changeset
76 IrFunction::IrFunction(FuncDeclaration* fd)
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:
diff changeset
77 {
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:
diff changeset
78 decl = fd;
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:
diff changeset
79
486
a34078905d01 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 355
diff changeset
80 Type* t = fd->type->toBasetype();
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:
diff changeset
81 assert(t->ty == Tfunction);
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:
diff changeset
82 type = (TypeFunction*)t;
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:
diff changeset
83 func = NULL;
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:
diff changeset
84 allocapoint = NULL;
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:
diff changeset
85
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:
diff changeset
86 queued = false;
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:
diff changeset
87 defined = false;
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:
diff changeset
88
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:
diff changeset
89 retArg = NULL;
486
a34078905d01 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 355
diff changeset
90 thisArg = NULL;
a34078905d01 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 355
diff changeset
91 nestArg = NULL;
a34078905d01 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 355
diff changeset
92
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:
diff changeset
93 nestedVar = NULL;
486
a34078905d01 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 355
diff changeset
94
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:
diff changeset
95 _arguments = NULL;
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:
diff changeset
96 _argptr = NULL;
486
a34078905d01 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 355
diff changeset
97
355
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
98 nextUnique.push(0);
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:
diff changeset
99 }
355
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
100
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
101 std::string IrFunction::getScopedLabelName(const char* ident)
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
102 {
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
103 if(labelScopes.empty())
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
104 return std::string(ident);
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
105
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
106 std::string result = "__";
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
107 for(unsigned int i = 0; i < labelScopes.size(); ++i)
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
108 result += labelScopes[i] + "_";
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
109 return result + ident;
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
110 }
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
111
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
112 void IrFunction::pushUniqueLabelScope(const char* name)
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
113 {
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
114 std::ostringstream uniquename;
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
115 uniquename << name << nextUnique.top()++;
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
116 nextUnique.push(0);
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
117 labelScopes.push_back(uniquename.str());
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
118 }
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
119
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
120 void IrFunction::popLabelScope()
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
121 {
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
122 labelScopes.pop_back();
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
123 nextUnique.pop();
d8357f7004ca [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents: 309
diff changeset
124 }
584
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
125
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
126 void IrFunction::setNeverInline()
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
127 {
632
df196c8dea26 Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 584
diff changeset
128 assert(!func->hasFnAttr(llvm::Attribute::AlwaysInline) && "function can't be never- and always-inline at the same time");
df196c8dea26 Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 584
diff changeset
129 func->addFnAttr(llvm::Attribute::NoInline);
584
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
130 }
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
131
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
132 void IrFunction::setAlwaysInline()
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
133 {
632
df196c8dea26 Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 584
diff changeset
134 assert(!func->hasFnAttr(llvm::Attribute::NoInline) && "function can't be never- and always-inline at the same time");
df196c8dea26 Updated to latest LLVM trunk, function notes have been removed and merged with parameter attributes, which have been renamed to just attributes. Nothing seems to have broke!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 584
diff changeset
135 func->addFnAttr(llvm::Attribute::AlwaysInline);
584
c7d7e2282ba3 Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents: 486
diff changeset
136 }