Commit graph

64 commits

Author SHA1 Message Date
Rainer Schuetze
5b22904ff9 use catch-all and rethrow instead of cleanup pads, they don't work completely the same as C++ 2016-03-13 17:27:53 +01:00
Rainer Schuetze
73ab5f4fee inside a cleanup block, convert "unreachable" to a branch to "cleanupret" 2016-03-13 17:27:51 +01:00
Rainer Schuetze
5dabf78c7b fix MSVC-EH again, disable inlining and tail call optimization for functions with EH 2016-03-13 17:27:51 +01:00
Rainer Schuetze
aad27069ca MSVC/x86 EH support using __CxxFrameHandler3 personality 2016-03-13 17:27:51 +01:00
Johan Engelen
29ce4012af dmd2 --> ddmd. Merge (almost all of) our changes to dmd source into the new D source of dmd 2.069.2.
Also adds the CMake infrastructure to compile and link the D source files.

The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
2016-01-28 19:03:58 +01:00
Martin
b9f7d2b499 Normalize signatures of EH runtime functions 2015-12-04 15:07:47 +01:00
Johan Engelen
70a6e73188 Cleanup runtime fwd decls and use ABI functiontype rewriting 2015-11-22 01:27:26 +01:00
David Nadlinger
2401554bec Small landing pad code refactoring
Now the resume unwind block isn't literally created in between
two other, unrelated lines – I must have made a mistake when
resolving a merge conflict or something like that before.
2015-11-03 00:48:12 +02:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
52532985a9 IR source directory: use C++11 inline-initialization in headers 2015-11-01 19:30:04 +01:00
Martin
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01:00
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