diff --git a/AUTHORS b/AUTHORS index 868800ea9f26e..03abe1435b052 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,7 +10,7 @@ a license to everyone to use it as detailed in LICENSE.) * Sigmund Vik * Jeff Terrace * Benoit Tremblay -* Andreas Bergmeier +* Andreas Bergmeier * Ben Schwartz * David Claughton * David Yip @@ -129,4 +129,7 @@ a license to everyone to use it as detailed in LICENSE.) * Haneef Mubarak * Nicolas Peri (copyright owned by ShiVa Technologies, SAS) * Bernhard Fey +* Dave Nicponski +* Jonathan Jarri +* Daniele Di Proietto diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.md similarity index 85% rename from CONTRIBUTING.markdown rename to CONTRIBUTING.md index ceea873534234..c068eb7f0a29a 100644 --- a/CONTRIBUTING.markdown +++ b/CONTRIBUTING.md @@ -1,5 +1,6 @@ +Contributing +============ See our wiki for information about contributing to Emscripten: [Contribution section on wiki](https://github.com/kripken/emscripten/wiki#contributing) - diff --git a/README.markdown b/README.markdown deleted file mode 100644 index 81a95141e8c67..0000000000000 --- a/README.markdown +++ /dev/null @@ -1,14 +0,0 @@ - -![logo](http://dl.dropbox.com/u/80664946/emscripten_logo.jpg) - -Emscripten -========== - -Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++, using llvm-gcc or clang, or any other language that can be converted into LLVM - and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run). - -Links to **demos**, **tutorial**, **FAQ**, etc: - -Main project page: - -Emscripten is MIT licensed, see LICENSE.txt. - diff --git a/README.md b/README.md new file mode 100644 index 0000000000000..8f0d244eb257a --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +![emscripten logo](media/switch_logo.png) + +Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated +from C/C++, using `llvm-gcc` (DragonEgg) or `clang`, or any other language that can be +converted into LLVM - and compiles that into JavaScript, which can be run on the web (or +anywhere else JavaScript can run). + +Links to **demos**, **tutorial**, **FAQ**, etc: + +Main project page: + +License +------- + +Emscripten is available under 2 licenses, the MIT license and the +University of Illinois/NCSA Open Source License. + +Both are permissive open source licenses, with little if any +practical difference between them. + +The reason for offering both is that (1) the MIT license is +well-known, while (2) the University of Illinois/NCSA Open Source +License allows Emscripten's code to be integrated upstream into +LLVM, which uses that license, should the opportunity arise. + +See `LICENSE` for the full content of the licenses. diff --git a/docs/emscripten_switch_logo.eps b/docs/emscripten_switch_logo.eps deleted file mode 100644 index 741970c1dd1aa..0000000000000 Binary files a/docs/emscripten_switch_logo.eps and /dev/null differ diff --git a/docs/emscripten_switch_logo.jpg b/docs/emscripten_switch_logo.jpg deleted file mode 100644 index 7c05cd94a5dd7..0000000000000 Binary files a/docs/emscripten_switch_logo.jpg and /dev/null differ diff --git a/emcc b/emcc index f7d1a939cfa02..de782071f7f27 100755 --- a/emcc +++ b/emcc @@ -470,7 +470,16 @@ Options that are modified or new in %s include: 1: Emit a separate memory initialization file in binary format. This is more efficient than storing it as text inside JavaScript, but does - mean you have another file to publish. + mean you have another file to publish. The + binary file will also be loaded asynchronously, + which means main() will not be called until + the file is downloaded and applied; you cannot + call any C functions until it arrives. (Call + yourself from main() to know when all async + stuff has happened and it is safe to call + library functions, as main() will only be + called at that time. You can also call + addOnPreMain from a preRun.) -Wno-warn-absolute-paths If not specified, the compiler will warn about any uses of absolute paths in -I and -L command line @@ -1369,6 +1378,7 @@ try: if file_ending.endswith(SOURCE_ENDINGS): temp_file = temp_files[i] logging.debug('optimizing %s', input_file) + #if DEBUG: shutil.copyfile(temp_file, os.path.join(TEMP_DIR, 'to_opt.bc') # useful when LLVM opt aborts shared.Building.llvm_opt(temp_file, llvm_opts) # If we were just asked to generate bitcode, stop there diff --git a/emscripten-version.txt b/emscripten-version.txt index bf2b5ccfefb15..87684ab8378d6 100644 --- a/emscripten-version.txt +++ b/emscripten-version.txt @@ -1,2 +1,2 @@ -1.13.0 +1.13.1 diff --git a/emscripten.py b/emscripten.py index 37e1c83f16e78..c8122cb9fd61c 100755 --- a/emscripten.py +++ b/emscripten.py @@ -746,6 +746,9 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, backend_args += ['-emscripten-warn-unaligned'] if settings['RESERVED_FUNCTION_POINTERS'] > 0: backend_args += ['-emscripten-reserved-function-pointers=%d' % settings['RESERVED_FUNCTION_POINTERS']] + if settings['ASSERTIONS'] > 0: + backend_args += ['-emscripten-assertions=%d' % settings['ASSERTIONS']] + backend_args += ['-O' + str(settings['OPT_LEVEL'])] if DEBUG: logging.debug('emscript: llvm backend: ' + ' '.join(backend_args)) t = time.time() @@ -821,6 +824,8 @@ def fix_dot_zero(m): ) + map(lambda x: x[1:], metadata['externs']) if metadata['simd']: settings['SIMD'] = 1 + if not metadata['canValidate'] and settings['ASM_JS'] != 2: + logging.warning('disabling asm.js validation due to use of non-supported features') settings['ASM_JS'] = 2 # Save settings to a file to work around v8 issue 1579 diff --git a/media/powered_by_logo.png b/media/powered_by_logo.png new file mode 100644 index 0000000000000..69e90c77725b3 Binary files /dev/null and b/media/powered_by_logo.png differ diff --git a/media/powered_by_logo.svg b/media/powered_by_logo.svg new file mode 100644 index 0000000000000..f39123c138ac6 --- /dev/null +++ b/media/powered_by_logo.svg @@ -0,0 +1,1547 @@ + + + +image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/media/switch_logo.png b/media/switch_logo.png new file mode 100644 index 0000000000000..1e072247333f9 Binary files /dev/null and b/media/switch_logo.png differ diff --git a/docs/emscripten_switch_logo.svg b/media/switch_logo.svg similarity index 100% rename from docs/emscripten_switch_logo.svg rename to media/switch_logo.svg diff --git a/package.json b/package.json index a1447c9f8f048..4fbba2fb19554 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "emscripten", - "version": "1.0.0", + "version": "1.13.0", "dependencies": { "ws": "~0.4.28" } diff --git a/patches/README b/patches/README deleted file mode 100644 index f6817fed9954d..0000000000000 --- a/patches/README +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains a useful mercurial patch queue. - -Note to patch queue maintainer: You need to manually copy from .hg/patches into this directory, after |qrefresh|ing the patch. - diff --git a/patches/series b/patches/series deleted file mode 100644 index 04f16d03db07e..0000000000000 --- a/patches/series +++ /dev/null @@ -1,2 +0,0 @@ -sauer - diff --git a/scons-tools/emscripten.py b/scons-tools/emscripten.py index af85f1065e084..94153adbf02fe 100755 --- a/scons-tools/emscripten.py +++ b/scons-tools/emscripten.py @@ -9,11 +9,6 @@ def exists(env): return True -def _expand_settings_flags(settings, env): - return [ - ('-s%s=%s' % (KEY, json.dumps(VALUE).replace('"', '\\"'))) - for KEY, VALUE in settings.items() ] - emscripten_version_files = {} def build_version_file(env): @@ -86,10 +81,6 @@ def buildName(extension): buildName('raw.js'), [opt_ll]) - [optimized_js] = env.JSOptimizer( - buildName('opt.js'), - raw_emscripten_js) - prejs = [ env['EMSCRIPTEN_PREJS'], '${EMSCRIPTEN_HOME}/src/embind/emval.js', @@ -98,7 +89,7 @@ def buildName(extension): [concatenated_js] = env.Concatenate( buildName('concat.js'), [ prejs, - optimized_js, + raw_emscripten_js, env['EMSCRIPTEN_POSTJS'] ]) DISABLE_EMSCRIPTEN_WARNINGS = [ @@ -139,11 +130,6 @@ def buildName(extension): concatenated_js, CLOSURE_FLAGS=['--language_in', 'ECMASCRIPT5']+DISABLE_EMSCRIPTEN_WARNINGS+['--formatting', 'PRETTY_PRINT', '--compilation_level', 'ADVANCED_OPTIMIZATIONS']) - [global_emscripten_min_js] = env.JSOptimizer( - buildName('global.min.js'), - closure_js, - JS_OPTIMIZER_PASSES=['simplifyExpressionsPost', 'minifyWhitespace', 'last']) - [emscripten_iteration_js] = env.WrapInModule( buildName('iteration.js'), iter_global_emscripten_js) @@ -154,12 +140,27 @@ def buildName(extension): [emscripten_min_js] = env.WrapInModule( buildName('min.js'), - global_emscripten_min_js) + closure_js) return [emscripten_iteration_js, emscripten_js, emscripten_min_js] LIBC_SOURCES = [ 'system/lib/dlmalloc.c', + 'system/lib/libc/musl/src/internal/floatscan.c', + 'system/lib/libc/musl/src/internal/shgetc.c', + 'system/lib/libc/musl/src/math/scalbn.c', + 'system/lib/libc/musl/src/math/scalbnl.c', + 'system/lib/libc/musl/src/stdio/__overflow.c', + 'system/lib/libc/musl/src/stdio/__toread.c', + 'system/lib/libc/musl/src/stdio/__towrite.c', + 'system/lib/libc/musl/src/stdio/__uflow.c', + 'system/lib/libc/musl/src/stdlib/atof.c', + 'system/lib/libc/musl/src/stdlib/strtod.c', + 'system/lib/libc/musl/src/string/memcmp.c', + 'system/lib/libc/musl/src/string/strcasecmp.c', + 'system/lib/libc/musl/src/string/strcmp.c', + 'system/lib/libc/musl/src/string/strncasecmp.c', + 'system/lib/libc/musl/src/string/strncmp.c', 'system/lib/libc/musl/src/string/wmemset.c', 'system/lib/libc/musl/src/string/wmemcpy.c', ] @@ -185,13 +186,14 @@ def buildName(extension): 'strstream.cpp', 'system_error.cpp', #'thread.cpp', - 'typeinfo.cpp', + #'typeinfo.cpp', 'utility.cpp', 'valarray.cpp', ]] LIBCXXABI_SOURCES = [os.path.join('system/lib/libcxxabi/src', x) for x in [ - 'private_typeinfo.cpp' + 'private_typeinfo.cpp', + 'typeinfo.cpp' ]] # MAJOR HACK ALERT @@ -233,6 +235,7 @@ def build_libcxx(env): env = env.Clone() env['CXXFLAGS'] = filter(lambda e: e not in ('-Werror', '-Wall'), env['CXXFLAGS']) env['CCFLAGS'] = filter(lambda e: e not in ('-Werror', '-Wall'), env['CCFLAGS']) + env['CCFLAGS'] = env['CCFLAGS'] + ['-isystem${EMSCRIPTEN_HOME}/system/lib/libc/musl/src/internal/'] objs = [ env.Object( @@ -248,16 +251,10 @@ def build_libcxx(env): def generate(env): env.SetDefault( PYTHON=sys.executable, - NODEJS='node', - JS_ENGINE='$NODEJS', - EMSCRIPTEN_FLAGS=['-v', '-j', '--suppressUsageWarning'], + EMSCRIPTEN_FLAGS=[], EMSCRIPTEN_TEMP_DIR=env.Dir('#/emscripten.tmp'), - _expand_settings_flags=_expand_settings_flags, EMSCRIPTEN_PREJS=[], EMSCRIPTEN_POSTJS=[], - EMSCRIPTEN_SETTINGS={}, - _EMSCRIPTEN_SETTINGS_FLAGS='${_expand_settings_flags(EMSCRIPTEN_SETTINGS, __env__)}', - JS_OPTIMIZER_PASSES=[], LLVM_OPT_PASSES=['-std-compile-opts', '-std-link-opts'], EMSCRIPTEN_HOME=env.Dir(os.path.join(os.path.dirname(__file__), '..')), @@ -274,7 +271,7 @@ def generate(env): RANLIBCOM='', CCFLAGS=[ '-U__STRICT_ANSI__', - '-target', 'asmjs-unknown-emscripten', + '-target', 'le32-unknown-nacl', '-nostdinc', '-Wno-#warnings', '-Wno-error=unused-variable', @@ -286,10 +283,9 @@ def generate(env): '-Xclang', '-nostdinc++', '-Xclang', '-nobuiltininc', '-Xclang', '-nostdsysteminc', - '-Xclang', '-isystem$EMSCRIPTEN_HOME/system/include', + '-Xclang', '-isystem$EMSCRIPTEN_HOME/system/include/compat', '-Xclang', '-isystem$EMSCRIPTEN_HOME/system/include/libc', '-Xclang', '-isystem$EMSCRIPTEN_HOME/system/include/libcxx', - '-Xclang', '-isystem$EMSCRIPTEN_HOME/system/include/bsd', '-emit-llvm'], CXXFLAGS=['-std=c++11', '-fno-exceptions'], ) @@ -307,11 +303,7 @@ def generate(env): ) env['BUILDERS']['Emscripten'] = Builder( - action='$PYTHON ${EMSCRIPTEN_HOME}/emscripten.py $EMSCRIPTEN_FLAGS $_EMSCRIPTEN_SETTINGS_FLAGS --temp-dir=$EMSCRIPTEN_TEMP_DIR --compiler $JS_ENGINE --relooper=third-party/relooper.js $SOURCE > $TARGET', - target_scanner=EmscriptenScanner) - - env['BUILDERS']['JSOptimizer'] = Builder( - action='$JS_ENGINE ${EMSCRIPTEN_HOME}/tools/js-optimizer.js $SOURCE $JS_OPTIMIZER_PASSES > $TARGET', + action='$PYTHON ${EMSCRIPTEN_HOME}/emcc ${EMSCRIPTEN_FLAGS} $SOURCE -o $TARGET', target_scanner=EmscriptenScanner) def depend_on_embedder(target, source, env): diff --git a/src/closure-externs.js b/src/closure-externs.js index a82aa6698e204..fe6d84aac5ecd 100644 --- a/src/closure-externs.js +++ b/src/closure-externs.js @@ -108,3 +108,63 @@ var flags = {}; flags.binary; +/** + * @fileoverview Definitions for W3C's Gamepad specification. + * @see http://www.w3.org/TR/gamepad/ + * @externs + */ + +/** + * @typedef {{id: string, index: number, timestamp: number, axes: Array., buttons: Array.}} + */ +var Gamepad; + +/** +* @type {Array.} +*/ +Gamepad.buttons; + +/** +* @type {Array.} +*/ +Gamepad.axes; + +/** +* @type {number} +*/ +Gamepad.index; + +/** +* @type {string} +*/ +Gamepad.id; + +/** +* @type {number} +*/ +Gamepad.timestamp; + +/** + * @return {Array.} + */ +navigator.getGamepads = function() {}; + +/** + * @return {Array.} + */ +navigator.webkitGetGamepads = function() {}; + +/** + * @return {Array.} + */ +navigator.webkitGamepads = function() {}; + +/** + * @return {Array.} + */ +navigator.mozGamepads = function() {}; + +/** + * @return {Array.} + */ +navigator.gamepads = function() {}; diff --git a/src/library.js b/src/library.js index 62695ae7a61b2..2c3d5e03adc5c 100644 --- a/src/library.js +++ b/src/library.js @@ -9114,6 +9114,10 @@ LibraryManager.library = { #endif #endif + emscripten_debugger: function() { + debugger; + }, + //============================ // emscripten vector ops //============================ diff --git a/src/library_browser.js b/src/library_browser.js index 47b3b2f9bd534..0808b9f04a0a9 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -1,7 +1,6 @@ //"use strict"; // Utilities for browser environments - mergeInto(LibraryManager.library, { $Browser__deps: ['$PATH'], $Browser__postset: 'Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas) { Browser.requestFullScreen(lockPointer, resizeCanvas) };\n' + // exports @@ -349,9 +348,9 @@ mergeInto(LibraryManager.library, { if (typeof Browser.resizeCanvas === 'undefined') Browser.resizeCanvas = false; var canvas = Module['canvas']; - var canvasContainer = canvas.parentNode; function fullScreenChange() { Browser.isFullScreen = false; + var canvasContainer = canvas.parentNode; if ((document['webkitFullScreenElement'] || document['webkitFullscreenElement'] || document['mozFullScreenElement'] || document['mozFullscreenElement'] || document['fullScreenElement'] || document['fullscreenElement'] || @@ -370,7 +369,6 @@ mergeInto(LibraryManager.library, { } else { // remove the full screen specific parent of the canvas again to restore the HTML structure from before going full screen - var canvasContainer = canvas.parentNode; canvasContainer.parentNode.insertBefore(canvas, canvasContainer); canvasContainer.parentNode.removeChild(canvasContainer); @@ -725,8 +723,59 @@ mergeInto(LibraryManager.library, { // PROGRESS http.onprogress = function http_onprogress(e) { - var percentComplete = (e.position / e.totalSize)*100; - if (onprogress) Runtime.dynCall('vii', onprogress, [arg, percentComplete]); + if (e.lengthComputable || (e.lengthComputable === undefined && e.totalSize != 0)) { + var percentComplete = (e.position / e.totalSize)*100; + if (onprogress) Runtime.dynCall('vii', onprogress, [arg, percentComplete]); + } + }; + + // Useful because the browser can limit the number of redirection + try { + if (http.channel instanceof Ci.nsIHttpChannel) + http.channel.redirectionLimit = 0; + } catch (ex) { /* whatever */ } + + if (_request == "POST") { + //Send the proper header information along with the request + http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + http.setRequestHeader("Content-length", _param.length); + http.setRequestHeader("Connection", "close"); + http.send(_param); + } else { + http.send(null); + } + }, + + emscripten_async_wget2_data: function(url, request, param, arg, free, onload, onerror, onprogress) { + var _url = Pointer_stringify(url); + var _request = Pointer_stringify(request); + var _param = Pointer_stringify(param); + + var http = new XMLHttpRequest(); + http.open(_request, _url, true); + http.responseType = 'arraybuffer'; + + // LOAD + http.onload = function http_onload(e) { + if (http.status == 200 || _url.substr(0,4).toLowerCase() != "http") { + var byteArray = new Uint8Array(http.response); + var buffer = _malloc(byteArray.length); + HEAPU8.set(byteArray, buffer); + if (onload) Runtime.dynCall('viii', onload, [arg, buffer, byteArray.length]); + if (free) _free(buffer); + } else { + if (onerror) Runtime.dynCall('viii', onerror, [arg, http.status, http.statusText]); + } + }; + + // ERROR + http.onerror = function http_onerror(e) { + if (onerror) Runtime.dynCall('viii', onerror, [arg, http.status, http.statusText]); + }; + + // PROGRESS + http.onprogress = function http_onprogress(e) { + if (onprogress) Runtime.dynCall('viii', onprogress, [arg, e.loaded, e.lengthComputable || e.lengthComputable === undefined ? e.total : 0]); }; // Useful because the browser can limit the number of redirection @@ -1011,8 +1060,11 @@ mergeInto(LibraryManager.library, { var callbackId = msg.data['callbackId']; var callbackInfo = info.callbacks[callbackId]; if (!callbackInfo) return; // no callback or callback removed meanwhile - info.awaited--; - info.callbacks[callbackId] = null; // TODO: reuse callbackIds, compress this + // Don't trash our callback state if we expect additional calls. + if (msg.data['finalResponse']) { + info.awaited--; + info.callbacks[callbackId] = null; // TODO: reuse callbackIds, compress this + } var data = msg.data['data']; if (data) { if (!data.byteLength) data = new Uint8Array(data); @@ -1059,12 +1111,23 @@ mergeInto(LibraryManager.library, { }); }, + emscripten_worker_respond_provisionally: function(data, size) { + if (!inWorkerCall) throw 'not in worker call!'; + if (workerResponded) throw 'already responded with final response!'; + postMessage({ + 'callbackId': workerCallbackId, + 'finalResponse': false, + 'data': data ? new Uint8Array({{{ makeHEAPView('U8', 'data', 'data + size') }}}) : 0 // XXX copy to a new typed array as a workaround for chrome bug 169705 + }); + }, + emscripten_worker_respond: function(data, size) { if (!inWorkerCall) throw 'not in worker call!'; - if (workerResponded) throw 'already responded!'; + if (workerResponded) throw 'already responded with final response!'; workerResponded = true; postMessage({ 'callbackId': workerCallbackId, + 'finalResponse': true, 'data': data ? new Uint8Array({{{ makeHEAPView('U8', 'data', 'data + size') }}}) : 0 // XXX copy to a new typed array as a workaround for chrome bug 169705 }); }, diff --git a/src/library_fs.js b/src/library_fs.js index 1428f041f0789..3d0036eea223e 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -1436,82 +1436,81 @@ mergeInto(LibraryManager.library, { // XHR, which is not possible in browsers except in a web worker! Use preloading, // either --preload-file in emcc or FS.createPreloadedFile createLazyFile: function(parent, name, url, canRead, canWrite) { - if (typeof XMLHttpRequest !== 'undefined') { - if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; - // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse. - function LazyUint8Array() { - this.lengthKnown = false; - this.chunks = []; // Loaded chunks. Index is the chunk number - } - LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { - if (idx > this.length-1 || idx < 0) { - return undefined; - } - var chunkOffset = idx % this.chunkSize; - var chunkNum = Math.floor(idx / this.chunkSize); - return this.getter(chunkNum)[chunkOffset]; + // Lazy chunked Uint8Array (implements get and length from Uint8Array). Actual getting is abstracted away for eventual reuse. + function LazyUint8Array() { + this.lengthKnown = false; + this.chunks = []; // Loaded chunks. Index is the chunk number + } + LazyUint8Array.prototype.get = function LazyUint8Array_get(idx) { + if (idx > this.length-1 || idx < 0) { + return undefined; } - LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { - this.getter = getter; - } - LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { - // Find length - var xhr = new XMLHttpRequest(); - xhr.open('HEAD', url, false); - xhr.send(null); - if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); - var datalength = Number(xhr.getResponseHeader("Content-length")); - var header; - var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; + var chunkOffset = idx % this.chunkSize; + var chunkNum = Math.floor(idx / this.chunkSize); + return this.getter(chunkNum)[chunkOffset]; + } + LazyUint8Array.prototype.setDataGetter = function LazyUint8Array_setDataGetter(getter) { + this.getter = getter; + } + LazyUint8Array.prototype.cacheLength = function LazyUint8Array_cacheLength() { + // Find length + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + var datalength = Number(xhr.getResponseHeader("Content-length")); + var header; + var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes"; #if SMALL_XHR_CHUNKS - var chunkSize = 1024; // Chunk size in bytes + var chunkSize = 1024; // Chunk size in bytes #else - var chunkSize = 1024*1024; // Chunk size in bytes + var chunkSize = 1024*1024; // Chunk size in bytes #endif - if (!hasByteServing) chunkSize = datalength; - - // Function to get a range from the remote URL. - var doXHR = (function(from, to) { - if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); - if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!"); - - // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, false); - if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); - - // Some hints to the browser that we want binary data. - if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer'; - if (xhr.overrideMimeType) { - xhr.overrideMimeType('text/plain; charset=x-user-defined'); - } - - xhr.send(null); - if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); - if (xhr.response !== undefined) { - return new Uint8Array(xhr.response || []); - } else { - return intArrayFromString(xhr.responseText || '', true); - } - }); - var lazyArray = this; - lazyArray.setDataGetter(function(chunkNum) { - var start = chunkNum * chunkSize; - var end = (chunkNum+1) * chunkSize - 1; // including this byte - end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block - if (typeof(lazyArray.chunks[chunkNum]) === "undefined") { - lazyArray.chunks[chunkNum] = doXHR(start, end); - } - if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!"); - return lazyArray.chunks[chunkNum]; - }); + if (!hasByteServing) chunkSize = datalength; - this._length = datalength; - this._chunkSize = chunkSize; - this.lengthKnown = true; - } + // Function to get a range from the remote URL. + var doXHR = (function(from, to) { + if (from > to) throw new Error("invalid range (" + from + ", " + to + ") or no bytes requested!"); + if (to > datalength-1) throw new Error("only " + datalength + " bytes available! programmer error!"); + + // TODO: Use mozResponseArrayBuffer, responseStream, etc. if available. + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) xhr.setRequestHeader("Range", "bytes=" + from + "-" + to); + // Some hints to the browser that we want binary data. + if (typeof Uint8Array != 'undefined') xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + xhr.send(null); + if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) throw new Error("Couldn't load " + url + ". Status: " + xhr.status); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } else { + return intArrayFromString(xhr.responseText || '', true); + } + }); + var lazyArray = this; + lazyArray.setDataGetter(function(chunkNum) { + var start = chunkNum * chunkSize; + var end = (chunkNum+1) * chunkSize - 1; // including this byte + end = Math.min(end, datalength-1); // if datalength-1 is selected, this is the last block + if (typeof(lazyArray.chunks[chunkNum]) === "undefined") { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof(lazyArray.chunks[chunkNum]) === "undefined") throw new Error("doXHR failed!"); + return lazyArray.chunks[chunkNum]; + }); + + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + if (typeof XMLHttpRequest !== 'undefined') { + if (!ENVIRONMENT_IS_WORKER) throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; var lazyArray = new LazyUint8Array(); Object.defineProperty(lazyArray, "length", { get: function() { diff --git a/src/library_gl.js b/src/library_gl.js index d797cbb43cb96..851b01b182880 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -631,7 +631,7 @@ var LibraryGL = { GLctx.getExtension('WEBKIT_EXT_texture_filter_anisotropic'); GL.floatExt = GLctx.getExtension('OES_texture_float'); - + // Extension available from Firefox 26 and Google Chrome 30 GL.instancedArraysExt = GLctx.getExtension('ANGLE_instanced_arrays'); @@ -648,7 +648,8 @@ var LibraryGL = { "OES_element_index_uint", "EXT_texture_filter_anisotropic", "ANGLE_instanced_arrays", "OES_texture_float_linear", "OES_texture_half_float_linear", "WEBGL_compressed_texture_atc", "WEBGL_compressed_texture_pvrtc", "EXT_color_buffer_half_float", "WEBGL_color_buffer_float", - "EXT_frag_depth", "EXT_sRGB", "WEBGL_draw_buffers", "WEBGL_shared_resources" ]; + "EXT_frag_depth", "EXT_sRGB", "WEBGL_draw_buffers", "WEBGL_shared_resources", + "EXT_shader_texture_lod" ]; function shouldEnableAutomatically(extension) { for(var i in automaticallyEnabledExtensions) { diff --git a/src/library_glfw.js b/src/library_glfw.js index b54205adbd755..e578290020c4f 100644 --- a/src/library_glfw.js +++ b/src/library_glfw.js @@ -51,7 +51,7 @@ var LibraryGLFW = { DOMToGLFWKeyCode: function(keycode) { switch (keycode) { case 0x09: return 295 ; //DOM_VK_TAB -> GLFW_KEY_TAB - case 0x1B: return 255 ; //DOM_VK_ESCAPE -> GLFW_KEY_ESC + case 0x1B: return 257 ; //DOM_VK_ESCAPE -> GLFW_KEY_ESC case 0x6A: return 313 ; //DOM_VK_MULTIPLY -> GLFW_KEY_KP_MULTIPLY case 0x6B: return 315 ; //DOM_VK_ADD -> GLFW_KEY_KP_ADD case 0x6D: return 314 ; //DOM_VK_SUBTRACT -> GLFW_KEY_KP_SUBTRACT diff --git a/src/library_glut.js b/src/library_glut.js index 167e52724ce34..445e08a4e7e98 100644 --- a/src/library_glut.js +++ b/src/library_glut.js @@ -22,6 +22,7 @@ var LibraryGLUT = { windowY: 0, windowWidth: 0, windowHeight: 0, + requestedAnimationFrame: false, saveModifiers: function(event) { GLUT.modifiers = 0; @@ -484,8 +485,10 @@ var LibraryGLUT = { glutSwapBuffers: function() {}, glutPostRedisplay: function() { - if (GLUT.displayFunc) { + if (GLUT.displayFunc && !GLUT.requestedAnimationFrame) { + GLUT.requestedAnimationFrame = true; Browser.requestAnimationFrame(function() { + GLUT.requestedAnimationFrame = false; if (ABORT) return; Runtime.dynCall('v', GLUT.displayFunc); }); diff --git a/src/library_openal.js b/src/library_openal.js index bdbb2dcae0192..fd382aa1eb7d8 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -182,7 +182,6 @@ var LibraryOpenAL = { } }, - alcCreateContext__deps: ['updateSources'], alcCreateContext: function(device, attrList) { if (device != 1) { return 0; @@ -386,7 +385,6 @@ var LibraryOpenAL = { } }, - alSourcei__deps: ['updateSource'], alSourcei: function(source, param, value) { if (!AL.currentContext) { #if OPENAL_DEBUG @@ -558,7 +556,6 @@ var LibraryOpenAL = { {{{ makeGetValue('value', '8', 'float') }}}); }, - alSourceQueueBuffers__deps: ["updateSource"], alSourceQueueBuffers: function(source, count, buffers) { if (!AL.currentContext) { #if OPENAL_DEBUG @@ -594,7 +591,6 @@ var LibraryOpenAL = { AL.updateSource(src); }, - alSourceUnqueueBuffers__deps: ["updateSource"], alSourceUnqueueBuffers: function(source, count, buffers) { if (!AL.currentContext) { #if OPENAL_DEBUG @@ -860,7 +856,6 @@ var LibraryOpenAL = { AL.setSourceState(src, 0x1013 /* AL_PAUSED */); }, - alGetSourcei__deps: ['updateSource'], alGetSourcei: function(source, param, value) { if (!AL.currentContext) { #if OPENAL_DEBUG diff --git a/src/library_sdl.js b/src/library_sdl.js index 0755a9ccc80c9..b50073bedee45 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -450,9 +450,9 @@ var LibrarySDL = { // keyup. This isn't perfect, but it enables SDL_WM_ToggleFullScreen // to work as the result of a keypress (which is an extremely // common use case). - if (event.type === 'keydown') { + if (event.type === 'keydown' || event.type === 'mousedown') { SDL.canRequestFullscreen = true; - } else if (event.type === 'keyup') { + } else if (event.type === 'keyup' || event.type === 'mouseup') { if (SDL.isRequestingFullscreen) { Module['requestFullScreen'](true, true); SDL.isRequestingFullscreen = false; diff --git a/src/postamble.js b/src/postamble.js index 603b330c9477b..b90049bc095f7 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -48,10 +48,6 @@ Module['callMain'] = Module.callMain = function callMain(args) { args = args || []; - if (ENVIRONMENT_IS_WEB && preloadStartTime !== null) { - Module.printErr('preload time: ' + (Date.now() - preloadStartTime) + ' ms'); - } - ensureInitRuntime(); var argc = args.length+1; @@ -130,6 +126,10 @@ function run(args) { preMain(); + if (ENVIRONMENT_IS_WEB && preloadStartTime !== null) { + Module.printErr('pre-main prep time: ' + (Date.now() - preloadStartTime) + ' ms'); + } + if (Module['_main'] && shouldRunNow) { Module['callMain'](args); } diff --git a/src/preamble.js b/src/preamble.js index 28a1dcbcc2edf..3f724562e437c 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -187,16 +187,16 @@ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) { Module.print('SAFE_HEAP store: ' + [dest, value, bytes, isFloat]); #endif assert(dest > 0, 'segmentation fault'); - assert(dest % bytes === 0); - assert(dest < Math.max(DYNAMICTOP, STATICTOP)); + assert(dest % bytes === 0, 'alignment error'); + assert(dest < Math.max(DYNAMICTOP, STATICTOP), 'segmentation fault (high)'); assert(DYNAMICTOP <= TOTAL_MEMORY); setValue(dest, value, getSafeHeapType(bytes, isFloat), 1); } function SAFE_HEAP_LOAD(dest, bytes, isFloat, unsigned) { assert(dest > 0, 'segmentation fault'); - assert(dest % bytes === 0); - assert(dest < Math.max(DYNAMICTOP, STATICTOP)); + assert(dest % bytes === 0, 'alignment error'); + assert(dest < Math.max(DYNAMICTOP, STATICTOP), 'segmentation fault (high)'); assert(DYNAMICTOP <= TOTAL_MEMORY); var type = getSafeHeapType(bytes, isFloat); var ret = getValue(dest, type, 1); diff --git a/src/relooper/README.markdown b/src/relooper/README.markdown deleted file mode 100644 index 9b0187b38b380..0000000000000 --- a/src/relooper/README.markdown +++ /dev/null @@ -1,14 +0,0 @@ - -Relooper -======== - -This is an optimized C++ implemention of the Relooper algorithm originally -developed as part of Emscripten. This implementation includes optimizations -added since the original academic paper [1] - see paper.pdf - was published -about it, and is written in an LLVM-friendly way with the goal of inclusion -in upstream LLVM. - -License: MIT&LLVM - -[1] Alon Zakai. 2011. Emscripten: an LLVM-to-JavaScript compiler. In Proceedings of the ACM international conference companion on Object oriented programming systems languages and applications companion (SPLASH '11). ACM, New York, NY, USA, 301-312. DOI=10.1145/2048147.2048224 http://doi.acm.org/10.1145/2048147.2048224 - diff --git a/src/relooper/README.md b/src/relooper/README.md new file mode 100644 index 0000000000000..a4073a77c4d05 --- /dev/null +++ b/src/relooper/README.md @@ -0,0 +1,12 @@ +Relooper +======== + +This is an optimized C++ implemention of the Relooper algorithm originally developed as part +of Emscripten. This implementation includes optimizations added since the original academic +paper [1] - see paper.pdf - was published about it, and is written in an LLVM-friendly way +with the goal of inclusion in upstream LLVM. + +[1] Alon Zakai. 2011. Emscripten: an LLVM-to-JavaScript compiler. In Proceedings of the ACM +international conference companion on Object oriented programming systems languages and +applications companion (SPLASH '11). ACM, New York, NY, USA, 301-312. +DOI=10.1145/2048147.2048224 http://doi.acm.org/10.1145/2048147.2048224 diff --git a/src/runtime.js b/src/runtime.js index 97de74730e27d..2ae68279dfa0d 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -484,6 +484,11 @@ var Runtime = { return ret; } this.processJSString = function processJSString(string) { + /* TODO: use TextEncoder when present, + var encoder = new TextEncoder(); + encoder['encoding'] = "utf-8"; + var utf8Array = encoder['encode'](aMsg.data); + */ string = unescape(encodeURIComponent(string)); var ret = []; for (var i = 0; i < string.length; i++) { diff --git a/src/settings.js b/src/settings.js index 7f9fbabf07bea..02f6c8b591ae0 100644 --- a/src/settings.js +++ b/src/settings.js @@ -311,6 +311,10 @@ var EXPORTED_FUNCTIONS = ['_main', '_malloc']; // through LLVM dead code elimination, and also made accessible outside of // the generated code even after running closure compiler (on "Module"). // Note the necessary prefix of "_". + // Note also that this is the full list of exported functions - if you + // have a main() function and want it to run, you must include it in this + // list (as _main is by default in this value, and if you override it + // without keeping it there, you are in effect removing it). var EXPORT_ALL = 0; // If true, we export all the symbols. Note that this does *not* affect LLVM, so it can // still eliminate functions as dead. This just exports them on the Module object. var EXPORT_BINDINGS = 0; // Export all bindings generator functions (prefixed with emscripten_bind_). This diff --git a/src/shell.js b/src/shell.js index 84844c85f2075..65f7b92321dd6 100644 --- a/src/shell.js +++ b/src/shell.js @@ -124,7 +124,7 @@ else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { } if (ENVIRONMENT_IS_WEB) { - this['{{{ EXPORT_NAME }}}'] = Module; + window['{{{ EXPORT_NAME }}}'] = Module; } else { Module['load'] = importScripts; } diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h index 26ecdf0ef4022..2b883f9357d32 100644 --- a/system/include/emscripten/emscripten.h +++ b/system/include/emscripten/emscripten.h @@ -96,7 +96,7 @@ extern void emscripten_async_run_script(const char *script, int millis); * for this is to load an asset module, that is, the output of the * file packager. */ -extern void emscripten_async_load_script(const char *script, void (*onload)(), void (*onerror)()); +extern void emscripten_async_load_script(const char *script, void (*onload)(void), void (*onerror)(void)); /* * Set a C function as the main event loop. The JS environment @@ -138,11 +138,11 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v * before the main loop will be called the first time. */ #if __EMSCRIPTEN__ -extern void emscripten_set_main_loop(void (*func)(), int fps, int simulate_infinite_loop); +extern void emscripten_set_main_loop(void (*func)(void), int fps, int simulate_infinite_loop); extern void emscripten_set_main_loop_arg(void (*func)(void*), void *arg, int fps, int simulate_infinite_loop); -extern void emscripten_pause_main_loop(); -extern void emscripten_resume_main_loop(); -extern void emscripten_cancel_main_loop(); +extern void emscripten_pause_main_loop(void); +extern void emscripten_resume_main_loop(void); +extern void emscripten_cancel_main_loop(void); #else #define emscripten_set_main_loop(func, fps, simulateInfiniteLoop) \ while (1) { func(); usleep(1000000/fps); } @@ -214,7 +214,7 @@ inline void emscripten_async_call(void (*func)(void *), void *arg, int millis) { * etc. are not run). This is implicitly performed when you do * an asynchronous operation like emscripten_async_call. */ -extern void emscripten_exit_with_live_runtime(); +extern void emscripten_exit_with_live_runtime(void); /* * Hide the OS mouse cursor over the canvas. Note that SDL's @@ -222,7 +222,7 @@ extern void emscripten_exit_with_live_runtime(); * the OS one. This command is useful to hide the OS cursor * if your app draws its own cursor. */ -void emscripten_hide_mouse(); +void emscripten_hide_mouse(void); /* * Resizes the pixel width and height of the element @@ -244,10 +244,10 @@ void emscripten_get_canvas_size(int *width, int *height, int *isFullscreen); * other calls to this function. The unit is ms. */ #if __EMSCRIPTEN__ -double emscripten_get_now(); +double emscripten_get_now(void); #else #include -double emscripten_get_now() { +double emscripten_get_now(void) { return (1000*clock())/(double)CLOCKS_PER_SEC; } #endif @@ -255,7 +255,7 @@ double emscripten_get_now() { /* * Simple random number generation in [0, 1), maps to Math.random(). */ -float emscripten_random(); +float emscripten_random(void); /* * This macro-looking function will cause Emscripten to @@ -322,6 +322,28 @@ void emscripten_async_wget_data(const char* url, void *arg, void (*onload)(void* */ void emscripten_async_wget2(const char* url, const char* file, const char* requesttype, const char* param, void *arg, void (*onload)(void*, const char*), void (*onerror)(void*, int), void (*onprogress)(void*, int)); +/* + * More feature-complete version of emscripten_async_wget_data. Note: + * this version is experimental. + * + * The requesttype is 'GET' or 'POST', + * If is post request, param is the post parameter + * like key=value&key2=value2. + * The param 'arg' is a pointer will be pass to the callback + * The free param tells the runtime whether to free the returned buffer + after onload is complete. If false freeing the buffer is the receiver's + responsibility. + * The callbacks are called with an object pointer give in parameter. + * When file is ready then 'onload' callback will called with a pointer to + the buffer in memory and the size in bytes. + * During the download 'onprogress' callback will called. The first argument is + the number of bytes loaded. The second argument is the total size in bytes, + or zero if the size is unavailable. + * If any error occurred 'onerror' will called with the HTTP status code + and a string with the status description. + */ +void emscripten_async_wget2_data(const char* url, const char* requesttype, const char* param, void *arg, int free, void (*onload)(void*, void*, unsigned), void (*onerror)(void*, int, const char*), void (*onprogress)(void*, int, int)); + /* * Prepare a file in asynchronous way. This does just the * preparation part of emscripten_async_wget, that is, it @@ -400,10 +422,17 @@ void emscripten_destroy_worker(worker_handle worker); void emscripten_call_worker(worker_handle worker, const char *funcname, char *data, int size, void (*callback)(char *, int, void*), void *arg); /* - * Sends a response when in a worker call. Should only be - * called once in each call. + * Sends a response when in a worker call. Both functions post a message + * back to the thread which called the worker. The _respond_provisionally + * variant can be invoked multiple times, which will queue up messages to + * be posted to the worker's creator. Eventually, the _respond variant must + * be invoked, which will disallow further messages and free framework + * resources previously allocated for this worker call. (Calling the + * provisional version is optional, but you must call the non-provisional + * one to avoid leaks.) */ void emscripten_worker_respond(char *data, int size); +void emscripten_worker_respond_provisionally(char *data, int size); /* * Checks how many responses are being waited for from a worker. This @@ -447,7 +476,18 @@ void emscripten_set_network_backend(int backend); */ int emscripten_get_compiler_setting(const char *name); +/* + * Emits + * debugger; + * inline in the code, which tells the JS engine to invoke + * the debugger if it gets there. + */ +void emscripten_debugger(); + + +/* ===================================== */ /* Internal APIs. Be careful with these. */ +/* ===================================== */ /* * Profiling tools. diff --git a/system/include/emscripten/html5.h b/system/include/emscripten/html5.h index 6109d87f335ce..4f74af0382be5 100644 --- a/system/include/emscripten/html5.h +++ b/system/include/emscripten/html5.h @@ -376,7 +376,7 @@ extern EMSCRIPTEN_RESULT emscripten_lock_orientation(int allowedOrientations); /* * Allows the screen to turn again into any orientation. */ -extern EMSCRIPTEN_RESULT emscripten_unlock_orientation(); +extern EMSCRIPTEN_RESULT emscripten_unlock_orientation(void); /* * The event structure passed in the fullscreenchange event. @@ -420,7 +420,7 @@ extern EMSCRIPTEN_RESULT emscripten_request_fullscreen(const char *target, int d /* * Returns back to windowed browsing mode. */ -extern EMSCRIPTEN_RESULT emscripten_exit_fullscreen(); +extern EMSCRIPTEN_RESULT emscripten_exit_fullscreen(void); /* * The event structure passed in the pointerlockchange event. @@ -456,7 +456,7 @@ extern EMSCRIPTEN_RESULT emscripten_request_pointerlock(const char *target, int /* * Exits pointer lock state and restores the mouse cursor to be visible again. */ -extern EMSCRIPTEN_RESULT emscripten_exit_pointerlock(); +extern EMSCRIPTEN_RESULT emscripten_exit_pointerlock(void); #define EMSCRIPTEN_VISIBILITY_HIDDEN 0 #define EMSCRIPTEN_VISIBILITY_VISIBLE 1 @@ -573,7 +573,7 @@ extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback(void *userD * Returns the number of gamepads connected to the system or EMSCRIPTEN_RESULT_NOT_SUPPORTED if the current browser does not support gamepads. * Note: A gamepad does not show up as connected until a button on it is pressed. */ -extern int emscripten_get_num_gamepads(); +extern int emscripten_get_num_gamepads(void); /* * Returns a snapshot of the current gamepad state. */ diff --git a/tests/cases/2xi40.ll b/tests/cases/2xi40.ll index 03c918c871b86..fe2495286e8ca 100644 --- a/tests/cases/2xi40.ll +++ b/tests/cases/2xi40.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpe4Pk1F/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.pair = type { [5 x i8], [5 x i8] } diff --git a/tests/cases/514_ta2.ll b/tests/cases/514_ta2.ll index d435cac14b8ca..caf69fb59bc60 100644 --- a/tests/cases/514_ta2.ll +++ b/tests/cases/514_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpxFUbAg/test_emcc1.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.c_s = type { i8, float, i32 } diff --git a/tests/cases/aliasbitcast.ll b/tests/cases/aliasbitcast.ll index de46cdd41a6cc..926b386d3989b 100644 --- a/tests/cases/aliasbitcast.ll +++ b/tests/cases/aliasbitcast.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] diff --git a/tests/cases/aliasbitcast2_noasm.ll b/tests/cases/aliasbitcast2_noasm.ll index 8537e2722a039..5387f2c0dbdf4 100644 --- a/tests/cases/aliasbitcast2_noasm.ll +++ b/tests/cases/aliasbitcast2_noasm.ll @@ -9,7 +9,7 @@ target triple = "i386-pc-linux-gnu" ; [#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] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry diff --git a/tests/cases/aliasbitcast3_noasm.ll b/tests/cases/aliasbitcast3_noasm.ll index 4ff969e380873..19d3ff14e48c4 100644 --- a/tests/cases/aliasbitcast3_noasm.ll +++ b/tests/cases/aliasbitcast3_noasm.ll @@ -11,7 +11,7 @@ target triple = "i386-pc-linux-gnu" ; [#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] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry @@ -24,6 +24,6 @@ declare i32 @puts(i8*) ; [#uses=0] define i32 @main() { entry: - call void @thriceremoved() + call void @thriceremoved(i32 0) ret i32 0 } diff --git a/tests/cases/aliasbitcastdollar_noasm.ll b/tests/cases/aliasbitcastdollar_noasm.ll index 1ecf604732add..558289b7aaefa 100644 --- a/tests/cases/aliasbitcastdollar_noasm.ll +++ b/tests/cases/aliasbitcastdollar_noasm.ll @@ -9,7 +9,7 @@ target triple = "i386-pc-linux-gnu" ; [#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] + %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] br label %return return: ; preds = %entry diff --git a/tests/cases/aliases_fastcomp.ll b/tests/cases/aliases_fastcomp.ll new file mode 100644 index 0000000000000..2b8746eb91815 --- /dev/null +++ b/tests/cases/aliases_fastcomp.ll @@ -0,0 +1,41 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" +target triple = "asmjs-unknown-emscripten" + +@.str = private unnamed_addr constant [18 x i8] c"hello, world! %d\0A\00", align 1 ; [#uses=1 type=[18 x i8]*] + +@othername = alias internal void (i32)* @doit +@othername2 = alias internal void (i32)* @othername +@othername3 = alias internal void (i32)* @othername2 + +@value = global i32 17 +@value2 = alias i32* @value +@value3 = alias i32* @value + +define internal void @doit(i32 %x) { + %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([18 x i8]* @.str, i32 0, i32 0), i32 %x) ; [#uses=0 type=i32] + ret void +} + +define i32 @main() { +entry: + %fp = ptrtoint void (i32)* @othername3 to i32 + %fp1 = add i32 %fp, 0 + %pf = inttoptr i32 %fp1 to void (i32)* + %x = load i32* @value3 + call void (i32)* %pf(i32 %x) + %x1 = load i32* @value2 + call void (i32)* @othername3(i32 %x1) + %x2 = load i32* @value + call void (i32)* @othername2(i32 %x2) + store i32 18, i32* @value + %x3 = load i32* @value + call void (i32)* @othername(i32 %x3) + store i32 19, i32* @value3 + %x4 = load i32* @value3 + call void (i32)* @doit(i32 %x4) + ret i32 1 +} + +declare i32 @printf(i8*, ...) + diff --git a/tests/cases/aliases_fastcomp.txt b/tests/cases/aliases_fastcomp.txt new file mode 100644 index 0000000000000..ae30c63c5bd25 --- /dev/null +++ b/tests/cases/aliases_fastcomp.txt @@ -0,0 +1,5 @@ +hello, world! 17 +hello, world! 17 +hello, world! 17 +hello, world! 18 +hello, world! 19 diff --git a/tests/cases/atomicrmw.ll b/tests/cases/atomicrmw.ll index abbcc7a635bcb..20a68baab1e69 100644 --- a/tests/cases/atomicrmw.ll +++ b/tests/cases/atomicrmw.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/atomicrmw_dec.ll b/tests/cases/atomicrmw_dec.ll index edb5bd8f235c9..819c3a2a8442d 100644 --- a/tests/cases/atomicrmw_dec.ll +++ b/tests/cases/atomicrmw_dec.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/atomicrmw_unaligned.ll b/tests/cases/atomicrmw_unaligned.ll index abbcc7a635bcb..20a68baab1e69 100644 --- a/tests/cases/atomicrmw_unaligned.ll +++ b/tests/cases/atomicrmw_unaligned.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, %d,%d!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/bigdouble.ll b/tests/cases/bigdouble.ll index e96b10af51434..472adaddcb016 100644 --- a/tests/cases/bigdouble.ll +++ b/tests/cases/bigdouble.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpijH2sB/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [4 x i8] c"%f\0A\00", align 1 diff --git a/tests/cases/boolret_fastcomp.ll b/tests/cases/boolret_fastcomp.ll index 1b968778186be..e6320babf1b7d 100644 --- a/tests/cases/boolret_fastcomp.ll +++ b/tests/cases/boolret_fastcomp.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"helloworld%d.\0A\00", align 1 diff --git a/tests/cases/breakinthemiddle.ll b/tests/cases/breakinthemiddle.ll index 4c43bbd00742e..39aaa9229455f 100644 --- a/tests/cases/breakinthemiddle.ll +++ b/tests/cases/breakinthemiddle.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/breakinthemiddle2.ll b/tests/cases/breakinthemiddle2.ll index 301b62c3aec37..db1cb7b6d884a 100644 --- a/tests/cases/breakinthemiddle2.ll +++ b/tests/cases/breakinthemiddle2.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] diff --git a/tests/cases/caall.ll b/tests/cases/caall.ll index ffbf29d859d14..0d92a498099fc 100644 --- a/tests/cases/caall.ll +++ b/tests/cases/caall.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/callwithstructural64_ta2.ll b/tests/cases/callwithstructural64_ta2.ll index 56b0442c1e1ef..103adcd054279 100644 --- a/tests/cases/callwithstructural64_ta2.ll +++ b/tests/cases/callwithstructural64_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'foo.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %ac = type { i8*, i64 } diff --git a/tests/cases/callwithstructural_ta2.ll b/tests/cases/callwithstructural_ta2.ll index 88a3d755b637d..00cde791d3313 100644 --- a/tests/cases/callwithstructural_ta2.ll +++ b/tests/cases/callwithstructural_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'foo.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %ac = type { i8*, i32 } diff --git a/tests/cases/complexphi.ll b/tests/cases/complexphi.ll index 0d1677f3edd7e..871cbe27407fc 100644 --- a/tests/cases/complexphi.ll +++ b/tests/cases/complexphi.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/ctors_cast.ll b/tests/cases/ctors_cast.ll index 707b552893150..69baa17dcceff 100644 --- a/tests/cases/ctors_cast.ll +++ b/tests/cases/ctors_cast.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpHcVUBJ/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.Other = type { i8 } diff --git a/tests/cases/dash.ll b/tests/cases/dash.ll index 6f727820e350d..0104cf7cd0232 100644 --- a/tests/cases/dash.ll +++ b/tests/cases/dash.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpqfApGD/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @other-name = alias i32 ()* @main diff --git a/tests/cases/dollar.ll b/tests/cases/dollar.ll index 8f0c1dd718f89..3bd203cfbd3f6 100644 --- a/tests/cases/dollar.ll +++ b/tests/cases/dollar.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/emptyalloca.ll b/tests/cases/emptyalloca.ll index 0c03c645ed5f3..59ff29559ca68 100644 --- a/tests/cases/emptyalloca.ll +++ b/tests/cases/emptyalloca.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpjSNiky/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [30 x i8] c"Module.print('hello, world!')\00", align 1 diff --git a/tests/cases/emptyasm_aue.ll b/tests/cases/emptyasm_aue.ll index 65d9e2133c4b1..24805591d73f4 100644 --- a/tests/cases/emptyasm_aue.ll +++ b/tests/cases/emptyasm_aue.ll @@ -1,4 +1,4 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; ModuleID = 'tests/hello_world.bc' diff --git a/tests/cases/emptystruct.ll b/tests/cases/emptystruct.ll index ecf0e295e6aac..b32ac803ccfdd 100644 --- a/tests/cases/emptystruct.ll +++ b/tests/cases/emptystruct.ll @@ -13,7 +13,7 @@ entry: %z = alloca %struct.s, align 4 %0 = bitcast %struct.s* %z to i8* call void @llvm.memset.p0i8.i32(i8* %0, i8 0, i32 4, i32 4, i1 false) - %1 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %1 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i32* bitcast (i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0) to i32*)) ; [#uses=0] ret i32 0 } diff --git a/tests/cases/entry3.ll b/tests/cases/entry3.ll index 7e154e2c62f99..822e6b7feefb8 100644 --- a/tests/cases/entry3.ll +++ b/tests/cases/entry3.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpKnA2D3/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [11 x i8] c"getgid=%d\0A\00", align 1 diff --git a/tests/cases/fptosi.ll b/tests/cases/fptosi.ll index caf9b7544b36a..5c6477bf00f99 100644 --- a/tests/cases/fptosi.ll +++ b/tests/cases/fptosi.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [8 x i8] c"*%.3f*\0A\00", align 1 ; [#uses=1 type=[8 x i8]*] diff --git a/tests/cases/funcptr.ll b/tests/cases/funcptr.ll index ffc1ad1d62559..4c1c9990fecbd 100644 --- a/tests/cases/funcptr.ll +++ b/tests/cases/funcptr.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [17 x i8] c"hello %d world!\0A\00", align 1 ; [#uses=1 type=[17 x i8]*] diff --git a/tests/cases/fuzz6_ta2.ll b/tests/cases/fuzz6_ta2.ll index 225493f901b4d..a30bf61f9221d 100644 --- a/tests/cases/fuzz6_ta2.ll +++ b/tests/cases/fuzz6_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'emcc-0-basebc.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.S3 = type { i32, i32 } diff --git a/tests/cases/gepaddoverflow.ll b/tests/cases/gepaddoverflow.ll index 258e2cc5e46bd..4346ce201b851 100644 --- a/tests/cases/gepaddoverflow.ll +++ b/tests/cases/gepaddoverflow.ll @@ -1,5 +1,5 @@ ; ModuleID = 'new.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" declare i32 @printf(i8* noalias, ...) nounwind diff --git a/tests/cases/i24_mem_ta2.ll b/tests/cases/i24_mem_ta2.ll index 995c9f8bbbc9f..296c8c0bcb298 100644 --- a/tests/cases/i24_mem_ta2.ll +++ b/tests/cases/i24_mem_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [6 x i8] c".%x.\0A\00", align 1 ; [#uses=1 type=[5 x i8]*] diff --git a/tests/cases/i96_ashr_ta2.ll b/tests/cases/i96_ashr_ta2.ll index da6410f978dfb..2800ad0d1077b 100644 --- a/tests/cases/i96_ashr_ta2.ll +++ b/tests/cases/i96_ashr_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [23 x i8] c"hello..world!%x,%x,%x\0A\00", align 1 diff --git a/tests/cases/i96shiftnon32_ta2.ll b/tests/cases/i96shiftnon32_ta2.ll index 815d71eae511d..3a3ba5fd76349 100644 --- a/tests/cases/i96shiftnon32_ta2.ll +++ b/tests/cases/i96shiftnon32_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpxFUbAg/test_emcc1.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.c_s = type { i8, float, i32 } diff --git a/tests/cases/inttoptr.ll b/tests/cases/inttoptr.ll index e225336c7b95d..7682bed18e234 100644 --- a/tests/cases/inttoptr.ll +++ b/tests/cases/inttoptr.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/emscripten/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] diff --git a/tests/cases/invokebitcast.ll b/tests/cases/invokebitcast.ll index 63239a7bf57b6..ecbce6dd261c4 100644 --- a/tests/cases/invokebitcast.ll +++ b/tests/cases/invokebitcast.ll @@ -1,6 +1,6 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' ; Just test for compilation here -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.CPU_Regs = type { [8 x %union.GenReg32] } @@ -10,7 +10,7 @@ target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1] ; [#uses=0] -define i32 @main() { +define i32 @main(i32 %p) { entry: %retval = alloca i32 ; [#uses=2] %0 = alloca i32 ; [#uses=2] @@ -24,13 +24,15 @@ entry: store i32 %3, i32* %retval, align 4 br label %return - invoke void bitcast (void (i32*, i32)* @_Z8toStringj to void (i64*, i32)*)(%struct.CPU_Regs* noalias @cpu_regs, i32 %99) + invoke void bitcast (void (i32*, i32)* @_Z8toStringj to void (i64*, i32)*)(i64* bitcast (%struct.CPU_Regs* @cpu_regs to i64*), i32 %p) to label %invcont33 unwind label %lpad106 invcont33: ret i32 %retval1 lpad106: + %Z = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) + cleanup ret i32 %retval1 return: ; preds = %entry @@ -40,3 +42,6 @@ return: ; preds = %entry ; [#uses=1] declare i32 @puts(i8*) + +declare void @_Z8toStringj(i32*, i32) +declare i32 @__gxx_personality_v0(...) diff --git a/tests/cases/invokeundef.ll b/tests/cases/invokeundef.ll index 17b14a3f35e3c..e24763d93086d 100644 --- a/tests/cases/invokeundef.ll +++ b/tests/cases/invokeundef.ll @@ -1,6 +1,6 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' ; Just test for compilation here -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.CPU_Regs = type { [8 x %union.GenReg32] } diff --git a/tests/cases/legalizer_b_ta2.ll b/tests/cases/legalizer_b_ta2.ll index ec5e75065b58c..78b5dc0404caf 100644 --- a/tests/cases/legalizer_b_ta2.ll +++ b/tests/cases/legalizer_b_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @globaliz = global [300 x i8] zeroinitializer diff --git a/tests/cases/legalizer_ta2.ll b/tests/cases/legalizer_ta2.ll index e7f71f157c649..1cd8922041fcb 100644 --- a/tests/cases/legalizer_ta2.ll +++ b/tests/cases/legalizer_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @globaliz = global [300 x i8] zeroinitializer diff --git a/tests/cases/loadbitcastgep.ll b/tests/cases/loadbitcastgep.ll index daba67c4367a3..311329f3397af 100644 --- a/tests/cases/loadbitcastgep.ll +++ b/tests/cases/loadbitcastgep.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.CPU_Regs = type { [8 x %union.GenReg32] } diff --git a/tests/cases/muli33_ta2.ll b/tests/cases/muli33_ta2.ll index 7a427731810b6..e6f092cd75ea8 100644 --- a/tests/cases/muli33_ta2.ll +++ b/tests/cases/muli33_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpt0JpDh/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [7 x i8] c"20\0A91\0A\00", align 1 diff --git a/tests/cases/oob_ta2.ll b/tests/cases/oob_ta2.ll index 51b622b5ad200..3c06573eadfdc 100644 --- a/tests/cases/oob_ta2.ll +++ b/tests/cases/oob_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %structy = type { [2 x [10 x i8]] } diff --git a/tests/cases/phi24_ta2.ll b/tests/cases/phi24_ta2.ll index 17edb228118f5..0edb36be7cc41 100644 --- a/tests/cases/phi24_ta2.ll +++ b/tests/cases/phi24_ta2.ll @@ -1,5 +1,5 @@ -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %union.U4 = type { i32 } diff --git a/tests/cases/phicubed.ll b/tests/cases/phicubed.ll index 7079dc63c8347..90f91e9cf6720 100644 --- a/tests/cases/phicubed.ll +++ b/tests/cases/phicubed.ll @@ -1,5 +1,5 @@ ; ModuleID = '/dev/shm/tmp/src.cpp.o' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" %struct.worker_args = type { i32, %struct.worker_args* } diff --git a/tests/cases/phientryimplicit.ll b/tests/cases/phientryimplicit.ll index 3249bb8d30028..1dc5f2c7bd1a7 100644 --- a/tests/cases/phientryimplicit.ll +++ b/tests/cases/phientryimplicit.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; Phi nodes can refer to the entry. And the entry might be unnamed, and doesn't even have a consistent implicit name! @@ -10,14 +10,14 @@ target triple = "asmjs-unknown-emscripten" define i32 @main() { %retval = alloca i32, align 4 ; [#uses=1 type=i32*] %a16 = trunc i32 1 to i1 - br i1 %a16, label %L17, label %L26, !dbg !1269853 ; [debug line = 3920:5] + br i1 %a16, label %L17, label %L26 L17: %a25 = trunc i32 1 to i1 br label %L26 L26: - %a27 = phi i1 [ false, %1 ], [ %a25, %L17 ] ; [#uses=1 type=i1] + %a27 = phi i1 [ false, %0 ], [ %a25, %L17 ] ; [#uses=1 type=i1] store i32 0, i32* %retval %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0 type=i32] %cal2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), i1 %a27) ; make sure %27 is used @@ -27,7 +27,7 @@ L26: define i32 @main0() { %retval = alloca i32, align 4 ; [#uses=1 type=i32*] %a16 = trunc i32 1 to i1 - br i1 %a16, label %L17, label %L26, !dbg !1269853 ; [debug line = 3920:5] + br i1 %a16, label %L17, label %L26 L17: %a25 = trunc i32 1 to i1 diff --git a/tests/cases/phientryimplicitmix.ll b/tests/cases/phientryimplicitmix.ll index 7696f5a9e3313..8903e783ec031 100644 --- a/tests/cases/phientryimplicitmix.ll +++ b/tests/cases/phientryimplicitmix.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" ; Phi nodes can refer to the entry. And the entry might be unnamed, and doesn't even have a consistent implicit name! diff --git a/tests/cases/phientryimplicitmoar.ll b/tests/cases/phientryimplicitmoar.ll index eca7276e0b5df..ad1e701c34c6c 100644 --- a/tests/cases/phientryimplicitmoar.ll +++ b/tests/cases/phientryimplicitmoar.ll @@ -1,5 +1,5 @@ ; ModuleID = 'tests/hello_world.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] diff --git a/tests/cases/philoop_ta2.ll b/tests/cases/philoop_ta2.ll index 1afec6106cec6..b73aefc3d3323 100644 --- a/tests/cases/philoop_ta2.ll +++ b/tests/cases/philoop_ta2.ll @@ -1,5 +1,5 @@ ; ModuleID = '/tmp/tmpVIBz29/a.out.bc' -target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32" +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:128-n32-S128" target triple = "asmjs-unknown-emscripten" @.str = private unnamed_addr constant [13 x i8] c"99\0A70\0A26\0A97\0A\00", align 1 diff --git a/tests/cases/phinonexist.ll b/tests/cases/phinonexist.ll index 145d222191351..75c1cef66020f 100644 --- a/tests/cases/phinonexist.ll +++ b/tests/cases/phinonexist.ll @@ -5,18 +5,19 @@ target triple = "i386-pc-linux-gnu" @.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*] define i32 @main() { +entry: %retval = alloca i32, align 4 %a12 = zext i1 1 to i32 - br label %13 + br label %label13 -;