diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-12-08 17:16:34 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-12-08 17:16:34 -0800 |
commit | 5a74e784b2feac3268dedd17d425a26b0437452d (patch) | |
tree | b47f563f8797225daa43190f0042c466a8c990f6 | |
parent | a92111aaebcc90d9ec1c798b5c727c256b34a1e7 (diff) |
remove workaround with not indexizing aliases
-rw-r--r-- | src/jsifier.js | 6 | ||||
-rw-r--r-- | tests/cases/aliasbitcast2.ll | 27 |
2 files changed, 28 insertions, 5 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index a2ca03eb..45177c3f 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -341,7 +341,7 @@ function JSify(data, functionsOnly, givenFunctions) { var ret = [item]; item.JS = 'var ' + item.ident + ';'; // Set the actual value in a postset, since it may be a global variable. We also order by dependencies there - var value = finalizeLLVMParameter(item.value, true); // do *not* indexize functions here + var value = finalizeLLVMParameter(item.value); ret.push({ intertype: 'GlobalVariablePostSet', ident: item.ident, @@ -632,10 +632,6 @@ function JSify(data, functionsOnly, givenFunctions) { var local = funcData.variables[ident]; if (local) return local; var global = Variables.globals[ident]; - // FIXME: Currently, if something is an alias, we assume it is not a simple variable, so no need for - // FUNCTION_TABLE when calling it (which we do need for a normal simple global variable). In - // theory though an alias could be simple, we should probably check the type if this ever becomes a problem. - if (global && global.alias) global = null; return global || null; } diff --git a/tests/cases/aliasbitcast2.ll b/tests/cases/aliasbitcast2.ll new file mode 100644 index 00000000..8537e272 --- /dev/null +++ b/tests/cases/aliasbitcast2.ll @@ -0,0 +1,27 @@ +; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-linux-gnu" + +@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] + +@othername = alias bitcast (void ()* @original to void (i32)*) ; [#uses=1] + +; [#uses=2] +define void @original() { +entry: + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + br label %return + +return: ; preds = %entry + ret void +} + +; [#uses=1] +declare i32 @puts(i8*) + +; [#uses=0] +define i32 @main() { +entry: + call void @othername(i32 5) + ret i32 0 +} |