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.
This commit is contained in:
Frits van Bommel
2009-06-07 16:00:13 +02:00
parent b972dcb92d
commit 96fdcd6347
15 changed files with 201 additions and 9 deletions

View File

@@ -35,6 +35,7 @@
#include "gen/logger.h"
#include "gen/linker.h"
#include "gen/irstate.h"
#include "gen/optimizer.h"
#include "gen/toobj.h"
#include "gen/metadata.h"
#include "gen/passes/Passes.h"
@@ -811,6 +812,17 @@ int main(int argc, char** argv)
* not be found at link time.
*/
if (!global.params.useArrayBounds && !global.params.useAssert)
#elif LLVM_REV >= 68940
// This doesn't play nice with debug info at the moment
if (!global.params.symdebug && willInline())
{
global.params.useAvailableExternally = true;
Logger::println("Running some extra semantic3's for inlining purposes");
#else
// IN_LLVM, but available_externally not available yet.
if (false)
{
#endif
{
// Do pass 3 semantic analysis on all imported modules,
// since otherwise functions in them cannot be inlined
@@ -825,6 +837,7 @@ int main(int argc, char** argv)
fatal();
}
#if !IN_LLVM
for (int i = 0; i < modules.dim; i++)
{
m = (Module *)modules.data[i];
@@ -832,10 +845,10 @@ int main(int argc, char** argv)
printf("inline scan %s\n", m->toChars());
m->inlineScan();
}
#endif
}
if (global.errors)
fatal();
#endif
// write module dependencies to file if requested
if (global.params.moduleDepsFile != NULL)