Commit Graph

1432 Commits

Author SHA1 Message Date
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
051cd7302e Fixed two issues with nested functions as template alias parameters.
Fixes #131 (GitHub).
2012-10-07 03:06:07 +02:00
David Nadlinger
da17b7c6b6 Only invoke mustDefineSymbol() once in DtoLinkage.
This is, of course, a microoptimization, but more importantly
makes stepping through the code easier.
2012-10-07 00:03:10 +02:00
David Nadlinger
c9e2fc34d1 Cleanup.
If ad would be null, the code above would have already crashed.
2012-10-06 20:40:14 +02:00
David Nadlinger
bb24f9bafe Log messages: Fixed references to "toObjFile()". 2012-10-06 19:32:42 +02:00
David Nadlinger
5fa1a903e8 DtoResolveStruct cleanup.
irField is only set in DtoResolveStruct, so the comment was misleading.
2012-10-06 19:27:55 +02:00
David Nadlinger
2d54a02295 Use null instead of undef for unneeded nested context pointers. 2012-10-06 13:07:17 +02:00
Jernej Krempuš
7966abeb5e Bitcast the LLValue to the correct type. 2012-10-05 21:58:19 +02:00
Jernej Krempuš
39300283c0 Made casts between vector types work. 2012-10-05 19:38:43 +02:00
David Nadlinger
4e49814afb Vector -> static array casts are by address.
Fixes #176 (GitHub).
2012-10-05 17:23:31 +02:00
David Nadlinger
4f6ec96b27 Fixed vector initialization involving implicit conversions.
Fixes first part of GitHub #176.
2012-10-03 19:51:04 +02:00
Jernej Krempuš
fd3e79b7bb Corrections. 2012-10-03 15:26:43 +02:00
Jernej Krempuš
115bc7113e Improved error messages. 2012-10-03 03:44:34 +02:00
Jernej Krempuš
b798974f3a Added pragma insertelement. 2012-10-02 22:22:53 +02:00
Jernej Krempuš
2cf5d8c2a0 Added pragma extractelement 2012-10-02 21:37:27 +02:00
David Nadlinger
5f6447e52c Fix GitHub issue #168 – alignment of globals. 2012-09-28 01:57:21 +02:00
David Nadlinger
4b3662adfd Fixed unlisted vector handling bug.
Thanks to filwit on IRC for mentioning it.
2012-09-28 00:34:31 +02:00
David Nadlinger
c6abdcf4a4 Don't set TypePointer::isunsigned to true in the frontend.
The previous solution was problematic because the change was language-
visble via the isUnsigned trait. Now, pointers are simply explicitly
checked for in the relevant places. (Note that there might be cases in
the diff where a direct isunsigned() call would have been appropriate –
I only checked for instances where the type clearly cannot be a pointer,
but chose to go the safe route in replicating existing behavior
otherwise).

Fixes DMD testcase 'traits'.
2012-09-28 00:28:49 +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
3f9f13594c Work around unmerged types being returned from frontend.
Fixes DMD testcase 'funclit'.
2012-09-27 23:50:52 +02:00
David Nadlinger
4a1cbc2d33 Debug log prettification: Indent toElemDtor() children. 2012-09-27 22:01:53 +02:00
David Nadlinger
9e8ec9613c Removed superfluous newline in log message. 2012-09-27 21:55:09 +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
8968103b8b Some verbose logging output prettification. 2012-09-21 18:54:23 +02:00
kai
940d6e907f Take advantage of Triple and TargetData.
A lot of system specific knowledge is already present in LLVM. This is used to populate several fields in global.params instead of hard coded values in main(). Ensures that the frontend and LLVM have always the same values.
2012-09-16 19:50:21 +02:00
kai
59cf17a06b Rename variables for options ms-link and ms-lib.
This prevents a name clash and fixes #164.
2012-09-16 14:35:33 +02:00
kai
6e554c6647 Add support for MS Lib.
If the target OS is Windows using the MS runtime then use LIB.EXE as the archiver.
2012-09-16 00:03:27 +02:00
kai
2e47e98c2c Fix access violation.
Variable `args` was used without first checking for valid values. You could crash LDC by entering something like 'pragma(intrinsic) void crash();' in the source file.
2012-09-15 16:15:02 +02:00
kai
7d1ec52c68 Implement the xgetbv opcode.
This solves a FIXME in core.cpuid.
2012-09-14 21:10:39 +02:00
kai
ebf5d8b92e Add missing return statement.
This fixes #159.
2012-09-11 18:05:13 +02:00
kai
9dfc638edf Fix path of included header IRBuilder.h
As usual this file has moved around from version to version.
2012-09-10 18:00:21 +02:00
kai
d57eaa49ae Use new functions appendToGlobalCtors() and appendToGlobalDtors.
This simplifies the code in module.cpp a bit. But it is also the base to implement a pragma to place an arbitrary function in llvm.global_ctors and llvm.global_dtors.
2012-09-09 20:41:51 +02:00
kai
e78ff5a131 Fix broken build with LLVM 3.0.
The method ConstantVector::getSplat() does not existin LLVM 3.0. Workarouund is to create a vector and use ConstantVector::get().
2012-09-09 20:36:48 +02:00
kai
4b0c4bf4ae Get rid of global.params.dataLayout.
The string representation of the data layout is retrieved from the TargetData class (in main) and passed via global.params.dataLayout to the module. Since the gTargetData is also a global variable it makes no sense to pass this information using another global variable.
2012-09-08 20:25:42 +02:00
kai
0a53cb2ac0 Add -vectorize to the optimizer. This is available starting with LLVM 3.1. 2012-09-08 13:36:31 +02:00
kai
4ae64dd2e7 Fix size returned by os_critsecsize() and construct type for D_CRITIAL_SECTION on Windows. 2012-09-08 11:49:37 +02:00
kai
9b93382417 Some fixes in the operands of 64bit assembler. 2012-09-07 23:45:45 +02:00
David Nadlinger
81b462b129 D1 build fix. 2012-09-07 03:51:33 +02:00
David Nadlinger
bebc5cce28 Workaround for Voldemort return type handling issues.
See the comment in DtoCallFunction for an explanation of what is
going on.

The struct zero initialization code was also refactored out to
AssignExp::toElem and modified so that it is only triggered
on integer->struct assignments, not for any types where the
modifier-stripped types don't match up. This would have lead to
silently wrong code in the cases where the assert would have been
triggered otherwise.

Fixes the Phobos testsuite build.
2012-09-07 03:51:33 +02:00
David Nadlinger
139e1a9c2a Implement stripModifiers using castMod(0).
Reduces the potentail for bugs in the fragile code; castMod(0) is
used like this in DMD code.
2012-09-07 03:51:33 +02:00
David Nadlinger
88f08cf927 Workaround for LLVM bug 11479.
The LLVM module name doesn't really seem to impact much aynway.
2012-09-07 03:51:33 +02:00
David Nadlinger
6275c66a89 Fixed segfault on invalid naked functions.
Emitting a frontend error during codegen is somewhat problematic in
any case, but stopping if an error ocurred should work just fine here.
2012-09-07 03:51:33 +02:00
David Nadlinger
45d9efb203 Call element postblit on "return array[0]".
Fixes DMD testcase 'sdtor'.
2012-09-07 03:51:33 +02:00
David Nadlinger
1cecab16cf Emit correct TypeInfo argument for _d_arrayassign.
Fixes part of DMD testcase 'sdtor'.
2012-09-07 03:51:33 +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
David Nadlinger
16847dd5d5 Disregard modifiers when checking for initializer type match.
Previously, only const'ness was dropped, but DMD 2.060 started to
emit initializers with incompatible shared modifiers as well.
2012-09-07 03:51:32 +02:00
David Nadlinger
4ae14449ea Emit new TypeInfo layout.
Includes untested support for RTInfo.
2012-09-07 03:51:32 +02:00
David Nadlinger
8ebd2ce5a6 More CRLF->LF line ending conversion. 2012-09-07 03:51:32 +02:00