Commit graph

52 commits

Author SHA1 Message Date
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
Martin
93158caca8 Respect alignments of captured variables when building nested context LL struct 2015-10-18 23:25:37 +02:00
David Nadlinger
ed406f3501 IrFunction: Remove some unused variables 2015-08-31 17:59:36 +03:00
David Nadlinger
2b77da4e2e Do not execute nested finally block twice
GitHub: Fixes #1054.
2015-08-31 17:57:42 +03:00
David Nadlinger
d25dee7f89 irfunction/ScopeStack: Unify style, add comments (NFC) 2015-08-21 20:42:51 +02:00
David Nadlinger
db8f0fd8e2 Coalesce last catch mismatch block with unwind resume block if possible
Makes IR a bit more compact.
2015-08-19 19:56:39 +02:00
David Nadlinger
4bcae9731a The big catch/finally rework, part 2
Now with *almost* working EH codegen. Does not compile Phobos yet
because we run into the "instruction does not dominate all uses"
issue when an r-value result of toElemDtor is used and we need to
run cleanups in between. Should easily be fixed by promoting those
values to allocas.

Most of the changes outside of ir/irfunction.{h, cpp} are just
because CreateCallOrInvoke moved locations. I took the
opportunity to also make use of the different arg count
overloads where possible.
2015-08-19 19:56:39 +02:00
David Nadlinger
4236ae9ce5 The big catch/finally rework, part 1
Never generates any landing pads or invoke instructions right now
for simplicity. The code for emitting them will be added back in
the next step.

The "after..." blocks without any precedessors remain for now, as
we need a clean way to suppress any codegen for that block (but
not new blocks, which might resolve labels) before tackling that
one.

Builds druntime/Phobos on OS X x86_64 (albeit without EH, of course).
2015-08-19 19:56:39 +02:00
David Nadlinger
bfc20df4c8 Remove IRScope::end
Specifying the basic block before which to insert the new one
is not mandatory when calling llvm::BasicBlock::Create. This
was the only use of the tracked "end" block. The concept was
phony anyway because there is no single "end" to a scope with
unwinding and so on.

For prettying up the IR, it is possible to change the order
of basic blocks using move{Before, After}().
2015-08-19 19:56:39 +02:00
Martin
f54e70ede9 Fix memory leak. 2015-07-22 02:00:09 +02:00
Martin
6fefec5a07 Don't destruct a temporary if its constructor throws. 2015-07-19 01:01:04 +02:00
Martin
b9c77c266a Restore toElemDtor() functionality. 2015-07-18 17:17:26 +02:00
Martin
cf52b53888 Move temporaries-related state from ToElemVisitor to FuncGen. 2015-07-18 13:34:26 +02:00
Alexey Prokhin
18f33b1815 Make IrDsymbol to be a typesafe union to reduce memory usage 2014-09-12 14:43:49 +04:00
David Nadlinger
0a96aea868 Sort includes according to style guidelines:
1. Main include corresponding to .cpp file, if any.
 2. DMD and LDC includes.
 3. LLVM includes.
 4. System includes.

Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
kai
a3975b7f47 Replace llvm::Function.getFnAttributes with llvm::Function.getAttributes.
This is a recent change in LLVM 3.3.
2012-12-30 14:27:51 +01:00
kai
5f37ae30cf LLVM 3.3: class Attributes is renamed to Attribute.
Some other renamings took place in "llvm/Attributes.h" but only this causes
compile errors in LDC.
Also uses new location of "llvm/IRBuilder.h".
2012-12-21 17:32:17 +01:00
David Nadlinger
189115fa98 Cleanup: Move definitions for irfuncty.h to new irfuncty.cpp. 2012-12-20 01:03:01 +01:00
David Nadlinger
1bb14c45d2 Removed trailing whitespace. 2012-12-16 17:19:15 +01:00
David Nadlinger
9458911839 Added LLVM-style license headers to all our files. 2012-12-16 17:19:14 +01:00
kai
a7c7b514c0 Add changes for LLVM 3.2
- The Attributes class was changed again
- TargetData was renamed to DataLayout

Compiles again with LLVm 3.0, 3.1 and trunk(3.2).
2012-10-13 18:54:42 +02:00
kai
5e03034654 Make LDC compile with LLVM 3.2 again. 2012-09-29 20:51:21 +02:00
kai
311297b096 Prefer C++-style casts.
This is based on Item 2 of "More Effective C++". In general, the C++ cast operators are more expressive and easy to find,
e.g. by grep. Using const_cast also shuts up some compiler warnings.
2012-08-03 06:32:23 +02:00
kai
b53544b389 Simplify code by using the right type.
Removes some comditional compiling by replacing unsigned with llvm::Attributes.
2012-07-29 18:18:36 +02:00
kai
10a0bdf891 More unification work. 2012-07-29 15:19:13 +02:00
Dan Sanduleac
2748cdaa88 Fix #49: Static arrays that don't fit in a register should be passed using byval 2012-06-05 02:52:25 +01:00
Alexey Prokhin
9a9999854f Named Return Value Optimization 2011-09-13 21:01:38 +04:00
Alexey Prokhin
e921998d75 A few fixes for 64bit 2011-02-23 12:49:57 +03:00
Alexey Prokhin
3eb6b5e8c8 Fixed a crash when compiling test runnable/A16. 2010-12-14 14:35:52 +03:00
Alexey Prokhin
b1e5993873 Started work on phobos 2010-10-27 18:13:46 +04:00
Christian Kamm
42b3da8ac7 Move function codegen data from IrFunction to new FuncGen.
This change reduces memory consumption significantly by releasing the
memory held by the STL containers that are now inside FuncGen.
2009-06-20 19:11:44 +02:00
Christian Kamm
5b799deeb4 Fix #308 by giving finally code emitted by EnclosingTryFinally a different landing pad. 2009-05-23 00:23:39 +02:00
Frits van Bommel
46565f1adc Fix nested functions.
My last patch was a little over-zealous in passing `undef`, it always passed
`undef` to inner functions expecting a single context frame.
2009-04-17 13:50:01 +02:00
Frits van Bommel
c19ab2e539 Unify %.frames_list and %.frame into a single data structure, generalizing r1212
to all frames instead of just the outer-most one.
2009-04-15 20:59:19 +02:00
Frits van Bommel
5a04c4e9a1 For the outermost function needing a context frame, use the address of that
frame as the nest argument instead of the address of a single-element list
containing only that frame address.
This saves some stack space and reduces memory accesses.
2009-04-13 04:09:08 +02:00
Frits van Bommel
751f528969 Implement -nested-ctx=hybrid 2009-04-12 20:23:00 +02:00
Christian Kamm
ed9591d81f Make IrFuncTy a member of TypeFunction. Reset between modules compiled in the
same LDC call.
2009-03-07 14:25:30 +01:00
Frits van Bommel
5af82ee8d3 Fix a bug in the X86 ABI. The size of a struct is different from the size of a
pointer to that struct...
2009-03-06 21:15:13 +01:00
Tomas Lindquist Olsen
65ba1d4d88 Updated ABI handling to be more flexible with regard to reusing lvalues and allocating fewer temporaries. 2009-03-04 17:24:25 +01:00
Tomas Lindquist Olsen
5dbe3ee8e2 Abstracted more (most) ABI details out of the normal codegen. 2009-03-03 02:51:21 +01:00
Christian Kamm
7c93355672 Mostly rewrite debug info generation in terms of llvm/Analysis/DebugInfo.h.
Add getCompilationModule to Dsymbol and fix template compile unit decision code.
Runtime compiles with -g again.
2009-02-08 16:50:22 +01:00
Tomas Lindquist Olsen
7d2a0a84a7 Removed some dead code.
Fixed assertion filenames for imported template instances. Fixes #152 .
2009-02-04 02:10:23 +01:00
Tomas Lindquist Olsen
bce9368514 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! 2008-10-01 23:17:14 +02:00
Christian Kamm
4e0b6b4bf0 Make sure functions containing inline asm are never inlined to avoid
duplicated labels.
2008-09-08 20:38:55 +02:00
Tomas Lindquist Olsen
9d7f16b967 Added pragma(llvmdc, "string") for misc per-module compiler configuration, currently "string" can only be "verbose" which forces -vv for module it appears in.
Reimplemented support for nested functions/class using a new approach.
Added error on taking address of intrinsic.
Fixed problems with the ->syntaxCopy of TypeFunction delegate exp.
Removed DtoDType and replaced all uses with ->toBasetype() instead.
Removed unused inplace stuff.
Fixed a bunch of issues in the runtime unittests, not complete yet.
Added mini tests.
2008-08-10 08:37:38 +02:00
Christian Kamm
c1fbcd9942 [svn r376] Fix bug with finally blocks and labels. The labels would get emitted multiple times and conflict.
It is now possible to add label scopes in IrFunction and all labels names will be prefixed accordingly.

Also disallow goto into finally blocks.

Fixes nocompile/finally_02 and others.
2008-07-14 11:48:55 +02:00
Tomas Lindquist Olsen
0d160ffc76 [svn r330] Implemented synchronized statements.
Changed the tryfinally handlers to a more generalized EnclosingHandler.
Changed ClassInfoS to be mutable so they can be used as locks.
Added new BB after throw ala return/break etc.
2008-06-28 11:37:53 +02:00
Tomas Lindquist Olsen
1eb35898c6 [svn r223] Fixed: assert with message could be broken.
Fixed: array length exp could fail on slice.
2008-05-13 21:40:39 +02:00
Tomas Lindquist Olsen
3365b4c02f [svn r221] Update: Switched to the 2.3 LLVM svn branch, http://llvm.org/svn/llvm-project/llvm/branches/release_23 .
Fixed: Implemented volatile statements. Uses the LLVM memory barrier intrinsic, closes #21 .
2008-05-13 17:58:11 +02:00
Tomas Lindquist Olsen
c380f43929 [svn r219] Fixed: the tango/lib/gc/basic garbage collector now compiles and links into an executable (change in tango/lib/llvmdc-posix.mak), closes #5 .
Changed: removed the crappy realloc based dynamic memory runtime and started moving over to DMD style runtime support, part of moving to real GC.
Fixed: dynamic arrays now use GC runtime for allocating memory.
Fixed: new expression now use GC for allocating memory.
Changed: revamped the dynamic array support routines related to dynamic memory.
Fixed: assertions no longer create exsessive allocas.
Changed: misc. minor cleanups.
2008-05-13 14:42:09 +02:00