Commit graph

306 commits

Author SHA1 Message Date
David Nadlinger
30caa4bfe6 Merge branch 'master' into merge-2.061-2 2013-01-12 01:27:02 +01:00
kai
6ddb524b91 More LLVM 3.3 changes 2013-01-11 22:46:36 +01:00
kai
a11459bc31 "The Great Renaming" continues.
More changes to match the renamed files of LLVM 3.3.
2013-01-06 17:17:30 +01:00
David Nadlinger
5c518a16ec Merged 2.061 frontend. 2013-01-04 06:22:53 +01:00
kai
4ea7e8dbf8 Add pragma to install function as global C runtime ctor or dtor.
DMD has the obscure functionality to install functions starting with
_STI_ as global ctors and funtions starting with _STD_ as global
dtors. IMHO a pragma is a better way to specify the behaviour.

This commit adds pragma(LDC_global_crt_ctor) and
pragma(LDC_global_crt_dtor). If the pragma is specified on a function
or static method then an entry is made in the corresponding list. E.g.
in monitor_.d:

    extern (C) {
        #pragma(LDC_global_crt_ctor)
        void _STI_monitor_staticctor()
        {
            // ...
        }
    }

This works on Linux without problems. On Windows with MS C Runtime
ctors work always but dtors are invoked only if linked against the
static C runtime. Dtors on Windows require at least LLVM 3.2.
2012-12-22 21:18:37 +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
59a4a02e49 Cleanup: Avoid signed/unsigned comparisons.
The ones ones left are for DMD-defined constants.
2012-12-20 01:21:09 +01:00
David Nadlinger
9cbfc604c7 Fix ICE with closures in member functions.
I chose to fix the problem this way because it increases uniformity
between 'this' and normal explicit parameters. Another possibility
would be to just change the type determinatin code in
DtoCreateNestedContextType to not expect the value to be already
present, because it doesn't need it when isVthisPtr is true anyway.

GitHub: Fixes #217.
2012-12-19 20:27:19 +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
1a06130cfa AttrListPtr is renamed to AttributeSet in LLVM 3.3. 2012-12-09 19:48:39 +01:00
David Nadlinger
19f570bcb9 AttrListPtr also requires the context arg in LLVM 3.2 now. 2012-11-24 12:40:12 +01:00
kai
2fec23b84e AttrlistPtr::get() now requires context as first argument.
This is the first LLVM 3.3 related change.
2012-11-21 22:10:26 +01:00
Jernej Krempuš
7bbe782615 Pragma llvm_inline_ir
Adding pragma llvm_inline_ir.

Improved the error messages.

Append "ret void" when the return type is void

Improved the error message

in case when the string passed as llvm inline ir isn't valid llvm
assembly language.

LLVM 3.2 fix.

Add attribute AlwaysInline inside DtoInlineIRFunction.

Always generate a body for llvm_inline_ir

Also, always make llvm_inline_ir functions linkonce_odr. Because
the body is always generated when a module uses a llvm_inline_ir
function, the fact that the linker removes the function shouldn't
cause problems.
2012-11-08 22:05:15 +01:00
David Nadlinger
08a8f5df9b Fixed LLVM function attribute handling.
Previously, set_param_attrs would overwrite any pre-existing
attributes, which is problematic, as per-function attributes are
also stored in a slot in that attribute list. This for example
lead to "noinline" being dropped for functions with inline asm.
2012-11-04 17:48:26 +01:00
kai
fde625b33d More changes to the Attributes class in LLVM 3.2. 2012-10-20 17:22:55 +02:00
kai
657fc42221 And still more changes for LLVM 3.2
There were additional changes to the Attributes class.
2012-10-15 18:31:18 +02:00
kai
fb108eed12 More LLVM 3.2 changes. 2012-10-14 18:45:31 +02:00
David Nadlinger
11619e55a9 Fix miscompilation of some functions returning structs. 2012-10-14 03:41:15 +02: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
David Nadlinger
e7c72b072b Default to C-style variadics for all calling conventions.
Fixes DMD testcase 'callingconv'.
2012-09-27 23:53:04 +02:00
David Nadlinger
f54fa0077a Only allow a single D main() function.
Fixes DMD testcase 'fail5634'.
2012-09-27 20:22:52 +02:00
David Nadlinger
d4eafe53e0 Removed obsolete nested context styles.
NChybrid was the only one that didn't instantly trigger a "not
implemented" assertion on any code using nested function for a long
time, and removing the cruft greatly improves code readability
(maintainability is a moot point anyway given its current state).
2012-09-07 03:51:33 +02:00
David Nadlinger
ee4285f934 Properly handle DMD-internal "reference variables".
Previously, we just had a hack to make ref foreach statements work.
This commit enables them to work in other cases as well, like the
implicit __result variable for functions with out-contracts (which
is such a magic ref variable for ref-returning functions).

Fixes DMD testcase 'testcontracts'.
2012-09-07 03:51:33 +02:00
kai
2dbee75523 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-02 19:55:29 +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
dbb5a34eda Add changes for LLVM 3.2. 2012-07-29 17:31:50 +02:00
kai
9bf65bc9a2 Start unification of master and llvm-3.1 branch. 2012-07-29 13:50:30 +02:00
David Nadlinger
cef19fb225 Fix #125 – Nested class context pointer invalid (D1).
Patch originally by Alexey Prokhin, thanks.
2012-06-24 16:18:47 +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
Eldar Insafutdinov
feefad412c Move cl_options out of LDCShared 2012-04-02 14:53:52 +01:00
Alexey Prokhin
4d3ba3594c Refactoring: moved ldc specific code from dmd/attrib.c and dmd2/attrib.c into gen/pragma.cpp 2012-02-15 13:16:06 +04:00
Alexey Prokhin
15a903580b Partial fix for #69 — LDC1 from master fails to build Tango.
Fixed regression that has been introduced in commit 9889067.
2012-01-29 12:32:13 +04:00
Alexey Prokhin
9889067420 Fixed #53 — Assertion !isaStruct(t) 2012-01-10 19:46:32 +04:00
Alexey Prokhin
b41688a0b8 DMD Issue 6859 - Segfault when abstract method uses with contract. 2011-12-16 20:15:31 +04:00
Alexey Prokhin
88cff99bd4 Merge dmdfe 2.057 2011-12-16 19:44:56 +04:00
Alexey Prokhin
91f4e5d015 Added emission of dwarf lexical blocks.
Also, dropped support for DISABLE_DEBUG_INFO definition.
2011-12-04 15:34:35 +04:00
Alexey Prokhin
b8721a8515 Emit debug info for variables that are used in nested functions 2011-12-03 23:45:58 +04:00
Alexey Prokhin
629f13929e WIP: port to llvm 3.0 2011-10-25 15:43:39 +04:00
Alexey Prokhin
a75b08bc00 Fixed accessing struct members via alias this 2011-09-13 21:01:39 +04:00
David Nadlinger
21a05aa971 Merge branch 'default' into 'merge'. 2011-07-29 00:37:30 +02:00
David Nadlinger
15c5316e26 Prevent two function with same mangled name but different types from being declared.
Previously, LDC would crash in the backend due to the fact that the IR is typed in such cases (we recently had such an instance with Tango, where an extern( C ) function was declared once with int and once with size_t).
2011-07-27 23:01:22 +02:00
Alexey Prokhin
79edefdc37 Fixed compilation of functions that does not have return statement but contain inline asm 2011-07-19 22:22:49 +04:00
Alexey Prokhin
4cc10019ee Fixed an assertion in DtoType() 2011-07-19 19:58:38 +04:00
Alexey Prokhin
805fb5cfc1 D2: pass static arrays into functions by value 2011-04-30 15:30:57 +04:00
Alexey Prokhin
6bc2431b6b Skip unittests in imported modules 2011-04-30 15:30:57 +04:00
David Nadlinger
7a24e12736 Cleanup: Remove unused code in backend, silence some warnings.
This removed quite some clutter that has presumably piled up because LDC is seldom built with a lot of warnings enabled due to DMDFE.
2011-04-24 12:21:33 +02:00
Moritz Warning
fbb32c24cb another merge 2011-02-27 20:11:13 +01:00
Moritz Warning
b752882184 merge from alexeys branch 2011-02-24 13:22:17 +01:00
Moritz Warning
fb418bf2e6 Added -disable-red-zone flag.
This will disable the usage of the 'red-zone' in ABIs that make use of it (like x86). This mimics the exact flag used by clang. It is comparable to the -mno-red-zone flag in gcc. - thanks to wilkie
2011-02-23 23:50:53 +01:00