aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-12-31 13:54:16 -0800
committerAlon Zakai <alonzakai@gmail.com>2011-12-31 13:54:16 -0800
commit8fa566b01a5dea37d0d73e503ed29e4af39687ca (patch)
treebcb199a0c8dce88c83b87ab7ce834fc3a95dbd2d /src
parentc3af81d6df7de206890b5f1a9f9e67bb7a02d1aa (diff)
support ptrtoint into i64 in i64 mode 1
Diffstat (limited to 'src')
-rw-r--r--src/intertyper.js6
-rw-r--r--src/parseTools.js2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 4b4544ae..c9580319 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -815,8 +815,10 @@ function intertyper(data, sidePass, baseLineNums) {
} else {
item.type = item.param1.type;
}
- for (var i = 1; i <= 4; i++) {
- if (item['param'+i]) item['param'+i].type = item.type; // All params have the same type, normally
+ if (item.op != 'ptrtoint') {
+ for (var i = 1; i <= 4; i++) {
+ if (item['param'+i]) item['param'+i].type = item.type; // All params have the same type, normally
+ }
}
if (item.op in LLVM.EXTENDS) {
item.type = item.param2.ident;
diff --git a/src/parseTools.js b/src/parseTools.js
index 7f837419..88c7ce68 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1652,7 +1652,7 @@ function processMathop(item) {
return '((' + ident1 + '[0]) & ' + (Math.pow(2, bitsLeft)-1) + ')';
}
case 'select': return ident1 + ' ? ' + makeCopyI64(ident2) + ' : ' + makeCopyI64(ident3);
- case 'ptrtoint': throw 'Pointers cannot be 64-bit!';
+ case 'ptrtoint': return makeI64(ident1, 0);
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);