//"use strict"; // LLVM assembly => internal intermediate representation, which is ready // to be processed by the later stages. var tokenizer; // TODO: Clean this up/out // XXX In particular, this closes over the substrate, which can keep stuff in memory, which is bad function tokenize(text) { return tokenizer.processItem({ lineText: text }, true); } // Handy sets var ENCLOSER_STARTERS = set('[', '(', '<'); var ENCLOSER_ENDERS = { '[': ']', '(': ')', '<': '>' }; var MATHOPS = set(['add', 'sub', 'sdiv', 'udiv', 'mul', 'icmp', 'zext', 'urem', 'srem', 'fadd', 'fsub', 'fmul', 'fdiv', 'fcmp', 'uitofp', 'sitofp', 'fpext', 'fptrunc', 'fptoui', 'fptosi', 'trunc', 'sext', 'select', 'shl', 'shr', 'ashl', 'ashr', 'lshr', 'lshl', 'xor', 'or', 'and', 'ptrtoint', 'inttoptr']); var ZEROINIT_UNDEF = set('zeroinitializer', 'undef'); var NSW_NUW = set('nsw', 'nuw'); // Intertyper function intertyper(data, sidePass, baseLineNums) { var mainPass = !sidePass; baseLineNums = baseLineNums || [[0,0]]; // each pair [#0,#1] means "starting from line #0, the base line num is #1" dprint('framework', 'Big picture: Starting intertyper, main pass=' + mainPass); if (mainPass) { if (LLVM_STYLE === null) { // new = clang on 2.8, old = llvm-gcc anywhere or clang on 2.7 LLVM_STYLE = (data.indexOf('