summaryrefslogtreecommitdiff
path: root/src/main/java/com/seaofnodes/simple/node/MachConcreteNode.java
blob: b25fcaaf5b61066f83b953010ec09f02334719a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.seaofnodes.simple.node;

import com.seaofnodes.print.ExprPrinter;

import com.seaofnodes.simple.type.Type;
import java.io.ByteArrayOutputStream;

// Generic machine-specific class, has a few Node implementations that have to
// exist (abstract) but are not useful past the optimizer.
public abstract class MachConcreteNode extends Node implements MachNode {

    public MachConcreteNode(Node node) { super(node); }
    public MachConcreteNode(Node[]nodes) { super(nodes); }

    @Override public String label() { return op(); }
    @Override public Type compute () { throw new AssertionError("Do not call compute on "+getClass().getSimpleName()); }
    @Override public Node idealize() { throw new AssertionError("Do not call idealize on "+getClass().getSimpleName()); }

    @Override protected ExprPrinter<Node> _print1(ExprPrinter<Node> p) {
        p.open().p(op()).p(",");
        for( int i=1; i<nIns(); i++ )
            (in(i)==null ? p.p(" ---") :  p.n(in(i))).p(",");
        return p.unchar(',').close();
    }

}