Commit graph

166 commits

Author SHA1 Message Date
David Nadlinger
abd1d160f4 Tabs->spaces. 2011-11-14 20:10:45 +01:00
Alexey Prokhin
629f13929e WIP: port to llvm 3.0 2011-10-25 15:43:39 +04:00
Alexey Prokhin
8f4a15c868 Fix ldc1 regressions 2011-09-10 13:24:29 +04: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
7a31b599cc Updated to dmdfe 2.054 2011-07-19 19:20:38 +04:00
Alexey Prokhin
c5e9784863 Updated to dmdfe 2.051 2011-01-05 18:21:40 +03:00
Alexey Prokhin
3ceb476d32 Inline assembler is not allowed in @safe functions 2011-01-04 19:18:53 +03: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
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
66101517d7 LLVMContext changes up to r77366 2009-07-30 15:25:10 +02:00
Benjamin Kramer
d7049de966 More factory methods moved to LLVMContext 2009-07-15 18:09:41 +02:00
Frits van Bommel
4158fb474a Add an llvm::OStream workalike class for use with Logger::cout(), with the
crucial difference being special handling of `llvm::Type`s so they get printed
by name rather than printing their full representation (which can be positively
*huge*).

This allows re-enabling some logger calls that were disabled due to extreme
verbosity.
2009-06-16 19:31:10 +02:00
Tomas Lindquist Olsen
f5d635dfc7 Adds explicit alignment information for alloca instructions in general, there's a few cases that still needs to be looked at but this should catch the majority. Fixes ticket #293 . 2009-05-14 13:26:40 +02:00
Christian Kamm
0ef57dcfbe Reenable error for gotos into or out of finally blocks. 2009-03-28 19:16:53 +01:00
Christian Kamm
671c7791e3 Reorganize EnclosingHandlers to require less changes to the frontend and allow us to
implement the synchronized storage class for functions.
2009-03-24 21:18:18 +01:00
Tomas Lindquist Olsen
8b751cce0e - Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
2009-03-12 20:37:27 +01:00
Frits van Bommel
ff354d59b2 Use stringstream in asm generation instead of OutBuffer.
Besides looking better, this should reduce allocations and copying.
2009-03-12 14:08:57 +01:00
Frits van Bommel
c1bd2234a9 Clean up asm code a bit.
- Use vector instead of Array, reducing allocations.
 - Use vectors instead of deques since we only push_back and index.
 - Remove redundant typedefs of iterators.
 - Comment out unused variable (used only in commented-out GDC code).
 - A few whitespace changes.
2009-03-12 14:08:57 +01:00
Frits van Bommel
2687d58198 Always pass an address expression (not a var expression) to asm operands of
type Arg_Memory.

This fixes the following code:
{{{
  void f(real x) { asm { fld x[RBP];      } }
  void g(int x)  { asm { mov EAX, x[RBP]; } }
}}}
2009-03-08 00:57:58 +01:00
Tomas Lindquist Olsen
bb495c6e40 remove memory clobber again ... 2009-03-03 19:27:23 +01:00
Tomas Lindquist Olsen
ae214b18e7 Added ~{memory} clobber when a jump_target is generated in inline asm (branch out of inline asm) 2009-03-03 19:18:47 +01:00
Frits van Bommel
695fc3f5c3 Fix some -vv output 2009-02-26 14:51:05 +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
Frits van Bommel
8ce2c9773e Clean up the code generated when jumping out of inline asm and make label names more expressive. 2009-02-18 22:50:22 +01:00
Frits van Bommel
e3d6b1c051 Fix some assembler issues:
The assembler was miscompiling "add" (specifically, the "add reg/mem, imm"
variations).
The change that caused this seems to have been made because without it, some
"add"s didn't compile at all.

This patch reverts the previous change, and makes sure assembler operands are
remapped correctly even though the input operands auto-generated due to
updating operations aren't explicitly used.
2009-02-18 21:46:14 +01:00
Frits van Bommel
3ee7952451 Fix a latent bug in the asm code.
I think that technically, using "*m0" instead of "*0" allows LLVM to pick
between using the same memory as output 0 and using a new memory location.
(So far I haven't been able to construct a testcase that actually breaks
because of this, though)
2009-02-18 03:38:12 +01:00
Frits van Bommel
9cad440d4c Fix the problems exposed by the callingconv1.d test case.
The first was that unless otherwise specified, inputs are assumed to be in
registers even if they specify a "matching output" that's in memory.

While testing that fix, I also ran into a bug causing the generated "matching
output" for any input was always the first one instead of the correct one.
2009-02-17 00:08:20 +01:00
Frits van Bommel
f5bd002d80 Add some extra debug output that's useful in diagnosing inline assembler bugs. 2009-02-16 23:56:56 +01:00
Frits van Bommel
2dec6aeb41 Implement implicit return after inline asm on x86_64 2009-02-15 18:04:22 +01:00
Tomas Lindquist Olsen
4dee095dc3 Added support for using a temporary to implement emulated ABI return from inline asm, could be easier to use, but I think this will do. It's so extremely target dependent in any case that doing a completely generic approach seems hard. 2009-02-14 15:25:48 +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
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
Christian Kamm
cdbc4f84d2 Fix warnings on x86-64. By fvbommel. 2008-11-28 21:24:08 +01:00
Tomas Lindquist Olsen
c4c1c1d72e Added initial D2 support, D2 frontend and changes to codegen to make things compile. 2008-11-11 01:38:48 +01:00
Christian Kamm
bc80a83666 Merge wilsonk's x86-64 inline assembly. 2008-11-08 22:29:19 +01:00
Tomas Lindquist Olsen
bcafbe169d Wrapped all the most potentially expensive logging calls in a conditional to only do work when actually requested.
Commented some logging calls that could potentially write out many megabytes of type dumps.
2008-10-01 18:32:31 +02:00
Christian Kamm
4e0b6b4bf0 Make sure functions containing inline asm are never inlined to avoid
duplicated labels.
2008-09-08 20:38:55 +02:00
Tomas Lindquist Olsen
b41a80cefc Reverted some changes in the Tango patch, splitting asm block is simply not supported by llvm. 2008-08-24 16:51:17 +02:00
Christian Kamm
8362b86c5a Move AllocaInst creation into DtoAlloca helper. Will enable special zero-init of fp80 reals' padding. 2008-08-05 19:28:19 +02:00
Christian Kamm
bcc4cfdea4 [svn r377] The previous check was too strict, it completely disallowed gotos within finally blocks. This reenables them as long as they don't cross a finally boundary. 2008-07-14 12:00:24 +02:00
Tomas Lindquist Olsen
832504e5d7 [svn r357] Merged DMD 1.033 2008-07-12 19:38:31 +02:00
Christian Kamm
ff52c70e1d [svn r333] Fix inline asm bug with multiple branches to the same label. 2008-06-29 22:07:15 +02:00
Tomas Lindquist Olsen
0d160ffc76 [svn r330] Implemented synchronized statements.
Changed the tryfinally handlers to a more generalized EnclosingHandler.
Changed ClassInfoS to be mutable so they can be used as locks.
Added new BB after throw ala return/break etc.
2008-06-28 11:37:53 +02:00
Tomas Lindquist Olsen
03d26e1178 [svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
Fixed problems with label collisions when using labels inside inline asm. LabelStatement is now easily reached given its
Identifier, which should be useful elsewhere too.
Enabled inline asm for building the lib/compiler/llvmdc runtime code, fixing branches out of asm makes this possible.
2008-06-27 22:04:35 +02:00
Christian Kamm
b064c794de [svn r325] Removed dead code.
Added license info to code from GDC (David Friedman permitted us to use the files under the Artistic License).
Added asmLabel check to DtoGoto to avoid jumping into inline asm. Doesn't work currently as LabelDsymbol::asmLabel is never set to true.
2008-06-25 23:42:38 +02:00
Christian Kamm
7250b0630c [svn r324] Small indentation fixes.
Added end of line to complex.cpp.
2008-06-25 20:42:30 +02:00
Christian Kamm
7b37093cff [svn r323] Branching out of inline asm works.
Renamed emit_finallyblocks to DtoFinallyBlocks and moved to llvmhelpers.
Added enclosingtryfinally to AsmBlockStatement, so branches out of asm blocks respect finallys.
Refactored some GotoStatement code into DtoGoto.
2008-06-25 20:39:09 +02:00
Christian Kamm
37a74d1975 [svn r322] More asm-to-outside jumping work. Unfinished. 2008-06-24 22:48:33 +02:00
Christian Kamm
57977cd420 [svn r321] Fix bug in argument remapping functions. 2008-06-24 22:27:55 +02:00
Christian Kamm
84dd282b8c [svn r320] Begun work on branches out of asm blocks. Unfinished. 2008-06-24 21:38:23 +02:00