diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-07 17:15:41 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-07 17:15:41 -0800 |
commit | d882ef00a1ee716e88982e34b9edf6b52af2639b (patch) | |
tree | 3aedd2d8423ab33f12e7fade2e064c85d4160e97 /src | |
parent | 46239004b3a674c874425ecbc55b478e892b61c3 (diff) |
fix bug with not fully processing ptrtoint and inttoptr in i64 mode 1
Diffstat (limited to 'src')
-rw-r--r-- | src/parseTools.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 75f5f65d..71e8a771 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1339,10 +1339,7 @@ function finalizeLLVMFunctionCall(item, noIndexizeFunctions) { // from one file to another, would be enough to fix this), or, do not pass structs by value (which in general // is inefficient, and worth avoiding if you can). } - case 'inttoptr': - case 'ptrtoint': - return finalizeLLVMParameter(item.params[0], noIndexizeFunctions); - case 'icmp': case 'mul': case 'zext': case 'add': case 'sub': case 'div': + case 'icmp': case 'mul': case 'zext': case 'add': case 'sub': case 'div': case 'inttoptr': case 'ptrtoint': var temp = { op: item.intertype, variant: item.variant, @@ -1655,7 +1652,8 @@ function processMathop(item) { return '((' + ident1 + '[0]) & ' + (Math.pow(2, bitsLeft)-1) + ')'; } case 'select': return ident1 + ' ? ' + makeCopyI64(ident2) + ' : ' + makeCopyI64(ident3); - case 'ptrtoint': case 'inttoptr': throw 'Pointers cannot be 64-bit!'; + case 'ptrtoint': throw 'Pointers cannot be 64-bit!'; + case 'inttoptr': return '(' + ident1 + '[0])'; // just directly truncate the i64 to a 'pointer', which is an i32 // Dangerous, rounded operations. TODO: Fully emulate case 'add': warnI64_1(); return handleOverflow(splitI64(mergeI64(ident1) + '+' + mergeI64(ident2)), bits); case 'sub': warnI64_1(); return handleOverflow(splitI64(mergeI64(ident1) + '-' + mergeI64(ident2)), bits); @@ -1790,6 +1788,7 @@ function processMathop(item) { } return ident1 + ret; } + case 'bitcast': return ident1; default: throw 'Unknown mathcmp op: ' + item.op; } } |