Commit graph

46 commits

Author SHA1 Message Date
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
Tomas Lindquist Olsen
306ebfca83 [svn r256] AsmBlockStatement was still being flattened in some cases.
Function parameters passed as arguments to inline asm was not given storage.
2008-06-08 22:07:10 +02:00
Tomas Lindquist Olsen
6ededdd9e3 [svn r253] Removed -inlineasm option. inline asm is now enabled by default unless the new -noasm option is passed.
Tried adding a stack trace print when compiler crashes, not sure it's working though.
Changed data layouts to match that of llvm-gcc.
Fixed casting function pointers.
Added support checks in AsmStatement.
2008-06-08 19:09:24 +02:00
Tomas Lindquist Olsen
28382e3567 [svn r250] Fixed the warning about dropping arguments to _Dmain when optimizing.
Did a few cleanups in inline asm code.
2008-06-08 08:03:19 +02:00
Tomas Lindquist Olsen
68d7827d35 [svn r249] Changed inline asm clobbers to a set instead of a list so we don't get duplicate clobbers. 2008-06-08 06:45:54 +02:00
Tomas Lindquist Olsen
fd8cec14e1 [svn r248] Fixed: labels in inline asm block now work for the normal case.
Fixed: inline asm blocks are now emitted as a single asm entity.
2008-06-08 06:15:51 +02:00
Tomas Lindquist Olsen
3e62d80b4f [svn r247] fixed accessing global symbols from inline asm. 2008-06-08 01:07:58 +02:00
Tomas Lindquist Olsen
187d6523e3 [svn r245] initial support for labels in inline asm, broken :/ 2008-06-07 21:31:38 +02:00
Tomas Lindquist Olsen
27634ea5b6 [svn r243] fixed inline asm arg_pointer args hopefully. 2008-06-07 19:19:30 +02:00
Tomas Lindquist Olsen
1af9e9814a [svn r242] fixed (I think) arg_pointer inline asm args 2008-06-07 19:04:26 +02:00
Tomas Lindquist Olsen
47ac84b223 [svn r241] Fixed missing terminator for void main() with inline asm block. 2008-06-06 22:30:31 +02:00
Christian Kamm
cf4d71b02c [svn r240] do not crash on zero length constraints string 2008-06-06 22:04:41 +02:00
Christian Kamm
54b7134d78 [svn r239] also use indirect modifier for update constraints 2008-06-06 21:51:40 +02:00
Christian Kamm
5ee938ab0a [svn r238] use *m for memory input constraints and pass in their address 2008-06-06 21:44:17 +02:00
Tomas Lindquist Olsen
b917fe2f00 [svn r237] some inline asm output now seems to work, see tangotests/asm2.d 2008-06-06 20:51:43 +02:00
Tomas Lindquist Olsen
346d04aa8a [svn r236] added initial codegen of inline asm, pretty buggy and incomplete still. see the tangotests/asm1.d test for a sample of what does
work!
2008-06-06 20:14:51 +02:00
Christian Kamm
68d5150c1b [svn r235] rough port of GDC's inline assembler code, unfinished 2008-06-05 19:22:37 +02:00