Chromium Code Reviews| Index: src/llvm2ice.cpp |
| diff --git a/src/llvm2ice.cpp b/src/llvm2ice.cpp |
| index bd86c57509c7d854ed5d432ce010dfa27e1165f2..7501bc1d45b400f1d4f3be3f396ee50e4f6a5bee 100644 |
| --- a/src/llvm2ice.cpp |
| +++ b/src/llvm2ice.cpp |
| @@ -203,6 +203,13 @@ GenerateBuildAtts("build-atts", |
| "this executable."), |
| cl::init(false)); |
| +static cl::opt<uint32_t> |
| +NumThreads("threads", |
| + cl::desc("Number of translation threads (0 for purely sequential)"), |
| + cl::init(0)); |
|
JF
2015/01/22 20:50:56
This should default to std::thread::hardware_concu
Jim Stichnoth
2015/01/23 07:55:55
Well, 1 isn't exactly sequential, as there would b
|
| +static cl::alias SplitModule("split-module", cl::desc("Alias for -threads"), |
|
Karl
2015/01/22 20:41:13
Not sure this can be an alias. Single threaded for
JF
2015/01/22 20:50:56
Why add the alias at all?
Jim Stichnoth
2015/01/23 07:55:55
The idea was to make it easier to plumb llvm2ice a
|
| + cl::NotHidden, cl::aliasopt(NumThreads)); |
| + |
| static int GetReturnValue(int Val) { |
| if (AlwaysExitSuccess) |
| return 0; |
| @@ -288,14 +295,15 @@ int main(int argc, char **argv) { |
| Flags.DisableTranslation = DisableTranslation; |
| Flags.FunctionSections = FunctionSections; |
| Flags.DataSections = DataSections; |
| - Flags.UseIntegratedAssembler = UseIntegratedAssembler; |
| Flags.UseELFWriter = UseELFWriter; |
| + Flags.UseIntegratedAssembler = UseIntegratedAssembler; |
| Flags.UseSandboxing = UseSandboxing; |
| Flags.PhiEdgeSplit = EnablePhiEdgeSplit; |
| Flags.DecorateAsm = DecorateAsm; |
| Flags.DumpStats = DumpStats; |
| Flags.AllowUninitializedGlobals = AllowUninitializedGlobals; |
| Flags.TimeEachFunction = TimeEachFunction; |
| + Flags.NumTranslationThreads = NumThreads; |
| Flags.DefaultGlobalPrefix = DefaultGlobalPrefix; |
| Flags.DefaultFunctionPrefix = DefaultFunctionPrefix; |
| Flags.TimingFocusOn = TimingFocusOn; |
| @@ -351,6 +359,8 @@ int main(int argc, char **argv) { |
| Ctx.getObjectWriter()->writeInitialELFHeader(); |
| } |
| + Ctx.startWorkerThreads(); |
| + |
| int ErrorStatus = 0; |
|
JF
2015/01/22 20:50:56
This should also be an std::vector<std::error_code
Jim Stichnoth
2015/01/23 07:55:55
Changed to std::error_code.
|
| if (BuildOnRead) { |
| Ice::PNaClTranslator Translator(&Ctx, Flags); |
| @@ -378,6 +388,10 @@ int main(int argc, char **argv) { |
| << "--build-on-read=0 not allowed\n"; |
| return GetReturnValue(1); |
| } |
| + // Error status is the combination of the bitcode parser's error |
| + // status and the translation error status. |
| + ErrorStatus |= Ctx.getErrorStatus(); |
| + |
| if (UseELFWriter) { |
| Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx); |
| Ctx.getObjectWriter()->writeNonUserSections(); |