Commit graph

2761 commits

Author SHA1 Message Date
Evangelos Foutras
984207e348 Fix llvm/IRBuilder.h include when using LLVM 3.2 2012-12-25 04:58:25 +02:00
David Nadlinger
8880645bf6 Typo fix.
Turns out I still had USE_METADATA=OFF in the CMake cache when
testing the previous commit.
2012-12-24 02:22:40 +01:00
David Nadlinger
a0971b7c4b Use more portable integer log from LLVM. 2012-12-24 02:05:06 +01:00
David Nadlinger
8094e3c21b dgc2stack: Added size limit for stack promotion. 2012-12-23 21:20:55 +01:00
Kai Nacke
1600aa95e5 Merge pull request #161 from redstar/ctordtor
Add pragma to install function as global ctor or dtor.
2012-12-22 13:09:49 -08: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
David Nadlinger
71e8623a89 Merge pull request #254 from redstar/clang
Cleanup: 2 more clang warning fixes.
2012-12-22 11:13:54 -08:00
kai
fd0021c6c2 Cleanup: 2 more clang warning fixes. 2012-12-22 16:59:20 +01:00
kai
1ba0681197 2nd attempt to fix issue #253. 2012-12-21 22:45:09 +01:00
kai
df4a245040 Resolve mismatch between object.di and typinfo.cpp on 64bit non-x86 systems.
On Windows x86_64, class TypeInfo_Struct contains 2 additional fields
(m_arg1/m_arg2) which are used for the X86_64 System V ABI varargs
implementation. They are not present on any other os.

This commit changes an assertion which did not check for the os and therefore
broke on 64bit non-86 systems like ppc64.
2012-12-21 22:05:28 +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
9d9f827efb Set irtype for underlying function type when building delegate types.
This fixes the problem of arg_nest disappearing when DtoType
is called on such types, e.g. as part of metadata generation.
2012-12-21 00:32:07 +01:00
David Nadlinger
7be9c5c5c7 dgc2stack: LLVM 3.2 compatibility. 2012-12-20 23:52:25 +01:00
David Nadlinger
8913898b5e dgc2stack: Demote LLVM "tail" calls when promoting an allocation.
Referencing alloca'd memory in tail calls is invalid IR. This was
not caught by the verifier, but produced misoptimizations due to
wrong alias analysis results.
2012-12-20 23:52:25 +01:00
David Nadlinger
4da1427c19 Enable USE_METADATA by default. 2012-12-20 23:52:25 +01:00
David Nadlinger
bc541a4421 Added D2/druntime support to gc2stack. 2012-12-20 23:52:25 +01:00
David Nadlinger
ebbbfdd4ac Metadata/gc2stack compile fixes to accomodate LLVM API changes. 2012-12-20 23:52:24 +01:00
David Nadlinger
a3a511ca55 Refactored IrType construction to use static get() method.
This also allows us to enable the assert in IrType::IrType.

Unfortunately, this is mostly a "peace of mind" commit, there
doesn't seem to have been a bug actually caused by the transitory
duplicate IrTypePointer/IrTypeStruct instances.

The remaining xyz2llvm static methods are not exactly pretty,
they should probably just be folded into get.
2012-12-20 23:52:09 +01:00
David Nadlinger
464c695814 Renamed IrType::get/IrType::getD, treat classes as the special case they are. 2012-12-20 23:52:09 +01:00
David Nadlinger
aa4543465d Actually run DMD test suite in 32 bit mode on x86_64 multilib builds.
Yet another regression gone unnoticed because CMake functions
silently accept extra arguments.
2012-12-20 03:57:04 +01:00
David Nadlinger
4804cbcdbb Cleanup: Removed unused variable. 2012-12-20 03:29:06 +01:00
David Nadlinger
89809fdde3 Cleanup: Silence another "maybe-undefined" warning.
Also makes the assert in line 775 actually work.
2012-12-20 02:10:32 +01:00
David Nadlinger
0be65aa49b Add back line accidentally removed in 289bb57a. 2012-12-20 02:07:11 +01:00
David Nadlinger
06f9efd763 Enable -Wextra by default. 2012-12-20 01:21:10 +01:00
David Nadlinger
4118cddd1f Cleanup: GCC warning fixes. 2012-12-20 01:21:10 +01:00
David Nadlinger
ab357a41c7 Removed useless debug log messages. 2012-12-20 01:21:10 +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
189115fa98 Cleanup: Move definitions for irfuncty.h to new irfuncty.cpp. 2012-12-20 01:03:01 +01:00
David Nadlinger
0efa499b22 Cleanup: Actually use forward-declared types. 2012-12-20 01:00:59 +01:00
David Nadlinger
fca550e534 Cleanup: Remove warning overrides and fix two more warnings. 2012-12-20 01:00:57 +01:00
David Nadlinger
0cd78dd579 Cleanup: Clang warning fixes.
No warnings left on a '-Wall' build except for a single tautological
compare in gen/asm-x86-32.h, which indeed seems like a bug.
2012-12-20 01:00:55 +01:00
David Nadlinger
289bb57adf Cleanup: Fix "braces around initializaion of subobject" warnings.
The two ASM implementations should really be merged, as they
are very similar except for the added registers/instructions.
2012-12-20 01:00:51 +01:00
David Nadlinger
87a4fd06d5 Enable -Wall only for LDC-specific parts of the code.
LDC files including DMD headers are still not handled.
2012-12-19 23:21:47 +01:00
David Nadlinger
e174916328 Don't create unused gen/ directory. 2012-12-19 23:08:47 +01:00
David Nadlinger
f68e914da6 Workaround for ICE due to auto return type not being inferred.
GitHub: Fixes #217.
2012-12-19 22:55:18 +01:00
David Nadlinger
6e6e03b154 Fold in testsuite fix. 2012-12-19 22:14:13 +01:00
David Nadlinger
fb363972f0 Fix handling of NewExpression for structs with constructors.
The frontend treats the constructor as returning a reference to
the new instance, we just want the memory, i.e. a pointer.

GitHub: Fixes #246.
2012-12-19 20:57:52 +01:00
David Nadlinger
db59b30eda Slight rewrite to make intent cleaner.
No functionality change intended, although it might make the last
commit unnecessary.
2012-12-19 20:38:54 +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
080d0cef0f Debug log formatting fix. 2012-12-19 19:49:03 +01:00
David Nadlinger
e068df24b2 Workaround for AA literal initialization ICE.
Just executing toConstElem speculatively in
AssocArrayLiteralExp::toElem probably isn't the best idea
anyway, I would not be surprised if there are other similar bugs.

GitHub: Fixes #248.
2012-12-19 02:09:19 +01:00
David Nadlinger
03c77865d0 Fix parallel druntime/Phobos build. 2012-12-19 01:50:48 +01:00
David Nadlinger
2988bc46e0 Removed long obsolete (and broken) LLVM IR annotation code.
If someone wants to redo this properly, an idea that actually works
would be to use a custom llvm::AssemblyAnnotationWriter.
2012-12-19 01:50:48 +01:00
kai
c250b8b208 Remove virtual keyword not present in DMD source.
The virtual keyword is not required when overriding a virtual method.
This commit sync the LDC source with DMD source.
2012-12-18 23:10:30 +01:00
kai
d4521c15c6 Wrap LDC specific code in #ifdef INLLVM / #endif 2012-12-18 18:12:11 +01:00
David Nadlinger
9cfda3a6e9 Also merge ldc.* DDoc fixes into master. 2012-12-17 22:58:29 +01:00
kai
393d142a78 Revert "Wrap LDC specific code in #ifdef IN_LLVM/#endif"
This reverts commit d92a1842b1.
2012-12-17 09:35:29 +01:00
kai
d92a1842b1 Wrap LDC specific code in #ifdef IN_LLVM/#endif 2012-12-17 00:12:06 +01:00
kai
ca2cc75567 Mark LDC changes and remove unused debug? switches.
The Param struct is very different between DMD and LDC. This is a start
to mark the differences. This also includes identifying unused switches
- like the debug? switches.
2012-12-17 00:08:46 +01:00
kai
6de735e578 Whitespace fixes 2012-12-17 00:08:06 +01:00