diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-11-11 16:32:28 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-11-11 16:32:28 -0800 |
commit | cf885bc56f0661542b7486a4bd6613a5d6666a53 (patch) | |
tree | 2d9868df4affd3467934eaaa8d088f788480ff39 | |
parent | 43c47cb2593903f64949c2d6d2ba60cb39480307 (diff) |
fix i64 extension bug not being done
-rw-r--r-- | src/intertyper.js | 19 | ||||
-rw-r--r-- | src/modules.js | 1 | ||||
-rw-r--r-- | src/parseTools.js | 2 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index b8100913..30fd7250 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -758,13 +758,18 @@ function intertyper(data, parseFunctions, baseLineNum) { } 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 (I64_MODE == 1) { - // Some specific corrections, since 'i64' is special - if (item.op in LLVM.SHIFTS) { - item.param2.type = 'i32'; - } else if (item.op == 'select') { - item.param1.type = 'i1'; - } + } + if (item.op in LLVM.EXTENDS) { + item.type = item.param2.ident; + item.param1.type = item.param2.type; + // TODO: also remove 2nd param? + } + if (I64_MODE == 1) { + // Some specific corrections, since 'i64' is special + if (item.op in LLVM.SHIFTS) { + item.param2.type = 'i32'; + } else if (item.op == 'select') { + item.param1.type = 'i1'; } } Types.needAnalysis[item.type] = 0; diff --git a/src/modules.js b/src/modules.js index c65362fd..7c61aea0 100644 --- a/src/modules.js +++ b/src/modules.js @@ -12,6 +12,7 @@ var LLVM = { ACCESS_OPTIONS: set('volatile', 'atomic'), INVOKE_MODIFIERS: set('alignstack', 'alwaysinline', 'inlinehint', 'naked', 'noimplicitfloat', 'noinline', 'alwaysinline attribute.', 'noredzone', 'noreturn', 'nounwind', 'optsize', 'readnone', 'readonly', 'ssp', 'sspreq'), SHIFTS: set('ashr', 'lshr', 'shl'), + EXTENDS: set('sext', 'zext'), INTRINSICS_32: set('_llvm_memcpy_p0i8_p0i8_i64', '_llvm_memmove_p0i8_p0i8_i64', '_llvm_memset_p0i8_i64'), // intrinsics that need args converted to i32 in I64_MODE 1 }; LLVM.GLOBAL_MODIFIERS = set(keys(LLVM.LINKAGES).concat(['constant', 'global', 'hidden'])); diff --git a/src/parseTools.js b/src/parseTools.js index bdb5c533..6c9494a6 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -1419,7 +1419,7 @@ function processMathop(item) { with(item) { return '(tempBigInt=(' + value + '), tempBigInt-tempBigInt%1)'; } - if ((paramTypes[0] == 'i64' || paramTypes[1] == 'i64') && I64_MODE == 1) { + if ((type == 'i64' || paramTypes[0] == 'i64' || paramTypes[1] == 'i64') && I64_MODE == 1) { switch (op) { // basic integer ops case 'or': { |