Commit Graph

1536 Commits

Author SHA1 Message Date
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
8576788245 Get rid of USE_METADATA 2009-07-11 14:19:21 +02:00
Benjamin Kramer
45f7401a5b Remove all of the now unecessary #if LLVM_REV 2009-07-11 14:09:33 +02:00
Benjamin Kramer
917bd7b901 Remove duplicated code
This was implemented for windows in llvm r73379
2009-07-11 13:58:23 +02:00
Christian Kamm
72d1f1e6dd Make the auto storage class never have the same meaning as scope.
This changes the meaning of
auto class MyClass {} and
auto MyClass ident;
Both have been made an error to prevent accidents.
2009-07-12 16:15:21 +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
c4c38715ef Updated default ldc2 configuration file. 2009-07-09 21:13:19 +01:00
Robert Clipsham
4fbcd9b9c4 A couple of ldc2 tweaks now druntime compiles. 2009-07-09 12:36:08 +01:00
Robert Clipsham
b73e45940a Merged dmdfe 2.031. 2009-07-07 02:26:11 +01:00
Robert Clipsham
e5b7c25597 Removed druntime from the repository.
Updated .hgignore to ignore druntime.
2009-07-06 23:57:27 +01:00
Robert Clipsham
951e961f9e Merge. 2009-07-06 23:56:11 +01:00
Robert Clipsham
1812c5b00a Fixed some unmerged parts of the D2 frontend.
Removed the automatic linker flags for D2 (temp).
Renamed a runtime function for D2.
2009-07-06 23:54:02 +01:00
Christian Kamm
feaefc3314 Better error handling for CMake LLVM config file detection. 2009-07-03 18:49:42 +02:00
Benjamin Kramer
22b36384b0 Fix build for LLVM >= r74640
Some LLVM objects now take a 'Context' to make multi-threaded apps easier.
Since we're not multi-threaded it's safe to use llvm::getGlobalContext()
which gives us the same behavior as we had before.
2009-07-03 17:24:35 +02:00
Christian Kamm
151e266deb Yet another fix for finding llvm's config file.
Since llvm-config --includedir sometimes includes the trailing llvm/ and
sometimes it doesn't, we just check both directories.
2009-06-30 22:07:50 +02:00
Christian Kamm
81e0b81e10 LLVM_INSTDIR -> LLVM_INCLUDEDIR fix by d0k. 2009-06-29 21:44:11 +02:00
Christian Kamm
88f6e9e83a Initialize LLVM target and asmprinter for the native and extra targets.
Uses some CMake hackery to get the native LLVM target name, since it only
provides a conveniance function for initializing the native target and not the
native asmprinter.
2009-06-26 21:02:23 +02:00
Christian Kamm
e0331c7b53 Make debug info work with newer LLVM. 2009-06-26 21:00:12 +02:00
Christian Kamm
8bbf6ab984 Treat ConditionalDeclarations correctly in DtoDeclarationExp.
Fixes #332.
2009-06-26 17:18:36 +02:00
Frits van Bommel
8e8837737a Be a little less overzealous with arrays of void-initialized typedefs;
initialize `new VoidTD[][](2)` and `new VoidTD[][][](2, 3)` (but not
`new VoidTD[2][3]`, which is a dynamic array of static arrays of
void-initialized typedefs).
2009-06-24 18:01:02 +02:00
Frits van Bommel
c6750b34b7 Don't initialize arrays of (arrays of...) void-initialized typedefs. 2009-06-24 17:14:50 +02:00
Christian Kamm
5658d9bb38 Emit file and line info for 'Array operation ... not recognized' error.
Fixes #326.
2009-06-22 19:31:25 +02:00
Christian Kamm
265cbea170 Make == for associative arrays test for equality, not identity.
_aaEq was added to runtime/internal/aaA.d which forwards to
TypeInfo_AssociativeArray.equals in genobj.d. On the codegen side, DtoAAEquals
was added to gen/aa.cpp and is called from EqualExp::toElem in gen/toir.cpp.

I assume that the frontend will produce an error if == is used on associative
arrays of different type.

This fixes DMD bug 1429.
2009-06-21 19:05:24 +02:00
Frits van Bommel
62dee01d35 Implement equality comparison for associative arrays. The semantics aren't in
the spec, but DMD does a simple pointer comparison. Complaints about this go to
http://d.puremagic.com/issues/show_bug.cgi?id=1429 :P.
2009-06-21 00:12:29 +02:00
Frits van Bommel
c261c03752 Put scope-limited data on the stack instead of using 'new' and 'delete'. 2009-06-20 19:44:54 +02:00
Christian Kamm
d7b00783d3 Automated merge with http://hg.dsource.org/projects/ldc 2009-06-20 19:12:04 +02:00
Christian Kamm
42b3da8ac7 Move function codegen data from IrFunction to new FuncGen.
This change reduces memory consumption significantly by releasing the
memory held by the STL containers that are now inside FuncGen.
2009-06-20 19:11:44 +02:00
Frits van Bommel
5ecdf1a70a Eliminate comparisons between GC allocations and constants. This removes some
`assert(this !is null)`s when member functions get inlined.

Also tweak pass order a bit.
2009-06-20 14:28:59 +02:00
Frits van Bommel
465f15eda0 Return void* from _d_allocclass so LLVM doesn't do weird things with it...
This allows `-instcombine` followed by `-gvn` to do devirtualization, so add
`-gvn` in strategic places in the default pass order.
2009-06-20 11:39:13 +02:00
Robert Clipsham
34fbdb6271 Automated merge with http://hg.dsource.org/projects/ldc 2009-06-18 15:44:18 +01: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
Christian Kamm
7dbe9baa37 Made is and !is use the same numeric comparison as == and !=, fixes #328
Factored out common code from EqualExp and IdentityExp into
DtoBinNumericEquals in binexp.cpp.
2009-06-16 23:00:27 +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
Benjamin Kramer
348192e7e7 Build fix for LLVM >= r73431 2009-06-16 15:37:40 +02:00
Kelly Wilson
0c1b6e27d9 fix problem reported in ticket 327 - thanks d0k 2009-06-16 08:57:20 -06:00
Christian Kamm
723cfef519 Another shot at fixing the issues with (constant) struct literals and their addresses. See DMD2682, #218, #324.
The idea is to separate the notion of const from 'this variable can always be
replaced with its initializer' in the frontend. To do that, I introduced
Declaration::isSameAsInitializer, which is overridden in VarDeclaration to
return false for constants that have a struct literal initializer.

So
{{{
const S s = S(5);
void foo() { auto ps = &s; }
// is no longer replaced by
void foo() { auto ps = &(S(5)); }
}}}

To make taking the address of a struct constant with a struct-initializer
outside of function scope possible, I made sure that AddrExp::optimize doesn't
try to run the argument's optimization with WANTinterpret - that'd again
replace the constant with a struct literal temporary.
2009-06-14 19:49:58 +02:00
Christian Kamm
8357777440 Set the default RUNTIME_DIR to be side-by-side of the ldc source dir. 2009-06-14 14:28:11 +02:00
Christian Kamm
e54d75354c Cannot take the address of a slice or struct literal as a constant expression. 2009-06-14 12:27:51 +02:00
Christian Kamm
dbe949ede6 More DtoType -> DtoTypeNotVoid for getting the array element llvm type. 2009-06-12 21:34:35 +02:00
Christian Kamm
1563c14e7a The llvm element type of void arrays should be i8 and not void.
This caused DtoArrayCopyToSlice to fail when trying to get the size of
llvm-void for something like void[3] s = "abc"; inside a function.
2009-06-12 20:39:01 +02:00
Frits van Bommel
25ebb3dbcd Generate less dead code by deleting unreachable blocks at the end of functions
(which would otherwise appear if a function ends with a return, for example).
2009-06-12 16:41:38 +02:00
Christian Kamm
8bcc2d9b3f Increment the iterator before deleting redundant functions or globals in the StripExternals pass. 2009-06-11 21:48:10 +02:00
Frits van Bommel
bc7737a03b Add some passes that opt runs to the default pass list. 2009-06-11 16:57:45 +02:00
Frits van Bommel
1f7a2a7884 Teach stack promotion to walk the CFG when a potential reuse of an allocation
is found to see if it can actually happen instead of just assuming it will.

This allows it to catch cases like
{{{
int i;
Foo f;
while (cond(i))
    f = new Foo(i++);
return f.value;
}}}
where it previously wouldn't because a phi using the allocation would appear in
the condition block to propagate it to the use after the loop.
2009-06-11 02:04:44 +02:00
Frits van Bommel
bf89205f7d Look for configuration file in /etc and /etc/ldc too (absolute paths)
except on Windows. Also disabled the `$PREFIX/etc/ldc` case for Windows, since
the "/etc/ldc" part was #if'ed out anyway.
2009-06-09 12:19:52 +02:00
Christian Kamm
f8840f66c4 Move locating the configuration file into a separate function. Also look in PREFIX/etc/ldc. Fixes #322. 2009-06-08 19:48:20 +02:00
Frits van Bommel
9ba306a42f Oops, I accidentally pushed r1486 before the last touches were committed. 2009-06-08 13:52:45 +02:00
Frits van Bommel
8044a67720 Apply changes from r1482 to D2 frontend too. Completely untested, but ldc2
compiles again.
2009-06-08 13:45:26 +02:00
Frits van Bommel
b999f679a7 Teach -dgc2stack to promote GC allocations in simple loops to stack
allocations too. (A "simple" loop is one where the allocation isn't used in a
subsequent iteration)

This also means it's no longer necessary to run this pass multiple times.
Running it once after inlining should now catch all cases.
2009-06-08 12:35:55 +02:00