aboutsummaryrefslogtreecommitdiff
path: root/src/modules.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules.js')
-rw-r--r--src/modules.js33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/modules.js b/src/modules.js
index 60b4ff87..9ef87691 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -5,11 +5,11 @@
var LLVM = {
LINKAGES: set('private', 'linker_private', 'linker_private_weak', 'linker_private_weak_def_auto', 'internal',
'available_externally', 'linkonce', 'common', 'weak', 'appending', 'extern_weak', 'linkonce_odr',
- 'weak_odr', 'externally_visible', 'dllimport', 'dllexport', 'unnamed_addr'),
+ 'weak_odr', 'externally_visible', 'dllimport', 'dllexport', 'unnamed_addr', 'thread_local'),
VISIBILITIES: set('default', 'hidden', 'protected'),
PARAM_ATTR: set('noalias', 'signext', 'zeroext', 'inreg', 'sret', 'nocapture', 'nest'),
FUNC_ATTR: set('hidden', 'nounwind', 'define', 'inlinehint', '{'),
- CALLING_CONVENTIONS: set('ccc', 'fastcc', 'coldcc', 'cc10', 'x86_fastcallcc', 'x86_stdcallcc'),
+ CALLING_CONVENTIONS: set('ccc', 'fastcc', 'coldcc', 'cc10', 'x86_fastcallcc', 'x86_stdcallcc', 'cc11'),
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'),
@@ -207,8 +207,9 @@ var Types = {
needAnalysis: {}, // Types noticed during parsing, that need analysis
- preciseI64MathUsed: false // Set to true if we actually use precise i64 math: If PRECISE_I64_MATH is set, and also such math is actually
- // needed (+,-,*,/,% - we do not need it for bitops)
+ // Set to true if we actually use precise i64 math: If PRECISE_I64_MATH is set, and also such math is actually
+ // needed (+,-,*,/,% - we do not need it for bitops), or PRECISE_I64_MATH is 2 (forced)
+ preciseI64MathUsed: (PRECISE_I64_MATH == 2)
};
var Functions = {
@@ -242,16 +243,14 @@ var Functions = {
for (var ident in this.indexedFunctions) {
vals[this.indexedFunctions[ident]] = ident;
}
-
// Resolve multi-level aliases all the way down
for (var i = 0; i < vals.length; i++) {
while (1) {
var varData = Variables.globals[vals[i]];
if (!(varData && varData.resolvedAlias)) break;
- vals[i] = vals[varData.resolvedAlias];
+ vals[i] = vals[+varData.resolvedAlias || eval(varData.resolvedAlias)]; // might need to eval to turn (6) into 6
}
}
-
var indices = vals.toString().replace('"', '');
if (BUILD_AS_SHARED_LIB) {
// Shared libraries reuse the parent's function table.
@@ -302,11 +301,21 @@ function cDefine(key) {
var PassManager = {
serialize: function() {
- print('\n//FORWARDED_DATA:' + JSON.stringify({
- Types: Types,
- Variables: Variables,
- Functions: Functions
- }));
+ if (phase == 'pre') {
+ print('\n//FORWARDED_DATA:' + JSON.stringify({
+ Types: Types,
+ Variables: Variables,
+ Functions: Functions
+ }));
+ } else if (phase == 'funcs') {
+ print('\n//FORWARDED_DATA:' + JSON.stringify({
+ Types: { preciseI64MathUsed: Types.preciseI64MathUsed },
+ Functions: {
+ blockAddresses: Functions.blockAddresses,
+ indexedFunctions: Functions.indexedFunctions
+ }
+ }));
+ }
},
load: function(json) {
var data = JSON.parse(json);