diff options
author | Alon Zakai <azakai@mozilla.com> | 2010-11-19 23:29:41 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2010-11-19 23:29:41 -0800 |
commit | 6b4d1efe357c8f983b9ec1d0975bb809e37636bc (patch) | |
tree | 0c80803a39262470bc913c233c479f64427dde6c /src/analyzer.js | |
parent | 558ef3b56a30c573a42155efd730949b65fcffbd (diff) |
analyze types of function parameters
Diffstat (limited to 'src/analyzer.js')
-rw-r--r-- | src/analyzer.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index b23da395..7597aee8 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -215,6 +215,21 @@ function analyzer(data, givenTypes) { // LLVM is SSA, so we always have a single assignment/write. We care about // the reads/other uses. + + // Function parameters + func.params.forEach(function(param) { + if (param.intertype !== 'varargs') { + func.variables[param.ident] = { + ident: param.ident, + type: param.type, + origin: 'funcparam', + lineNum: func.lineNum, + uses: null, + }; + } + }); + + // Normal variables walkJSON(func.lines, function(item) { if (item && item.intertype == 'assign') { func.variables[item.ident] = { @@ -270,6 +285,8 @@ function analyzer(data, givenTypes) { // XXX Can we perhaps nativize some of these? However to do so, we need to discover their // true types; we have '?' for them now, as they cannot be discovered in the intertyper. variable.impl = VAR_EMULATED; + } else if (variable.origin == 'funcparam') { + variable.impl = VAR_EMULATED; } else if (OPTIMIZE && variable.pointingLevels === 0 && !variable.hasAddrTaken) { // A simple int value, can be implemented as a native variable variable.impl = VAR_NATIVE; |