aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-11-18 11:06:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-11-18 11:06:29 -0800
commit7d95ee5784c4e1bd475aef46ebcdf4f4cac5cfbe (patch)
tree085bfb186cafc07a18013016d0b57f77e12ac83c
parent23b72d462b1c0192d363c5def043d2da3b072f30 (diff)
add new var intertype for hollowed-out phis
-rw-r--r--src/analyzer.js3
-rw-r--r--src/jsifier.js24
2 files changed, 15 insertions, 12 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 6cfb2b6d..a3428250 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -684,6 +684,9 @@ function analyzer(data) {
value: param.value
});
}
+ // The assign to phi is now just a var
+ line.intertype = 'var';
+ line.value = null;
}
});
});
diff --git a/src/jsifier.js b/src/jsifier.js
index d158a9b9..6d77fe4f 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -634,6 +634,9 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
}
});
}
+ makeFuncLineActor('var', function(item) { // assigns into phis become simple vars when MICRO_OPTS
+ return 'var ' + item.ident + ';';
+ });
makeFuncLineActor('store', function(item) {
var value = finalizeLLVMParameter(item.value);
if (pointingLevels(item.pointerType) == 1) {
@@ -819,20 +822,17 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
});
makeFuncLineActor('phi', function(item) {
var params = item.params;
- if (!MICRO_OPTS) {
- function makeOne(i) {
- if (i === params.length-1) {
- return finalizeLLVMParameter(params[i].value);
- }
- return '__lastLabel__ == ' + getLabelId(params[i].label) + ' ? ' +
- finalizeLLVMParameter(params[i].value) + ' : (' + makeOne(i+1) + ')';
+ assert(!MICRO_OPTS);
+ function makeOne(i) {
+ if (i === params.length-1) {
+ return finalizeLLVMParameter(params[i].value);
}
- var ret = makeOne(0);
- if (item.postSet) ret += item.postSet;
- return ret;
- } else { // MICRO_OPTS == 1
- assert(0, 'TODO');
+ return '__lastLabel__ == ' + getLabelId(params[i].label) + ' ? ' +
+ finalizeLLVMParameter(params[i].value) + ' : (' + makeOne(i+1) + ')';
}
+ var ret = makeOne(0);
+ if (item.postSet) ret += item.postSet;
+ return ret;
});
makeFuncLineActor('mathop', processMathop);