diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-27 17:37:20 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-27 17:37:20 -0700 |
commit | 26cab17867e4c5e0ce69c81c1ac05a20d08d8b02 (patch) | |
tree | 95ba7a025ed0204ad80f58c31a5080e19b7f7b1a | |
parent | 040aa2d32ae0b891426763ccd80890b5357e70a8 (diff) |
fast-path simple loads
-rw-r--r-- | src/intertyper.js | 24 | ||||
-rw-r--r-- | src/parseTools.js | 5 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index 0fe58b7a..53c8482f 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -1035,7 +1035,29 @@ function intertyper(lines, sidePass, baseLineNums) { params: params }; } - // else if (line.lineText.indexOf(' = getelementptr ') > 0) printErr('close: ' + line.lineText); + // simple load + else if (m = / (%[\w\d\._]+) = load ([%\w\d\._\-@\*]+) ([%\w\d\._\-@]+)(, align \d+)?$/.exec(line.lineText)) { + var ident = toNiceIdent(m[3]); + var type = m[2]; + assert(type[type.length-1] === '*', type); + var valueType = type.substr(0, type.length-1); + ret = { + intertype: 'load', + lineNum: line.lineNum, + assignTo: toNiceIdent(m[1]), + ident: ident, + type: valueType, + valueType: valueType, + pointerType: type, + pointer: { + intertype: 'value', + ident: ident, + type: type, + }, + align: parseAlign(m[4]), + }; + } + //else if (line.lineText.indexOf(' = load ') > 0) printErr('close: ' + JSON.stringify(line.lineText)); } if (ret) { fastPaths++; diff --git a/src/parseTools.js b/src/parseTools.js index e3901954..470c246f 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -2547,3 +2547,8 @@ function makePrintChars(s, sep) { return ret; } +function parseAlign(text) { // parse ", align \d+" + if (!text) return QUANTUM_SIZE; + return parseInt(text.substr(8)); +} + |