Commit graph

246 commits

Author SHA1 Message Date
Moritz Warning
c151d37365 fixes #434 :: add llvm 2.8 support 2010-10-23 13:38:26 +02:00
Moritz Warning
3dcfb04ad7 fix for FreeBSD 2010-06-09 23:16:00 +02:00
Tomas Lindquist Olsen
1fac40d2bd Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).

Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.

Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
2010-05-19 12:42:32 +02:00
Matti Niemenmaa
68daadf53c Add -linkonce-templates for emitting linkonce_odr syms instead of weak_odr. 2010-03-09 23:07:08 +02:00
Robert Clipsham
70b2156010 Fixed a segfault in ldc2 when compiling synchronized{} blocks. 2009-09-19 13:05:10 +01:00
Robert Clipsham
089e792258 DMD 2.032 Merge. 2009-09-08 10:07:56 +01:00
Benjamin Kramer
d24643bb50 Avoid some unecessary heap allocations by using llvm's StringRef class. 2009-08-14 01:43:30 +02:00
Benjamin Kramer
c220dcac05 IntegerType is now contextifed.
Requires llvm >= 78969. resistor says this will be the last context API change :)
2009-08-14 00:39:18 +02:00
Benjamin Kramer
977fa551ee Push the context through StructType::get.
Requires LLVM >= 78258. Also remove old #if's.
2009-08-06 01:47:39 +02:00
Benjamin Kramer
4c5457ba61 getNullValue is in Constant again
Requires LLVM >= r77721
2009-07-31 23:01:29 +02:00
Benjamin Kramer
66101517d7 LLVMContext changes up to r77366 2009-07-30 15:25:10 +02:00
Benjamin Kramer
51c02d192a Some minor cleanups
* remove an #ifdef USE_METADATA I accidently left in
* remove now unneeded llvm-version includes
* fix indentation in metadata.h
* prevent the "Found native target" message from interrupting ccmake
2009-07-20 18:16:11 +02:00
Benjamin Kramer
d7049de966 More factory methods moved to LLVMContext 2009-07-15 18:09:41 +02:00
Benjamin Kramer
076ef17159 Build fix for LLVM r75546 and r75559 2009-07-14 02:19:05 +02:00
Benjamin Kramer
0ee2f34611 Don't use llvm::getGlobalContext() anymore 2009-07-13 20:16:15 +02:00
Benjamin Kramer
331319dab1 Build fix for the latest LLVMContext changes (LLVM r75445)
This shouldn't break the build with older LLVM revs. We include
LLVMContext.h in gen/llvm.h now to make the transition a little bit
easier.
2009-07-13 12:17:58 +02:00
Benjamin Kramer
45f7401a5b Remove all of the now unecessary #if LLVM_REV 2009-07-11 14:09:33 +02:00
Christian Kamm
756a2cb2a1 Adjust LDC to work with the LLVMContext LLVM changes.
This means we now require a fairly new LLVM revision. I use 75234.
2009-07-10 21:30:02 +02:00
Robert Clipsham
f13c5e82f5 Added a stripModifiers() function to remove shared|const|immutable storage classes in D2 (should eventually be moved to a dhelpers file rather than llvm helpers).
Replaced a few occurances of STCinvariant with STCimmutable.
2009-06-18 15:44:04 +01:00
Benjamin Kramer
348192e7e7 Build fix for LLVM >= r73431 2009-06-16 15:37:40 +02:00
Frits van Bommel
96fdcd6347 Run semantic3 on imported modules, and emit new symbols with
`available_externally` linkage. This allows the inliner to inline functions from
other modules while telling the code generator to ignore those functions (treat
them as declarations)
Still generates a few extra `TypeInfo`s and strings...
Disabled when generating debug info because I don't really understand it, and it
doesn't like this.
2009-06-07 16:00:13 +02:00
Frits van Bommel
f79e40a491 Use llvm.memset instead of _d_array_init_i1 and _d_array_init_i8.
This exposes what's happening to LLVM, and memset is probably faster than the
runtime functions we were using anyway.
2009-06-07 13:57:59 +02:00
Frits van Bommel
fd037f35e9 Fix a type mismatch in ModuleInfo generation. 2009-06-01 23:17:47 +02:00
Christian Kamm
7fd43e8bf7 Error instead of assert on delegate literals as constant expressions.
Make function literal linkage internal inside functions and external otherwise.
2009-05-27 19:20:18 +02:00
Tomas Lindquist Olsen
d80de9deb3 Cleaned up TypeInfo_Struct.
Fixed problem with DtoConstSize_t taking a size_t argument, this is not enough for cross compiling from 32bit host to a 64bit target. It now takes uint64_t. There's probably a lot of similar case around to code ...
2009-05-17 04:41:10 +02:00
Tomas Lindquist Olsen
c0f2af5afd Added IrTypeFunction and IrTypeDelegate and eliminated IrDType. This means the Type::ir field can be removed. It's the final part needed for the move to a slightly more sane type system. Now the whole thing just needs to be cleaned up :P
Added -v-cg switch, which right now just prints "codegen: module.name (module/name.d)" to stdout, this can really help figuring out where, in some complex build command, things go wrong.
2009-05-16 18:19:52 +02:00
Frits van Bommel
287b1278d3 Remove struct padding when passing or returning in registers on x86-64 (extern(D) only) 2009-05-14 20:36:55 +02:00
Frits van Bommel
35d62be334 Remove some other code that tested for LLVM before r67588. 2009-05-12 16:02:51 +02:00
Christian Kamm
cae1f425a0 Update for LLVM rev > 71348: getTypePaddedSize -> getTypeAllocSize 2009-05-09 18:57:00 +02:00
Tomas Lindquist Olsen
ca39bb4f4d Fixed array operation codegen when used from imported templates. All array operations are now emitted with template linkage. Fixed #270 . 2009-04-29 18:59:39 +02:00
Tomas Lindquist Olsen
3d9598d854 Merge with rev [1221] 2009-04-17 01:19:03 +02:00
Frits van Bommel
33eb3133f3 Unbreak nested naked functions. 2009-04-17 01:14:35 +02:00
Tomas Lindquist Olsen
1437bd6b7e Merge. 2009-04-16 20:31:21 +02:00
Frits van Bommel
1ef9941daf Name some types. 2009-04-15 21:37:01 +02:00
Tomas Lindquist Olsen
37cf5a5789 Added Doxygen file.
Completely seperated type and symbol generation. Should fix a lot of bugs, but is not yet 100% complete.
2009-04-15 20:06:25 +02:00
Frits van Bommel
c44c52296f Give all symbols nested in functions internal linkage, unless it's one of the
other special cases.
(for example: this shouldn't be done if the symbol in question is also nested
in a template; such symbols should get template-like linkage)
2009-04-13 16:16:03 +02:00
Frits van Bommel
071bad95dc Add some alignment info where LLVM might otherwise be more pessimistic.
In particular, %.nest_arg is always aligned even though it's bitcast from i8*.

Pointers in vtables are also guaranteed to be stored at aligned addresses.
2009-04-12 21:56:43 +02:00
Tomas Lindquist Olsen
9c4b2b4036 Started seperating type resolution from the rest of codegen again, the merge had too many regressions. 2009-04-03 16:34:11 +02:00
Frits van Bommel
b602a13811 Give function & delegate literals, foreach bodies and lazy parameters internal
linkage.
2009-03-30 16:34:36 +02:00
Frits van Bommel
479b97ca87 Update DtoConstFP() to be correct after LLVM r67562, which changed the way the
APFloat constructor expects its i80 APInts to be formatted. (They're now
actually consistent with the x87 format)
2009-03-24 15:24:59 +01:00
Frits van Bommel
622a93a810 Make LDC work with LLVM trunk (s/LinkOnceLinkage/LinkOnceOdrLinkage/)
Also moved the #defines for linkage types into a separate header instead of
mars.h so we can #include revisions.h without having to rebuild the entire
frontend every time we update.
(I'm using revisions.h to get the LLVM revision for use in preprocessor
conditionals. It should work with LLVM release 2.5, old trunk and new trunk)
2009-03-08 16:13:10 +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
5dbe3ee8e2 Abstracted more (most) ABI details out of the normal codegen. 2009-03-03 02:51:21 +01:00
Frits van Bommel
e37c82d1ec Use LLVM OStream wrapper instead of <iostream> in the logger.
llvm::OStream provides all std::ostream functionality (by holding a
std::ostream* internally), but
 * doesn't include <iostream>, avoiding per-file overhead.
 * allows the stream pointer to be null, and the (inlined) operators do nothing
   when that's the case. (This also allows removal of the ofstream("/dev/null")
   hack Logger used when disabled, which presumably wasn't very portable)
2009-02-26 14:51:02 +01:00
Tomas Lindquist Olsen
57a69e8177 - Fixed LLVM style CL args for D2.
- Moved main() into its own file gen/main.cpp
- Fixed basic cross compilation
- removed the option for setting OS
- added support for llc's mattr, mcpu and mtriple switches
- added basic ABI abstraction for return value rewrites, it's not perfect and will probably be completely rewritten once I get to handling parameter rewrites as well.
- x86-64 extern(C) abi for cfloat returns now match (llvm-)gcc.
2009-02-26 14:11:49 +01:00
Tomas Lindquist Olsen
fc480b7fd8 SWITCHED TO LLVM 2.5 !
Applied patch from ticket #129 to compile against latest LLVM. Thanks Frits van Bommel.

Fixed implicit return by asm block at the end of a function on x86-32. Other architectures will produce an error at the moment. Adding support for new targets is fairly simple.

Fixed return calling convention for complex numbers, ST and ST(1) were switched around.

Added some testcases.

I've run a dstress test and there are no regressions. However, the runtime does not seem to compile with symbolic debug information. -O3 -release -inline works well and is what I used for the dstress run. Tango does not compile, a small workaround is needed in tango.io.digest.Digest.Digest.hexDigest. See ticket #206 .
2009-02-08 05:26:54 +01:00
Tomas Lindquist Olsen
9bd52922bd Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases. 2009-02-04 18:48:03 +01:00
Tomas Lindquist Olsen
dc5944df99 Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Fixed align N; in asm blocks.

Fixed inreg parameter passing on x86 for ref/out params.

Removed support for lazy initialization of function local static variables, I have no idea why I ever implemented this, it's not in the D spec, and DMD doesn't support it :P

Some of the global variable related changes might cause minor regressions, but they should be easily fixable.
2009-02-03 08:54:57 +01:00
Tomas Lindquist Olsen
75591b3c16 Changed templates and typeinfo to use linkonce linkage instead of weak linkage, this should fix inlining problems, fixing bug #197 . If problems show up, it's easy to change it back by changing the define in mars.h . I'm 95% sure this is safe, given how we handle templates. 2009-02-02 01:44:51 +01:00
Tomas Lindquist Olsen
343003cfdc Makes sure only function definitions inside templates get weak linkage, llvm doesn't allow weak linkage on just declarations, so we use external linkage for those. Fixes #162 2009-01-22 17:26:50 +01:00