diff options
Diffstat (limited to 'src/compiler.js')
| -rw-r--r-- | src/compiler.js | 28 | 
1 files changed, 26 insertions, 2 deletions
diff --git a/src/compiler.js b/src/compiler.js index e589646b..3220c977 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -129,7 +129,13 @@ load('settings.js');  var settings_file = arguments_[0];  var ll_file = arguments_[1]; -additionalLibraries = Array.prototype.slice.call(arguments_, 2); +phase = arguments_[2]; +if (phase == 'pre') { +  additionalLibraries = Array.prototype.slice.call(arguments_, 3); +} else { +  var forwardedDataFile = arguments_[3]; +  additionalLibraries = Array.prototype.slice.call(arguments_, 4); +}  if (settings_file) {    var settings = JSON.parse(read(settings_file)); @@ -191,6 +197,15 @@ load('jsifier.js');  globalEval(processMacros(preprocess(read('runtime.js'))));  Runtime.QUANTUM_SIZE = QUANTUM_SIZE; +var temp = {}; +for (var i = 0; i < NECESSARY_BLOCKADDRS.length; i++) { +  var func = toNiceIdent(NECESSARY_BLOCKADDRS[i][0]); +  var label = toNiceIdent(NECESSARY_BLOCKADDRS[i][1]); +  if (!temp[func]) temp[func] = {}; +  temp[func][label] = 1; +} +NECESSARY_BLOCKADDRS = temp; +  //===============================  // Main  //=============================== @@ -209,8 +224,17 @@ raw = null;  // Pre-process the LLVM assembly +//printErr('JS compiler in action, phase ' + phase); +  Debugging.handleMetadata(lines); -PreProcessor.eliminateUnneededIntrinsics(lines); + +if (phase != 'pre') { +  PassManager.load(read(forwardedDataFile)); + +  if (phase == 'funcs') { +    PreProcessor.eliminateUnneededIntrinsics(lines); +  } +}  // Do it  | 
