Mercurial > projects > ldc
annotate ir/irfunction.cpp @ 1112:829ac3f30103
Updating revisions.pl.in:
- Change the way the LLVM SVN revision is detected, using `svn info` instead
of `svnversion`. This speeds it up significantly on my machine (especially
when the LLVM SVN checkout isn't in disk cache).
- Add "last changed date" to SVN checkouts too, not just unpacked tarballs
- No longer rely on SVN revision to detect release vs trunk checkouts, treat
release checkout the same as unpacked release tarball. (Except for date
determination, which uses SVN date instead of filesystem date)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Fri, 13 Mar 2009 16:18:01 +0100 |
parents | dc608dc33081 |
children | 8699c450a1a0 |
rev | line source |
---|---|
309 | 1 |
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" |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
6 #include "gen/logger.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
|
7 #include "ir/irfunction.h" |
1051
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1050
diff
changeset
|
8 #include "ir/irfuncty.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
|
9 |
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
|
10 #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
|
11 |
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
|
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 ////////////////////////////////////////////////////////////////////////////// |
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
|
14 ////////////////////////////////////////////////////////////////////////////// |
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
|
15 |
1024
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
16 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
|
17 { |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
18 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
|
19 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
|
20 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
|
21 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
|
22 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
|
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 |
1051
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1050
diff
changeset
|
25 bool IrFuncTyArg::isInReg() const { return (attrs & llvm::Attribute::InReg) != 0; } |
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1050
diff
changeset
|
26 bool IrFuncTyArg::isSRet() const { return (attrs & llvm::Attribute::StructRet) != 0; } |
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1050
diff
changeset
|
27 bool IrFuncTyArg::isByVal() const { return (attrs & llvm::Attribute::ByVal) != 0; } |
dc608dc33081
Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
Christian Kamm <kamm incasoftware de>
parents:
1050
diff
changeset
|
28 |
1024
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
29 ////////////////////////////////////////////////////////////////////////////// |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
30 ////////////////////////////////////////////////////////////////////////////// |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
31 ////////////////////////////////////////////////////////////////////////////// |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
32 |
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
|
33 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
|
34 { |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
35 assert(!arg_sret); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
36 if (ret->rewrite) { |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
37 Logger::println("Rewrite: putRet"); |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
38 LOG_SCOPE |
1024
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->put(dty, val); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
40 } |
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
|
41 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
|
42 } |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
43 |
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
|
44 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
|
45 { |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
46 assert(!arg_sret); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
47 if (ret->rewrite) { |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
48 Logger::println("Rewrite: getRet"); |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
49 LOG_SCOPE |
1024
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
50 return ret->rewrite->get(dty, val); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
51 } |
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
|
52 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
|
53 } |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
54 |
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
|
55 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
|
56 { |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
57 assert(idx >= 0 && idx < args.size() && "invalid putParam"); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
58 if (args[idx]->rewrite) { |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
59 Logger::println("Rewrite: putParam"); |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
60 LOG_SCOPE |
1024
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
61 return args[idx]->rewrite->put(dty, val); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
62 } |
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
|
63 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
|
64 } |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
65 |
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
|
66 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
|
67 { |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
68 assert(idx >= 0 && idx < args.size() && "invalid getParam"); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
69 if (args[idx]->rewrite) { |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
70 Logger::println("Rewrite: getParam (get)"); |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
71 LOG_SCOPE |
1024
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
72 return args[idx]->rewrite->get(dty, val); |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
73 } |
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
|
74 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
|
75 } |
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
|
76 |
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
|
77 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
|
78 { |
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
|
79 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
|
80 |
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
|
81 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
|
82 { |
1050
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
83 Logger::println("Rewrite: getParam (getL)"); |
32ead42679d1
Fix a bug in the X86 ABI. The size of a struct is different from the size of a
Frits van Bommel <fvbommel wxs.nl>
parents:
1042
diff
changeset
|
84 LOG_SCOPE |
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
|
85 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
|
86 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
|
87 } |
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
|
88 |
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
|
89 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
|
90 } |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
91 |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
92 ////////////////////////////////////////////////////////////////////////////// |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
93 ////////////////////////////////////////////////////////////////////////////// |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
94 ////////////////////////////////////////////////////////////////////////////// |
9167d492cbc2
Abstracted more (most) ABI details out of the normal codegen.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
946
diff
changeset
|
95 |
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
|
96 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
|
97 { |
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
|
98 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
|
99 |
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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 |
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
|
106 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
|
107 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
|
108 |
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
|
109 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
|
110 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
|
111 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
|
112 |
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
|
113 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
|
114 |
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
|
115 _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
|
116 _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
|
117 |
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
|
118 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
|
119 } |
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
|
120 |
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 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
|
122 { |
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 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
|
124 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
|
125 |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
126 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
|
127 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
|
128 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
|
129 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
|
130 } |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
131 |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
132 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
|
133 { |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
134 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
|
135 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
|
136 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
|
137 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
|
138 } |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
139 |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
140 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
|
141 { |
d8357f7004ca
[svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
ChristianK
parents:
309
diff
changeset
|
142 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
|
143 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
|
144 } |
584
c7d7e2282ba3
Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents:
486
diff
changeset
|
145 |
c7d7e2282ba3
Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents:
486
diff
changeset
|
146 void IrFunction::setNeverInline() |
c7d7e2282ba3
Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents:
486
diff
changeset
|
147 { |
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
|
148 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
|
149 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
|
150 } |
c7d7e2282ba3
Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents:
486
diff
changeset
|
151 |
c7d7e2282ba3
Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents:
486
diff
changeset
|
152 void IrFunction::setAlwaysInline() |
c7d7e2282ba3
Make sure functions containing inline asm are never inlined to avoid
Christian Kamm <kamm incasoftware de>
parents:
486
diff
changeset
|
153 { |
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
|
154 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
|
155 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
|
156 } |