diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-03 21:11:57 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-03 21:11:57 -0800 |
commit | 02cdea5859956e1bffcdc1f26a188200a529c53a (patch) | |
tree | 1794267ea5f1dd0ac72834fbf7e2a70c6ebcdfd2 /src/analyzer.js | |
parent | ab45ff99a7ebae47372492f7f1d445e4892aaf7e (diff) |
do not emit bash on legalized variables of <= 32 bits
Diffstat (limited to 'src/analyzer.js')
-rw-r--r-- | src/analyzer.js | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index f9b0c5af..ecb5ea6b 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -122,7 +122,8 @@ function analyzer(data, sidePass) { // Legalization if (USE_TYPED_ARRAYS == 2) { function getLegalVars(base, bits, allowLegal) { - if (allowLegal && bits <= 32) return [{ ident: base, bits: bits }]; + bits = bits || 32; // things like pointers are all i32, but show up as 0 bits from getBits + if (allowLegal && bits <= 32) return [{ ident: base + ('i' + bits in Runtime.INT_TYPES ? '' : '$0'), bits: bits }]; if (isNumber(base)) return getLegalLiterals(base, bits); var ret = new Array(Math.ceil(bits/32)); var i = 0; @@ -647,13 +648,7 @@ function analyzer(data, sidePass) { default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum, dump(item)]; } // Do the legalization - var sourceElements; - if (sourceBits <= 32) { - // The input is a legal type - sourceElements = [{ ident: value.params[0].ident, bits: sourceBits }]; - } else { - sourceElements = getLegalVars(value.params[0].ident, sourceBits); - } + var sourceElements = getLegalVars(value.params[0].ident, sourceBits, true); if (!isNumber(shifts)) { // We can't statically legalize this, do the operation at runtime TODO: optimize assert(sourceBits == 64, 'TODO: handle nonconstant shifts on != 64 bits'); |