diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-05-26 13:32:57 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-05-26 13:32:57 -0700 |
commit | 78ee9a8f64d734405e8e85e03c3d3768fce45e41 (patch) | |
tree | 14f97e1a795561dfdc8a465aca09cb1979199f64 /src/parseTools.js | |
parent | d3efb7dcb71f0d9d6df09fee687fa1dbd0bde9bf (diff) |
improve CHECK_* options, add initial version of AUTO_OPTIMIZE
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 9e0fc24c..5dec458e 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -848,9 +848,15 @@ function getGetElementPtrIndexes(item) { function handleOverflow(text, bits) { if (!bits) return text; - if (bits <= 32 && correctOverflows()) text = '(' + text + ')&' + (Math.pow(2, bits) - 1); - if (!CHECK_OVERFLOWS || correctSpecificOverflow()) return text; // If we are correcting a specific overflow here, do not check for it - return 'CHECK_OVERFLOW(' + text + ', ' + bits + ')'; + var correct = correctOverflows(); + warn(!correct || bits <= 32, 'Cannot correct overflows of this many bits: ' + bits); + if (CHECK_OVERFLOWS) return 'CHECK_OVERFLOW(' + text + ', ' + bits + ')'; + if (!correct) return text; + if (bits <= 32) { + return '(' + text + ')&' + (Math.pow(2, bits) - 1); + } else { + return text; // We warned about this earlier + } } // From parseLLVMSegment |