aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-18 18:07:11 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-18 18:07:11 -0800
commit4a98beb9635946c2de45ae6987a6153d790292bb (patch)
tree808de337543a5a2aede0eccc9dc50f2dcf6320a6 /src
parent991e5c6a3ee144c6ee6193208446f28ce9def60d (diff)
detect correct type of all LLVM conversions
Diffstat (limited to 'src')
-rw-r--r--src/intertyper.js2
-rw-r--r--src/modules.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 4e2c17e3..42dee437 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -837,7 +837,7 @@ function intertyper(data, sidePass, baseLineNums) {
if (item.op === 'select') {
assert(item.params[1].type === item.params[2].type);
item.type = item.params[1].type;
- } else if (item.op === 'inttoptr' || item.op === 'ptrtoint' || item.op === 'uitofp' || item.op === 'sitofp') {
+ } else if (item.op in LLVM.CONVERSIONS) {
item.type = item.params[1].type;
} else {
item.type = item.params[0].type;
diff --git a/src/modules.js b/src/modules.js
index d517ac70..5e2b324e 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -16,6 +16,7 @@ var LLVM = {
PHI_REACHERS: set('branch', 'switch', 'invoke', 'indirectbr'),
EXTENDS: set('sext', 'zext'),
COMPS: set('icmp', 'fcmp'),
+ CONVERSIONS: set('inttoptr', 'ptrtoint', 'uitofp', 'sitofp', 'fptosi', 'fptoui'),
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 USE_TYPED_ARRAYS == 2
};
LLVM.GLOBAL_MODIFIERS = set(keys(LLVM.LINKAGES).concat(['constant', 'global', 'hidden']));