private string buildFunction(DFunction node) { return(node.function.name); }
public override void visit(DConstant node) { DNode replacement = null; if (node.typeSet.numTypes == 1) { TypeUnit tu = node.typeSet[0]; switch (tu.kind) { case TypeUnit.Kind.Cell: { switch (tu.type.type) { case CellType.Bool: replacement = new DBoolean(node.value != 0); break; case CellType.Character: replacement = new DCharacter(Convert.ToChar(node.value)); break; case CellType.Float: { //Debug.Assert(BitConverter.IsLittleEndian); byte[] bits = BitConverter.GetBytes(node.value); float v = BitConverter.ToSingle(bits, 0); replacement = new DFloat(v); break; } case CellType.Function: { Public p = graph_.file.publics[node.value >> 1]; Function function = graph_.file.lookupFunction(p.address); replacement = new DFunction(p.address, function); break; } default: return; } break; } case TypeUnit.Kind.Array: { replacement = ConstantToReference(node, tu); break; } default: return; } } if (replacement == null && node.usedAsReference) replacement = ConstantToReference(node, null); if (replacement != null) { block_.nodes.insertAfter(node, replacement); node.replaceAllUsesWith(replacement); } }
public override void visit(DConstant node) { DNode replacement = null; if (node.typeSet.numTypes == 1) { TypeUnit tu = node.typeSet[0]; switch (tu.kind) { case TypeUnit.Kind.Cell: { switch (tu.type.type) { case CellType.Bool: replacement = new DBoolean(node.value != 0); break; case CellType.Character: replacement = new DCharacter(Convert.ToChar(node.value)); break; case CellType.Float: { //Debug.Assert(BitConverter.IsLittleEndian); byte[] bits = BitConverter.GetBytes(node.value); float v = BitConverter.ToSingle(bits, 0); replacement = new DFloat(v); break; } case CellType.Function: { Public p = graph_.file.publics[node.value >> 1]; Function function = graph_.file.lookupFunction(p.address); replacement = new DFunction(p.address, function); break; } default: return; } break; } case TypeUnit.Kind.Array: { replacement = ConstantToReference(node, tu); break; } default: return; } } if (replacement == null && node.usedAsReference) { replacement = ConstantToReference(node, null); } if (replacement != null) { block_.nodes.insertAfter(node, replacement); node.replaceAllUsesWith(replacement); } }
public virtual void visit(DFunction phi) { }
private string buildFunction(DFunction node) { return node.function.name; }