GitLab will be upgraded to the 12.10.14-ce.0 on 28 Sept 2020 at 2.00pm (AEDT) to 2.30pm (AEDT). During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to us at N110 (b) CSIT building.

Commit f0f14163 authored by Kunshan Wang's avatar Kunshan Wang

WIP: Converting symbolic AST to internal AST

parent 1d811787
package uvm.ir.irbuilder
import uvm._
import uvm.ssavariables._
import uvm.types._
import uvm.utils.Later
import uvm.utils.Later._
import uvm.ir.irbuilder.IRBuilderNode._
import scala.collection.mutable.ArrayBuffer
/** This class converts the soup of ID-referenced nodes into the refimpl's internal AST. */
class BundleConstructor(idNameMap: Map[MuID, MuName], nodeList: Seq[IRBuilderNode], globalBundle: GlobalBundle) {
val idNodeMap = nodeList.map(n => (n.id, n)).toMap
val bundle = new TrantientBundle()
def setIDAndMaybeName[T <: IdentifiedSettable](obj: T, id: MuID): T = {
obj.id = id
obj.name = idNameMap.get(id)
obj
}
def cascadeLookup[T <: Identified](id: MuID, ns1: Namespace[T], ns2: Namespace[T]): T = {
ns1.get(id).getOrElse {
ns2.get(id).getOrElse {
throw new UnknownIDException(id)
}
}
}
implicit def resTy(id: MuID): Type = cascadeLookup(id, bundle.typeNs, globalBundle.typeNs)
implicit def resSig(id: MuID): FuncSig = cascadeLookup(id, bundle.funcSigNs, globalBundle.funcSigNs)
implicit def resConst(id: MuID): Constant = cascadeLookup(id, bundle.constantNs, globalBundle.constantNs)
implicit def resGlobalVar(id: MuID): GlobalVariable = cascadeLookup(id, bundle.globalVarNs, globalBundle.globalVarNs)
implicit def resFunc(id: MuID): Function = cascadeLookup(id, bundle.funcNs, globalBundle.funcNs)
implicit def resConstInt(id: MuID): ConstInt = resConst(id) match {
case ci: ConstInt => ci
case other => throw new AssertionError("Constant int expected, but %d found. ID: %d".format(other.getClass.getName, id))
}
def makeBundle(): TrantientBundle = {
// Classify nodes into categories for phasing.
val typeNodes = new ArrayBuffer[IRTypeNode]
val sigNodes = new ArrayBuffer[IRSigNode]
val constNodes = new ArrayBuffer[IRConstNode]
val otherTopLevelNodes = new ArrayBuffer[OtherTopLevelNode]
val funcVers = new ArrayBuffer[NodeFuncVer]()
val otherNodes = new ArrayBuffer[IRBuilderNode]
nodeList foreach {
case n: IRTypeNode => typeNodes += n
case n: IRSigNode => sigNodes += n
case n: IRConstNode => constNodes += n
case n: OtherTopLevelNode => otherTopLevelNodes += n
case n: NodeFuncVer => funcVers += n
case n => otherNodes += n
}
// Phase 1: create types and sigs, and resolve their refs
val phase1 = new Later()
typeNodes foreach { irNode =>
val muNode: Type = irNode match {
case NodeTypeInt(id, len) => new TypeInt(len)
case NodeTypeFloat(id) => new TypeFloat()
case NodeTypeDouble(id) => new TypeDouble()
case NodeTypeUPtr(id, ty) => new TypeUPtr(null).later(phase1) { t => t.ty = ty }
case NodeTypeUFuncPtr(id, sig) => new TypeUFuncPtr(null).later(phase1) { t => t.sig = sig }
case NodeTypeStruct(id, fieldTys) => new TypeStruct(null).later(phase1) { t =>
t.fieldTys = fieldTys.map(resTy)
}
case NodeTypeHybrid(id, fixedTys, varTy) => new TypeHybrid(null, null).later(phase1) { t =>
t.fieldTys = fixedTys.map(resTy)
t.varTy = varTy
}
case NodeTypeArray(id, elemTy, len) => new TypeArray(null, len).later(phase1) { t =>
t.elemTy = elemTy
}
case NodeTypeVector(id, elemTy, len) => new TypeVector(null, len).later(phase1) { t =>
t.elemTy = elemTy
}
case NodeTypeVoid(id) => new TypeVoid()
case NodeTypeRef(id, ty) => new TypeRef(null).later(phase1) { t => t.ty = ty }
case NodeTypeIRef(id, ty) => new TypeIRef(null).later(phase1) { t => t.ty = ty }
case NodeTypeWeakRef(id, ty) => new TypeWeakRef(null).later(phase1) { t => t.ty = ty }
case NodeTypeFuncRef(id, sig) => new TypeFuncRef(null).later(phase1) { t => t.sig = sig }
case NodeTypeTagRef64(id) => new TypeTagRef64()
case NodeTypeThreadRef(id) => new TypeThreadRef()
case NodeTypeStackRef(id) => new TypeStackRef()
case NodeTypeFrameCursorRef(id) => new TypeFrameCursorRef()
case NodeTypeIRBuilderRef(id) => new TypeIRBuilderRef()
}
setIDAndMaybeName(muNode, irNode.id)
bundle.typeNs.add(muNode)
}
sigNodes foreach { irNode =>
val NodeFuncSig(id, paramTys, retTys) = irNode
val muNode: FuncSig = new FuncSig(null, null).later(phase1) { sig =>
sig.paramTys = paramTys.map(resTy)
sig.retTys = retTys.map(resTy)
}
setIDAndMaybeName(muNode, irNode.id)
bundle.funcSigNs.add(muNode)
}
phase1.doAll()
// Now, all types and sigs are created and their references are resolved.
// Phase 2: create and resolve consts, global cells, funcs, expfuncs and resolve their refs.
val phase2 = new Later()
constNodes foreach { irNode =>
val muNode: Constant = irNode match {
case NodeConstInt(id, ty, value) => new ConstInt(ty, value)
case NodeConstFloat(id, ty, value) => new ConstFloat(ty, value)
case NodeConstDouble(id, ty, value) => new ConstDouble(ty, value)
case NodeConstNull(id, ty) => new ConstNull(ty)
case NodeConstExtern(id, ty, symbol) => new ConstExtern(ty, symbol)
case NodeConstSeq(id, ty, elems) => new ConstSeq(ty, null).later(phase2) { c =>
c.elems = elems.map(resGlobalVar)
}
}
setIDAndMaybeName(muNode, irNode.id)
bundle.constantNs.add(muNode)
}
otherTopLevelNodes foreach {
case NodeGlobalCell(id: MuID, ty: MuTypeNode) => {
val muNode = new GlobalCell(ty)
setIDAndMaybeName(muNode, id)
bundle.globalCellNs.add(muNode)
}
case NodeFunc(id: MuID, sig: MuFuncSigNode) => {
val muNode = new Function()
muNode.sig = sig
setIDAndMaybeName(muNode, id)
bundle.funcNs.add(muNode)
}
case NodeExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode) => {
val muNode = new ExposedFunc(func, callconv, cookie)
setIDAndMaybeName(muNode, id)
bundle.expFuncNs.add(muNode)
}
}
phase2.doAll()
// Now all top-level definitions are created and their inter-references are resolved
// Phase 3: Define all defined functions (.funcdef)
val phase3 = new Later()
funcVers foreach { irNode =>
val muNode = new FuncVer(irNode.func)
setIDAndMaybeName(muNode, irNode.id)
bundle.funcVerNs.add(muNode)
phase3 { () =>
defineFunction(irNode, muNode)
}
}
phase3.doAll()
bundle
}
def defineFunction(irNode: NodeFuncVer, muFunc: FuncVer): Unit = {
???
}
}
\ No newline at end of file
......@@ -58,6 +58,7 @@ trait IRBuilderListener {
def onBundleAbort(irBuilder: IRBuilder): Unit
}
/** The client-visible API for constructing Mu IR bundles. */
class IRBuilder(val id: MuInternalID,
globalBundle: GlobalBundle, idFactory: IDFactory, irBuilderListener: Option[IRBuilderListener])
extends HasID {
......@@ -72,7 +73,10 @@ class IRBuilder(val id: MuInternalID,
nodeList += node
}
def makeBundle(): TrantientBundle = ???
def makeBundle(): TrantientBundle = {
val bc = new BundleConstructor(idNameMap.toMap, nodeList, globalBundle)
bc.makeBundle()
}
def load(): Unit = {
val trantientBundle = makeBundle()
......
package uvm.ir.irbuilder
import uvm.UvmException
import uvm.MuID
/** Base class for exceptions thrown by the IR builder. */
class IRBuilderException(message: String = null, cause: Throwable = null) extends UvmException(message, cause)
......@@ -8,9 +9,17 @@ class IRBuilderException(message: String = null, cause: Throwable = null) extend
/**
* Thrown if the Mu name provided to setName is illegal
*/
class IllegalNameException(message: String = null, cause: Throwable = null) extends UvmException(message, cause)
class IllegalNameException(message: String = null, cause: Throwable = null) extends IRBuilderException(message, cause)
/**
* Thrown if the external symbol provided to new_const_extern is illegal
*/
class IllegalSymbolException(message: String = null, cause: Throwable = null) extends UvmException(message, cause)
\ No newline at end of file
class IllegalSymbolException(message: String = null, cause: Throwable = null) extends IRBuilderException(message, cause)
/**
* Thrown if an ID cannot be resolved
*/
class UnknownIDException(id: MuID, cause: Throwable = null) extends {
private val msg = "ID %d not found".format(id)
} with IRBuilderException(msg, cause)
......@@ -34,104 +34,115 @@ import IRBuilderNode._
import uvm.ssavariables._
import uvm.comminsts.CommInst
abstract class IRBuilderNode(id: MuID)
abstract class IRBuilderNode {
def id: MuID
}
// Categorise by phase
abstract class TypeSigLike extends IRBuilderNode
abstract class OtherTopLevelNode extends IRBuilderNode
// Categorize by namespace (in uvm.Bundle)
abstract class IRTypeNode extends TypeSigLike
abstract class IRSigNode extends TypeSigLike
abstract class IRConstNode extends OtherTopLevelNode
// EXT:BEGIN:IRBUILDER_NODES
// format: OFF
case class NodeTypeInt (id: MuID, len: Int) extends IRBuilderNode(id)
case class NodeTypeFloat (id: MuID) extends IRBuilderNode(id)
case class NodeTypeDouble (id: MuID) extends IRBuilderNode(id)
case class NodeTypeUPtr (id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeTypeUFuncPtr(id: MuID, sig: MuFuncSigNode) extends IRBuilderNode(id)
case class NodeTypeStruct(id: MuID, fieldTys: Seq[MuTypeNode]) extends IRBuilderNode(id)
case class NodeTypeHybrid(id: MuID, fixedTys: Seq[MuTypeNode], varTy: MuTypeNode) extends IRBuilderNode(id)
case class NodeTypeArray (id: MuID, elemTy: MuTypeNode, len: Long) extends IRBuilderNode(id)
case class NodeTypeVector(id: MuID, elemTy: MuTypeNode, len: Long) extends IRBuilderNode(id)
case class NodeTypeVoid (id: MuID) extends IRBuilderNode(id)
case class NodeTypeRef (id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeTypeIRef (id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeTypeWeakRef(id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeTypeFuncRef(id: MuID, sig: MuFuncSigNode) extends IRBuilderNode(id)
case class NodeTypeTagRef64 (id: MuID) extends IRBuilderNode(id)
case class NodeTypeThreadRef (id: MuID) extends IRBuilderNode(id)
case class NodeTypeStackRef (id: MuID) extends IRBuilderNode(id)
case class NodeTypeFrameCursorRef(id: MuID) extends IRBuilderNode(id)
case class NodeTypeIRBuilderRef (id: MuID) extends IRBuilderNode(id)
case class NodeTypeInt (id: MuID, len: Int) extends IRTypeNode
case class NodeTypeFloat (id: MuID) extends IRTypeNode
case class NodeTypeDouble (id: MuID) extends IRTypeNode
case class NodeTypeUPtr (id: MuID, ty: MuTypeNode) extends IRTypeNode
case class NodeTypeUFuncPtr (id: MuID, sig: MuFuncSigNode) extends IRTypeNode
case class NodeTypeStruct (id: MuID, fieldTys: Seq[MuTypeNode]) extends IRTypeNode
case class NodeTypeHybrid (id: MuID, fixedTys: Seq[MuTypeNode], varTy: MuTypeNode) extends IRTypeNode
case class NodeTypeArray (id: MuID, elemTy: MuTypeNode, len: Long) extends IRTypeNode
case class NodeTypeVector (id: MuID, elemTy: MuTypeNode, len: Long) extends IRTypeNode
case class NodeTypeVoid (id: MuID) extends IRTypeNode
case class NodeTypeRef (id: MuID, ty: MuTypeNode) extends IRTypeNode
case class NodeTypeIRef (id: MuID, ty: MuTypeNode) extends IRTypeNode
case class NodeTypeWeakRef (id: MuID, ty: MuTypeNode) extends IRTypeNode
case class NodeTypeFuncRef (id: MuID, sig: MuFuncSigNode) extends IRTypeNode
case class NodeTypeTagRef64 (id: MuID) extends IRTypeNode
case class NodeTypeThreadRef (id: MuID) extends IRTypeNode
case class NodeTypeStackRef (id: MuID) extends IRTypeNode
case class NodeTypeFrameCursorRef(id: MuID) extends IRTypeNode
case class NodeTypeIRBuilderRef (id: MuID) extends IRTypeNode
// format: ON
case class NodeFuncSig(id: MuID, paramTys: Seq[MuTypeNode], retTys: Seq[MuTypeNode]) extends IRBuilderNode(id)
case class NodeFuncSig(id: MuID, paramTys: Seq[MuTypeNode], retTys: Seq[MuTypeNode]) extends IRSigNode
// format: OFF
case class NodeConstInt (id: MuID, ty: MuTypeNode, value: BigInt) extends IRBuilderNode(id)
case class NodeConstFloat (id: MuID, ty: MuTypeNode, value: Float) extends IRBuilderNode(id)
case class NodeConstDouble(id: MuID, ty: MuTypeNode, value: Double) extends IRBuilderNode(id)
case class NodeConstNull (id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeConstSeq (id: MuID, ty: MuTypeNode, elems: Seq[MuGlobalVarNode]) extends IRBuilderNode(id)
case class NodeConstExtern(id: MuID, ty: MuTypeNode, symbol: String) extends IRBuilderNode(id)
case class NodeConstInt (id: MuID, ty: MuTypeNode, value: BigInt) extends IRConstNode
case class NodeConstFloat (id: MuID, ty: MuTypeNode, value: Float) extends IRConstNode
case class NodeConstDouble(id: MuID, ty: MuTypeNode, value: Double) extends IRConstNode
case class NodeConstNull (id: MuID, ty: MuTypeNode) extends IRConstNode
case class NodeConstSeq (id: MuID, ty: MuTypeNode, elems: Seq[MuGlobalVarNode]) extends IRConstNode
case class NodeConstExtern(id: MuID, ty: MuTypeNode, symbol: String) extends IRConstNode
// format: ON
case class NodeGlobalCell(id: MuID, ty: MuTypeNode) extends IRBuilderNode(id)
case class NodeGlobalCell(id: MuID, ty: MuTypeNode) extends OtherTopLevelNode
case class NodeFunc(id: MuID, sig: MuFuncSigNode) extends IRBuilderNode(id)
case class NodeFunc(id: MuID, sig: MuFuncSigNode) extends OtherTopLevelNode
case class NodeExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode) extends IRBuilderNode(id)
case class NodeExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode) extends OtherTopLevelNode
case class NodeFuncVer(id: MuID, func: MuFuncNode, bbs: Seq[MuBBNode]) extends IRBuilderNode(id)
case class NodeFuncVer(id: MuID, func: MuFuncNode, bbs: Seq[MuBBNode]) extends IRBuilderNode
case class NodeBB(id: MuID, norParamIDs: Seq[MuID], excParamID: Option[MuID], insts: Seq[MuInstNode]) extends IRBuilderNode(id)
case class NodeDestClause(id: MuID, dest: MuBBNode, vars: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeBB(id: MuID, norParamIDs: Seq[MuID], excParamID: Option[MuID], insts: Seq[MuInstNode]) extends IRBuilderNode
case class NodeDestClause(id: MuID, dest: MuBBNode, vars: Seq[MuVarNode]) extends IRBuilderNode
case class NodeExcClause(id: MuID, nor: MuDestClause, exc: MuDestClause) extends IRBuilderNode(id)
case class NodeExcClause(id: MuID, nor: MuDestClause, exc: MuDestClause) extends IRBuilderNode
case class NodeKeepaliveClause(id: MuID, vars: Seq[MuLocalVarNode]) extends IRBuilderNode(id)
case class NodeKeepaliveClause(id: MuID, vars: Seq[MuLocalVarNode]) extends IRBuilderNode
case class NodeCscRetWith(id: MuID, rettys: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeCscKillOld(id: MuID) extends IRBuilderNode(id)
case class NodeCscRetWith(id: MuID, rettys: Seq[MuVarNode]) extends IRBuilderNode
case class NodeCscKillOld(id: MuID) extends IRBuilderNode
case class NodeNscPassValues(id: MuID, tys: Seq[MuTypeNode], vars: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeNscThrowExc(id: MuID, exc: MuVarNode) extends IRBuilderNode(id)
case class NodeNscPassValues(id: MuID, tys: Seq[MuTypeNode], vars: Seq[MuVarNode]) extends IRBuilderNode
case class NodeNscThrowExc(id: MuID, exc: MuVarNode) extends IRBuilderNode
case class NodeBinOp(id: MuID, resultID: MuID, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode) extends IRBuilderNode(id)
case class NodeConv(id: MuID, resultID: MuID, optr: ConvOptr.Value, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeSelect(id: MuID, resultID: MuID, condTy: MuTypeNode, opndTy: MuTypeNode, cond: MuVarNode, ifTrue: MuVarNode, ifFalse: MuVarNode) extends IRBuilderNode(id)
case class NodeBranch(id: MuID, dest: MuDestClause) extends IRBuilderNode(id)
case class NodeBranch2(id: MuID, cond: MuVarNode, ifTrue: MuDestClause, ifFalse: MuDestClause) extends IRBuilderNode(id)
case class NodeSwitch(id: MuID, opndTy: MuTypeNode, opnd: MuVarNode, defaultDest: MuDestClause, cases: Seq[MuConstNode], dests: Seq[MuDestClause]) extends IRBuilderNode(id)
case class NodeCall(id: MuID, resultIds: Seq[MuID], sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeTailCall(id: MuID, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeRet(id: MuID, rvs: Seq[MuVarNode]) extends IRBuilderNode(id)
case class NodeThrow(id: MuID, exc: MuVarNode) extends IRBuilderNode(id)
case class NodeExtractValue(id: MuID, resultID: MuID, strty: MuTypeNode, index: Int, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeInsertValue(id: MuID, resultID: MuID, strty: MuTypeNode, index: Int, opnd: MuVarNode, newval: MuVarNode) extends IRBuilderNode(id)
case class NodeExtractElement(id: MuID, resultID: MuID, seqty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode) extends IRBuilderNode(id)
case class NodeInsertElement(id: MuID, resultID: MuID, seqty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode, newval: MuVarNode) extends IRBuilderNode(id)
case class NodeShuffleVector(id: MuID, resultID: MuID, vecty: MuTypeNode, maskty: MuTypeNode, vec1: MuVarNode, vec2: MuVarNode, mask: MuVarNode) extends IRBuilderNode(id)
case class NodeNew(id: MuID, resultID: MuID, allocty: MuTypeNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeNewHybrid(id: MuID, resultID: MuID, allocty: MuTypeNode, lenty: MuTypeNode, length: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeAlloca(id: MuID, resultID: MuID, allocty: MuTypeNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeAllocaHybrid(id: MuID, resultID: MuID, allocty: MuTypeNode, lenty: MuTypeNode, length: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeGetIRef(id: MuID, resultID: MuID, refty: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeGetFieldIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, index: Int, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeGetElemIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode) extends IRBuilderNode(id)
case class NodeShiftIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, offty: MuTypeNode, opnd: MuVarNode, offset: MuVarNode) extends IRBuilderNode(id)
case class NodeGetVarPartIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode(id)
case class NodeLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeStore(id: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeCmpXchg(id: MuID, valueResultID: MuID, succResultID: MuID, isPtr: Boolean, isWeak: Boolean, ordSucc: MemoryOrder.Value, ordFail: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, expected: MuVarNode, desired: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, optr: AtomicRMWOptr.Value, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeFence(id: MuID, ord: MemoryOrder.Value) extends IRBuilderNode(id)
case class NodeTrap(id: MuID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeWatchPoint(id: MuID, wpid: MuWPID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeWPBranch(id: MuID, wpid: MuWPID) extends IRBuilderNode(id)
case class NodeCCall(id: MuID, resultIds: Seq[MuID], callconv: Flag, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeNewThread(id: MuID, resultID: MuID, stack: MuVarNode, threadlocal: Option[MuVarNode], newStackClause: MuNewStackClause, excClause: Option[MuExcClause]) extends IRBuilderNode(id)
case class NodeSwapStack(id: MuID, resultIds: Seq[MuID], swappee: MuVarNode, curStackClause: MuCurStackClause, newStackClause: MuNewStackClause, excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeCommInst(id: MuID, resultIds: Seq[MuID], opcode: CommInst, flags: Seq[Flag], tys: Seq[MuTypeNode], sigs: Seq[MuFuncSigNode], args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode(id)
case class NodeBinOp(id: MuID, resultID: MuID, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]) extends IRBuilderNode
case class NodeCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode) extends IRBuilderNode
case class NodeConv(id: MuID, resultID: MuID, optr: ConvOptr.Value, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode
case class NodeSelect(id: MuID, resultID: MuID, condTy: MuTypeNode, opndTy: MuTypeNode, cond: MuVarNode, ifTrue: MuVarNode, ifFalse: MuVarNode) extends IRBuilderNode
case class NodeBranch(id: MuID, dest: MuDestClause) extends IRBuilderNode
case class NodeBranch2(id: MuID, cond: MuVarNode, ifTrue: MuDestClause, ifFalse: MuDestClause) extends IRBuilderNode
case class NodeSwitch(id: MuID, opndTy: MuTypeNode, opnd: MuVarNode, defaultDest: MuDestClause, cases: Seq[MuConstNode], dests: Seq[MuDestClause]) extends IRBuilderNode
case class NodeCall(id: MuID, resultIds: Seq[MuID], sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode
case class NodeTailCall(id: MuID, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode]) extends IRBuilderNode
case class NodeRet(id: MuID, rvs: Seq[MuVarNode]) extends IRBuilderNode
case class NodeThrow(id: MuID, exc: MuVarNode) extends IRBuilderNode
case class NodeExtractValue(id: MuID, resultID: MuID, strty: MuTypeNode, index: Int, opnd: MuVarNode) extends IRBuilderNode
case class NodeInsertValue(id: MuID, resultID: MuID, strty: MuTypeNode, index: Int, opnd: MuVarNode, newval: MuVarNode) extends IRBuilderNode
case class NodeExtractElement(id: MuID, resultID: MuID, seqty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode) extends IRBuilderNode
case class NodeInsertElement(id: MuID, resultID: MuID, seqty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode, newval: MuVarNode) extends IRBuilderNode
case class NodeShuffleVector(id: MuID, resultID: MuID, vecty: MuTypeNode, maskty: MuTypeNode, vec1: MuVarNode, vec2: MuVarNode, mask: MuVarNode) extends IRBuilderNode
case class NodeNew(id: MuID, resultID: MuID, allocty: MuTypeNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeNewHybrid(id: MuID, resultID: MuID, allocty: MuTypeNode, lenty: MuTypeNode, length: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeAlloca(id: MuID, resultID: MuID, allocty: MuTypeNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeAllocaHybrid(id: MuID, resultID: MuID, allocty: MuTypeNode, lenty: MuTypeNode, length: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeGetIRef(id: MuID, resultID: MuID, refty: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode
case class NodeGetFieldIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, index: Int, opnd: MuVarNode) extends IRBuilderNode
case class NodeGetElemIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode) extends IRBuilderNode
case class NodeShiftIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, offty: MuTypeNode, opnd: MuVarNode, offset: MuVarNode) extends IRBuilderNode
case class NodeGetVarPartIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, opnd: MuVarNode) extends IRBuilderNode
case class NodeLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeStore(id: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeCmpXchg(id: MuID, valueResultID: MuID, succResultID: MuID, isPtr: Boolean, isWeak: Boolean, ordSucc: MemoryOrder.Value, ordFail: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, expected: MuVarNode, desired: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, optr: AtomicRMWOptr.Value, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeFence(id: MuID, ord: MemoryOrder.Value) extends IRBuilderNode
case class NodeTrap(id: MuID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode
case class NodeWatchPoint(id: MuID, wpid: MuWPID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode
case class NodeWPBranch(id: MuID, wpid: MuWPID) extends IRBuilderNode
case class NodeCCall(id: MuID, resultIds: Seq[MuID], callconv: Flag, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode
case class NodeNewThread(id: MuID, resultID: MuID, stack: MuVarNode, threadlocal: Option[MuVarNode], newStackClause: MuNewStackClause, excClause: Option[MuExcClause]) extends IRBuilderNode
case class NodeSwapStack(id: MuID, resultIds: Seq[MuID], swappee: MuVarNode, curStackClause: MuCurStackClause, newStackClause: MuNewStackClause, excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode
case class NodeCommInst(id: MuID, resultIds: Seq[MuID], opcode: CommInst, flags: Seq[Flag], tys: Seq[MuTypeNode], sigs: Seq[MuFuncSigNode], args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]) extends IRBuilderNode
// EXT:END:IRBUILDER_NODES
\ No newline at end of file
......@@ -20,6 +20,7 @@ import uvm.utils.AdvancedAntlrHelper
import uvm.utils.AntlrHelpers.AccumulativeAntlrErrorListener
import uvm.utils.IDFactory
import uvm.utils.IOHelpers
import uvm.utils.Later
class UIRTextReader(val defaultIDFactory: IDFactory, val recordSourceInfo: Boolean = true) {
import UIRTextReader._
......@@ -83,7 +84,7 @@ class UIRTextReader(val defaultIDFactory: IDFactory, val recordSourceInfo: Boole
private[textinput] class InstanceUIRTextReader(idFactory: IDFactory, source: String, ir: IrContext,
globalBundle: GlobalBundle, val recordSourceInfo: Boolean) extends AdvancedAntlrHelper {
import UIRTextReader._
import uvm.ir.textinput.Later.Laterable
import uvm.utils.Later.Laterable
def sourceLines = source.lines.toIndexedSeq
......
package uvm.ir.textinput
package uvm.utils
class Later {
var tooLate = false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment