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

@@ -12,6 +12,7 @@
#include "llvm/Support/PassNameParser.h"
#include "root.h" // error()
#include <cstring> // strcmp();
using namespace llvm;
@@ -78,6 +79,19 @@ bool doInline() {
|| (enableInlining == cl::BOU_UNSET && optimizeLevel >= 3);
}
// Determine whether the inliner will be run.
bool willInline() {
if (doInline())
return true;
// It may also have been specified explicitly on the command line as an explicit pass
typedef cl::list<const PassInfo*, bool, PassNameParser> PL;
for (PL::iterator I = passList.begin(), E = passList.end(); I != E; ++I) {
if (!std::strcmp((*I)->getPassArgument(), "inline"))
return true;
}
return false;
}
// Some extra accessors for the linker: (llvm-ld version only, currently unused?)
int optLevel() {
return optimizeLevel;
@@ -108,7 +122,6 @@ static void addPassesForOptLevel(PassManager& pm) {
else
addPass(pm, createScalarReplAggregatesPass());
addPass(pm, createGlobalOptimizerPass());
addPass(pm, createGlobalDCEPass());
}
// -O2
@@ -208,6 +221,10 @@ static void addPassesForOptLevel(PassManager& pm) {
addPass(pm, createConstantMergePass());
}
if (optimizeLevel >= 1) {
addPass(pm, createGlobalDCEPass());
}
// level -O4 and -O5 are linktime optimizations
}