diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-27 19:17:49 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-27 19:17:49 -0800 |
commit | f8d4a502913713757355a700bda4ddf7270121ed (patch) | |
tree | cd366606f558b97ba4818aa6e769f207984ad470 | |
parent | 73b16bdcad3c33274d15cb5cefecd38bcec4cfe8 (diff) |
preparation for legalizing mathops
-rw-r--r-- | src/analyzer.js | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index b3d9183c..4839134f 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -205,13 +205,12 @@ function analyzer(data, sidePass) { } else if (item.intertype == 'assign') { var value = item.value; switch (value.intertype) { - case 'load': + case 'load': { if (isIllegalType(value.valueType)) { dprint('legalizer', 'Legalizing load at line ' + item.lineNum); bits = getBits(value.valueType); assert(value.pointer.intertype == 'value', 'TODO: unfolding'); - var elements; - elements = getLegalVars(item.ident, bits); + var elements = getLegalVars(item.ident, bits); label.lines.splice(i, 1); var j = 0; elements.forEach(function(element) { @@ -224,7 +223,7 @@ function analyzer(data, sidePass) { ident: value.pointer.ident, type: '[0 x i32]*', params: [ - { intertype: 'value', ident: value.pointer.ident, type: '[0 x i32]*' }, // technically a bitcase is needed in llvm, but not for us + { intertype: 'value', ident: value.pointer.ident, type: '[0 x i32]*' }, // technically bitcast is needed in llvm, but not for us { intertype: 'value', ident: '0', type: 'i32' }, { intertype: 'value', ident: j.toString(), type: 'i32' } ], @@ -253,6 +252,22 @@ function analyzer(data, sidePass) { i += j*2; continue; } + } + case 'mathop': { + if (isIllegalType(value.valueType)) { + dprint('legalizer', 'Legalizing mathop at line ' + item.lineNum); + bits = getBits(value.type); + var targetElements = getLegalVars(item.ident, bits); + assert(value.param1.intertype == 'value', 'TODO: unfolding'); + var sourceElements = getLegalVars(value.param1.ident, bits); + label.lines.splice(i, 1); + switch (value.op) { + case 'lshr': { + } + default: throw 'Invalid mathop for legalization: ' + [value.op, item.lineNum]; + } + } + } } } i++; |