aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-21 16:44:03 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-29 13:01:59 -0700
commit685eafedefa6f856037c9646ac200f5e22186f66 (patch)
tree938d983ab0349aff8c9c78d44c600e5e44500fd1
parent741365c7892957ef446b2da242cf509102273c66 (diff)
legalize va_arg on i64/i32*
-rw-r--r--src/analyzer.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/analyzer.js b/src/analyzer.js
index 7fbdf24d..31422201 100644
--- a/src/analyzer.js
+++ b/src/analyzer.js
@@ -469,6 +469,23 @@ function analyzer(data, sidePass) {
i++;
continue; // special case, handled in makeComparison
}
+ case 'va_arg': {
+ assert(value.type == 'i64');
+ assert(value.value.type == 'i32*', value.value.type);
+ i += removeAndAdd(label.lines, i, range(2).map(function(x) {
+ return {
+ intertype: 'va_arg',
+ assignTo: value.assignTo + '$' + x,
+ type: 'i32',
+ value: {
+ intertype: 'value',
+ ident: value.value.ident, // We read twice from the same i32* var, incrementing // + '$' + x,
+ type: 'i32*'
+ }
+ };
+ }));
+ continue;
+ }
case 'extractvalue': { // XXX we assume 32-bit alignment in extractvalue/insertvalue,
// but in theory they can run on packed structs too (see use getStructuralTypePartBits)
// potentially legalize the actual extracted value too if it is >32 bits, not just the extraction in general