aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-25 23:01:27 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-25 23:01:27 -0800
commita7e095b850399135907eebae1655d3856d5fd497 (patch)
tree3cf28858b204ad620c9dc21164d4edf2638e2e59
parent38651b356595dbdfe9c81fb87a3a799d726bcbc0 (diff)
support more mathops in legalizer
-rw-r--r--src/analyzer.js16
-rwxr-xr-xtests/runner.py2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 4dd95e7a..ac24f5c4 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -182,6 +182,13 @@ function analyzer(data, sidePass) {
i++;
}
}
+ function fixUnfolded(item) {
+ // Unfolded items may need some correction to work properly in the global scope
+ if (item.intertype in MATHOPS) {
+ item.op = item.intertype;
+ item.intertype = 'mathop';
+ }
+ }
data.functions.forEach(function(func) {
// Legalize function params
legalizeFunctionParameters(func.params);
@@ -221,6 +228,7 @@ function analyzer(data, sidePass) {
var tempIdent = '$$emscripten$temp$' + (tempId++);
subItem.assignTo = tempIdent;
unfolded.unshift(subItem);
+ fixUnfolded(subItem);
return { intertype: 'value', ident: tempIdent, type: subItem.type };
}
});
@@ -385,10 +393,12 @@ function analyzer(data, sidePass) {
}
// fall through
}
- case 'inttoptr': case 'ptrtoint': {
+ case 'inttoptr': case 'ptrtoint': case 'zext': case 'sext': case 'trunc': case 'ashr': case 'lshr': case 'shl': case 'or': case 'and': case 'xor': {
value = {
op: item.intertype,
- params: [item.params[0]] // XXX
+ variant: item.variant,
+ type: item.type,
+ params: item.params
};
// fall through
}
@@ -418,7 +428,7 @@ function analyzer(data, sidePass) {
// fall through
}
case 'trunc': case 'zext': case 'ptrtoint': {
- targetBits = getBits(value.params[1].ident);
+ targetBits = getBits(value.params[1] ? value.params[1].ident : value.type);
break;
}
case 'inttoptr': {
diff --git a/tests/runner.py b/tests/runner.py
index fdc7ea9e..4aa15510 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4013,6 +4013,8 @@ def process(filename):
printf( "%i %i %i", one, two, three );
}
'''
+ #for linkable in [0]:
+ # Settings.LINKABLE = linkable # regression check for issue #273
self.do_run(src, "1 2 3")
def test_readdir(self):