To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit d7a76d9e authored by Kunshan Wang's avatar Kunshan Wang
Browse files

New bundle building API. (not tested yet)

parent f0f14163
...@@ -563,10 +563,10 @@ struct MuIRBuilder { ...@@ -563,10 +563,10 @@ struct MuIRBuilder {
// Create basic block. Also create its parameters. // Create basic block. Also create its parameters.
void (*new_bb)(MuIRBuilder *b, MuID id, void (*new_bb)(MuIRBuilder *b, MuID id,
MuID *nor_param_ids, MuArraySize n_nor_param_ids, MuID *nor_param_ids, MuTypeNode *nor_param_types, MuArraySize n_nor_params,
MuID exc_param_id, MuID exc_param_id,
MuInstNode *insts, MuArraySize ninsts); MuInstNode *insts, MuArraySize ninsts);
/// MUAPIPARSER nor_param_ids:array:n_nor_param_ids;exc_param_id:optional;insts:array:ninsts /// MUAPIPARSER nor_param_ids:array:n_nor_params;nor_param_types:array:n_nor_params;exc_param_id:optional;insts:array:ninsts
// Create a destination clause. // Create a destination clause.
void (*new_dest_clause)(MuIRBuilder *b, MuID id, void (*new_dest_clause)(MuIRBuilder *b, MuID id,
...@@ -694,9 +694,11 @@ struct MuIRBuilder { ...@@ -694,9 +694,11 @@ struct MuIRBuilder {
/// MUAPIPARSER result_ids:array:nretvals;rettys:array:nretvals;exc_clause:optional;keepalive_clause:optional /// MUAPIPARSER result_ids:array:nretvals;rettys:array:nretvals;exc_clause:optional;keepalive_clause:optional
void (*new_watchpoint)(MuIRBuilder *b, MuID id, MuWPID wpid, void (*new_watchpoint)(MuIRBuilder *b, MuID id, MuWPID wpid,
MuID *result_ids, MuTypeNode *rettys, MuArraySize nretvals, MuID *result_ids, MuTypeNode *rettys, MuArraySize nretvals,
MuExcClause exc_clause, MuKeepaliveClause keepalive_clause); MuDestClause dis, MuDestClause ena, MuDestClause exc,
/// MUAPIPARSER result_ids:array:nretvals;rettys:array:nretvals;exc_clause:optional;keepalive_clause:optional MuKeepaliveClause keepalive_clause);
void (*new_wpbranch )(MuIRBuilder *b, MuID id, MuWPID wpid); /// MUAPIPARSER result_ids:array:nretvals;rettys:array:nretvals;exc:optional;keepalive_clause:optional
void (*new_wpbranch )(MuIRBuilder *b, MuID id, MuWPID wpid,
MuDestClause dis, MuDestClause ena);
void (*new_ccall)(MuIRBuilder *b, MuID id, MuID *result_ids, MuArraySize n_result_ids, void (*new_ccall)(MuIRBuilder *b, MuID id, MuID *result_ids, MuArraySize n_result_ids,
MuCallConv callconv, MuCallConv callconv,
......
...@@ -155,7 +155,7 @@ instBody ...@@ -155,7 +155,7 @@ instBody
| 'BRANCH' dest=destClause # InstBranch | 'BRANCH' dest=destClause # InstBranch
| 'BRANCH2' cond=value ifTrue=destClause ifFalse=destClause # InstBranch2 | 'BRANCH2' cond=value ifTrue=destClause ifFalse=destClause # InstBranch2
| 'SWITCH' '<' ty=type '>' opnd=value defDest=destClause '{' | 'SWITCH' '<' ty=type '>' opnd=value defDest=destClause '{'
(caseVal+=value caseDest+=destClause )* '}' # InstSwitch (caseVal+=constant caseDest+=destClause )* '}' # InstSwitch
// Inter-function Control Flow // Inter-function Control Flow
| 'CALL' funcCallBody excClause keepaliveClause # InstCall | 'CALL' funcCallBody excClause keepaliveClause # InstCall
......
...@@ -10,6 +10,7 @@ import scala.collection.mutable.ArrayBuffer ...@@ -10,6 +10,7 @@ import scala.collection.mutable.ArrayBuffer
/** This class converts the soup of ID-referenced nodes into the refimpl's internal AST. */ /** 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) { class BundleConstructor(idNameMap: Map[MuID, MuName], nodeList: Seq[IRBuilderNode], globalBundle: GlobalBundle) {
val idNodeMap = nodeList.map(n => (n.id, n)).toMap val idNodeMap = nodeList.map(n => (n.id, n)).toMap
val bundle = new TrantientBundle() val bundle = new TrantientBundle()
...@@ -29,21 +30,44 @@ class BundleConstructor(idNameMap: Map[MuID, MuName], nodeList: Seq[IRBuilderNod ...@@ -29,21 +30,44 @@ class BundleConstructor(idNameMap: Map[MuID, MuName], nodeList: Seq[IRBuilderNod
} }
implicit def resTy(id: MuID): Type = cascadeLookup(id, bundle.typeNs, globalBundle.typeNs) implicit def resTy(id: MuID): Type = cascadeLookup(id, bundle.typeNs, globalBundle.typeNs)
implicit def resTys(ids: Seq[MuID]): Seq[Type] = ids.map(resTy)
implicit def resSig(id: MuID): FuncSig = cascadeLookup(id, bundle.funcSigNs, globalBundle.funcSigNs) implicit def resSig(id: MuID): FuncSig = cascadeLookup(id, bundle.funcSigNs, globalBundle.funcSigNs)
implicit def resConst(id: MuID): Constant = cascadeLookup(id, bundle.constantNs, globalBundle.constantNs) // used by InstSwitch
def resConst(id: MuID): Constant = cascadeLookup(id, bundle.constantNs, globalBundle.constantNs)
implicit def resGlobalVar(id: MuID): GlobalVariable = cascadeLookup(id, bundle.globalVarNs, globalBundle.globalVarNs) // These auto-resolution may conflict with the resVar method when building instructions. Explicitly enable them in methods.
def resGlobalVar(id: MuID): GlobalVariable = cascadeLookup(id, bundle.globalVarNs, globalBundle.globalVarNs)
implicit def resFunc(id: MuID): Function = cascadeLookup(id, bundle.funcNs, globalBundle.funcNs) def resFunc(id: MuID): Function = cascadeLookup(id, bundle.funcNs, globalBundle.funcNs)
implicit def resConstInt(id: MuID): ConstInt = resConst(id) match { def resConstInt(id: MuID): ConstInt = resGlobalVar(id) match {
case ci: ConstInt => ci case ci: ConstInt => ci
case other => throw new AssertionError("Constant int expected, but %d found. ID: %d".format(other.getClass.getName, id)) case other => throw new AssertionError("Constant int expected, but %d found. ID: %d".format(other.getClass.getName, id))
} }
def needType[E <: Type](id: MuID, expectedType: Class[E], n: String): E = {
val t = resTy(id)
if (!(expectedType.isAssignableFrom(t.getClass))) {
throw new IRBuilderException("Type id:%d name:%s does not match expected type. Expected %s, actually %s.".format(
id, idNameMap.getOrElse(id, "(no name)"), n, t))
}
t.asInstanceOf[E]
}
def needInt(id: MuID) = needType(id, classOf[TypeInt], "int")
def needStruct(id: MuID) = needType(id, classOf[TypeStruct], "struct")
def needAbsStruct(id: MuID) = needType(id, classOf[AbstractStructType], "struct or hybrid")
def needArray(id: MuID) = needType(id, classOf[TypeArray], "array")
def needVector(id: MuID) = needType(id, classOf[TypeVector], "vector")
def needHybrid(id: MuID) = needType(id, classOf[TypeHybrid], "hybrid")
def needSeq(id: MuID) = needType(id, classOf[AbstractSeqType], "array or vector")
def makeBundle(): TrantientBundle = { def makeBundle(): TrantientBundle = {
// Enable auto resolution in this global scope
@inline implicit def _resGlobalVar = resGlobalVar _
@inline implicit def _resFunc = resFunc _
// Classify nodes into categories for phasing. // Classify nodes into categories for phasing.
val typeNodes = new ArrayBuffer[IRTypeNode] val typeNodes = new ArrayBuffer[IRTypeNode]
...@@ -150,35 +174,244 @@ class BundleConstructor(idNameMap: Map[MuID, MuName], nodeList: Seq[IRBuilderNod ...@@ -150,35 +174,244 @@ class BundleConstructor(idNameMap: Map[MuID, MuName], nodeList: Seq[IRBuilderNod
bundle.funcNs.add(muNode) bundle.funcNs.add(muNode)
} }
case NodeExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode) => { case NodeExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode) => {
val muNode = new ExposedFunc(func, callconv, cookie) val muNode = new ExposedFunc(func, callconv, resConstInt(cookie))
setIDAndMaybeName(muNode, id) setIDAndMaybeName(muNode, id)
bundle.expFuncNs.add(muNode) bundle.expFuncNs.add(muNode)
} }
} }
phase2.doAll() phase2.doAll()
// Now all top-level definitions are created and their inter-references are resolved // Now all top-level definitions are created and their inter-references are resolved
// Phase 3: Define all defined functions (.funcdef) // Phase 3: Define all defined functions (.funcdef)
val phase3 = new Later() val phase3 = new Later()
funcVers foreach { irNode => funcVers foreach { irNode =>
val muNode = new FuncVer(irNode.func) val muNode = new FuncVer(irNode.func)
setIDAndMaybeName(muNode, irNode.id) setIDAndMaybeName(muNode, irNode.id)
bundle.funcVerNs.add(muNode) bundle.funcVerNs.add(muNode)
phase3 { () => phase3 { () =>
defineFunction(irNode, muNode) defineFunction(irNode, muNode)
} }
} }
phase3.doAll() phase3.doAll()
bundle bundle
} }
def defineFunction(irNode: NodeFuncVer, muFunc: FuncVer): Unit = { def defineFunction(irNode: NodeFuncVer, muFuncVer: FuncVer): Unit = {
??? val irBBmuBBs = irNode.bbs.map { bbID =>
val irBB = idNodeMap(bbID).asInstanceOf[NodeBB]
val muBB = new BasicBlock(muFuncVer)
setIDAndMaybeName(muBB, bbID)
muFuncVer.bbs += muBB
muFuncVer.bbNs.add(muBB)
(irBB, muBB)
}
for ((irBB, muBB) <- irBBmuBBs) {
for ((norParamID, norParamTyID) <- irBB.norParamIDs zip irBB.norParamTys) {
val muType = resTy(norParamTyID)
val muNorParam = NorParam(muType)
setIDAndMaybeName(muNorParam, norParamID)
muBB.norParams += muNorParam
muBB.localVarNs.add(muNorParam)
}
for (excParamID <- irBB.excParamID) {
val muExcParam = ExcParam()
setIDAndMaybeName(muExcParam, excParamID)
muBB.excParam = Some(muExcParam)
muBB.localVarNs.add(muExcParam)
}
for (instID <- irBB.insts) {
val irInst = idNodeMap(instID).asInstanceOf[IRInstNode]
val muInst = defineInst(muFuncVer, muBB, irInst)
setIDAndMaybeName(muInst, instID)
muBB.insts += muInst
muBB.localInstNs.add(muInst)
}
}
} }
}
\ No newline at end of file def defineInst(muFuncVer: FuncVer, muBB: BasicBlock, irInst: IRInstNode): Instruction = try {
import BundleConstructorImplicitMagics._
implicit val self = this
implicit val bbNs = muFuncVer.bbNs
implicit val localVarNs = muBB.localVarNs
implicit def resVar(id: MuVarNode): SSAVariable = {
localVarNs.get(id).getOrElse {
cascadeLookup(id, bundle.globalVarNs, globalBundle.globalVarNs)
}
}
implicit def resVars(ids: Seq[MuVarNode]): Seq[SSAVariable] = {
ids.map(resVar)
}
// used by keepalives
def resLocalVar(id: MuVarNode): LocalVariable = {
localVarNs.get(id).getOrElse {
throw new IRBuilderException("Local variable id:%d name:%s not found".format(id,
idNameMap.getOrElse(id, "(no name)")))
}
}
@inline
implicit def resBB(id: MuBBNode): BasicBlock = {
bbNs(id)
}
@inline
implicit def resDestClause(id: MuDestClause): DestClause = {
val NodeDestClause(_, dest, vars) = idNodeMap(id).asInstanceOf[NodeDestClause]
DestClause(dest, vars.map(resVar))
}
@inline
implicit def resExcClause(maybeID: Option[MuExcClause]): Option[ExcClause] = maybeID map { id =>
val irExcClause = idNodeMap(id).asInstanceOf[NodeExcClause]
ExcClause(irExcClause.nor, irExcClause.exc)
}
@inline
implicit def resKeepalives(maybeID: Option[MuKeepaliveClause]): Seq[LocalVariable] = maybeID map { id =>
val irKeepaliveClause = idNodeMap(id).asInstanceOf[NodeKeepaliveClause]
irKeepaliveClause.vars.map(resLocalVar)
} getOrElse(Seq())
@inline
implicit def resCurStackClause(id: MuCurStackClause): CurStackAction = {
val irCurStackClause = idNodeMap(id).asInstanceOf[IRCurStackClauseNode]
irCurStackClause match {
case NodeCscRetWith(_, tys) => RetWith(tys)
case NodeCscKillOld(_) => KillOld()
}
}
@inline
implicit def resNewStackClause(id: MuNewStackClause): NewStackAction = {
val irNewStackClause = idNodeMap(id).asInstanceOf[IRNewStackClauseNode]
irNewStackClause match {
case NodeNscPassValues(_, tys, vars) => PassValues(tys, vars)
case NodeNscThrowExc(_, exc) => ThrowExc(exc)
}
}
val muInst: Instruction = irInst match {
case NodeBinOp(id, resultID, optr, ty, opnd1, opnd2, excClause) =>
InstBinOp(optr, ty, opnd1, opnd2, excClause) --> resultID
case NodeCmp(id, resultID, optr, ty, opnd1, opnd2) =>
InstCmp(optr, ty, opnd1, opnd2) --> resultID
case NodeConv(id, resultID, optr, fromTy, toTy, opnd) =>
InstConv(optr, fromTy, toTy, opnd) --> resultID
case NodeSelect(id, resultID, condTy, opndTy, cond, ifTrue, ifFalse) =>
InstSelect(condTy, opndTy, cond, ifTrue, ifFalse) --> resultID
case NodeBranch(id, dest) =>
InstBranch(dest)
case NodeBranch2(id, cond, ifTrue, ifFalse) =>
InstBranch2(cond, ifTrue, ifFalse)
case NodeSwitch(id, opndTy, opnd, defaultDest, cases, dests) => {
val caseDests = for ((c, d) <- cases zip dests) yield {
(resConst(c), resDestClause(d))
}
InstSwitch(opndTy, opnd, defaultDest, ArrayBuffer(caseDests:_*))
}
case NodeCall(id, resultIDs, sig, callee, args, excClause, keepaliveClause) =>
InstCall(sig, callee, args, excClause, keepaliveClause) --> resultIDs
case NodeTailCall(id, sig, callee, args) =>
InstTailCall(sig, callee, args)
case NodeRet(id, rvs) =>
InstRet(muFuncVer, rvs)
case NodeThrow(id, exc) =>
InstThrow(exc)
case NodeExtractValue(id, resultID, strty, index, opnd) =>
InstExtractValue(needStruct(strty), index, opnd) --> resultID
case NodeInsertValue(id, resultID, strty, index, opnd, newval) =>
InstInsertValue(needStruct(strty), index, opnd, newval) --> resultID
case NodeExtractElement(id, resultID, seqty, indty, opnd, index) =>
InstExtractElement(needSeq(seqty), needInt(indty), opnd, index) --> resultID
case NodeInsertElement(id, resultID, seqty, indty, opnd, index, newval) =>
InstInsertElement(needSeq(seqty), needInt(indty), opnd, index, newval) --> resultID
case NodeShuffleVector(id, resultID, vecty, maskty, vec1, vec2, mask) =>
InstShuffleVector(needVector(vecty), needVector(maskty), vec1, vec2, mask) --> resultID
case NodeNew(id, resultID, allocty, excClause) =>
InstNew(allocty, excClause) --> resultID
case NodeNewHybrid(id, resultID, allocty, lenty, length, excClause) =>
InstNewHybrid(needHybrid(allocty), needInt(lenty), length, excClause) --> resultID
case NodeAlloca(id, resultID, allocty, excClause) =>
InstAlloca(allocty, excClause) --> resultID
case NodeAllocaHybrid(id, resultID, allocty, lenty, length, excClause) =>
InstAllocaHybrid(needHybrid(allocty), needInt(lenty), length, excClause) --> resultID
case NodeGetIRef(id, resultID, refty, opnd) =>
InstGetIRef(refty, opnd) --> resultID
case NodeGetFieldIRef(id, resultID, isPtr, refty, index, opnd) =>
InstGetFieldIRef(isPtr, needStruct(refty), index, opnd) --> resultID
case NodeGetElemIRef(id, resultID, isPtr, refty, indty, opnd, index) =>
InstGetElemIRef(isPtr, needSeq(refty), needInt(indty), opnd, index) --> resultID
case NodeShiftIRef(id, resultID, isPtr, refty, offty, opnd, offset) =>
InstShiftIRef(isPtr, refty, needInt(offty), opnd, offset) --> resultID
case NodeGetVarPartIRef(id, resultID, isPtr, refty, opnd) =>
InstGetVarPartIRef(isPtr, needHybrid(refty), opnd) --> resultID
case NodeLoad(id, resultID, isPtr, ord, refty, loc, excClause) =>
InstLoad(isPtr, ord, refty, loc, excClause) --> resultID
case NodeStore(id, isPtr, ord, refty, loc, newval, excClause) =>
InstStore(isPtr, ord, refty, loc, newval, excClause)
case NodeCmpXchg(id, valueResultID, succResultID, isPtr, isWeak, ordSucc, ordFail, refty, loc, expected, desired, excClause) =>
InstCmpXchg(isPtr, isWeak, ordSucc, ordFail, refty, loc, expected, desired, excClause) --> (valueResultID, succResultID)
case NodeAtomicRMW(id, resultID, isPtr, ord, optr, refTy, loc, opnd, excClause) =>
InstAtomicRMW(isPtr, ord, optr, refTy, loc, opnd, excClause) --> resultID
case NodeFence(id, ord) =>
InstFence(ord)
case NodeTrap(id, resultIDs, rettys, excClause, keepaliveClause) =>
InstTrap(rettys, excClause, keepaliveClause) --> resultIDs
case NodeWatchPoint(id, wpid, resultIDs, rettys, dis, ena, exc, keepaliveClause) =>
InstWatchPoint(wpid, rettys, dis, ena, exc.map(resDestClause), keepaliveClause) --> resultIDs
case NodeWPBranch(id, wpid, dis, ena) =>
InstWPBranch(wpid, dis, ena)
case NodeCCall(id, resultIDs, callconv, calleeTy, sig, callee, args, excClause, keepaliveClause) =>
InstCCall(callconv, calleeTy, sig, callee, args, excClause, keepaliveClause) --> resultIDs
case NodeNewThread(id, resultID, stack, threadlocal, newStackClause, excClause) =>
InstNewThread(stack, threadlocal.map(resVar), newStackClause, excClause) --> resultID
case NodeSwapStack(id, resultIDs, swappee, curStackClause, newStackClause, excClause, keepaliveClause) =>
InstSwapStack(swappee, curStackClause, newStackClause, excClause, keepaliveClause) --> resultIDs
case NodeCommInst(id, resultIDs, opcode, flags, tys, sigs, args, excClause, keepaliveClause) =>
InstCommInst(opcode, flags, tys, sigs.map(resSig), args, excClause, keepaliveClause) --> resultIDs
}
muInst
} catch {
case e: Exception => {
throw new IRBuilderException("Exception thrown when building instruction. Func: %s, ver: %s, bb: %s, inst: %d:%s".format(
muFuncVer.func.repr, muFuncVer.repr, muBB.repr, irInst.id, idNameMap.getOrElse(irInst.id, "(no name)")), e)
}
}
}
private object BundleConstructorImplicitMagics {
implicit class AddResultsSeq[T <: Instruction](val inst: T) extends AnyVal {
@inline
def -->(resultIDs: Seq[MuID])(implicit self: BundleConstructor, localVarNs: Namespace[LocalVariable]): T = {
inst-->(resultIDs:_*)
}
}
implicit class AddResultsVarArg[T <: Instruction](val inst: T) extends AnyVal {
@inline
def -->(resultIDs: MuID*)(implicit self: BundleConstructor, localVarNs: Namespace[LocalVariable]): T = {
val instResults = for ((resultID, i) <- resultIDs.zipWithIndex) yield {
val instRes = InstResult(inst, i)
self.setIDAndMaybeName(instRes, resultID)
localVarNs.add(instRes)
instRes
}
inst.results = instResults.toIndexedSeq
inst
}
}
}
...@@ -29,7 +29,7 @@ object IRBuilder { ...@@ -29,7 +29,7 @@ object IRBuilder {
table table
} }
def validateName(name: String): String = { def validateName(name: String): MuName = {
if (name.startsWith("%")) { if (name.startsWith("%")) {
throw new IllegalNameException("Name must be global (starting with '@') when using the IR building API. Found: %s".format(name)) throw new IllegalNameException("Name must be global (starting with '@') when using the IR building API. Found: %s".format(name))
} else if (!name.startsWith("@")) { } else if (!name.startsWith("@")) {
...@@ -62,6 +62,7 @@ trait IRBuilderListener { ...@@ -62,6 +62,7 @@ trait IRBuilderListener {
class IRBuilder(val id: MuInternalID, class IRBuilder(val id: MuInternalID,
globalBundle: GlobalBundle, idFactory: IDFactory, irBuilderListener: Option[IRBuilderListener]) globalBundle: GlobalBundle, idFactory: IDFactory, irBuilderListener: Option[IRBuilderListener])
extends HasID { extends HasID {
import IRBuilder._
import IRBuilderNode._ import IRBuilderNode._
private def nextID(): Int = idFactory.getID() private def nextID(): Int = idFactory.getID()
...@@ -90,7 +91,7 @@ class IRBuilder(val id: MuInternalID, ...@@ -90,7 +91,7 @@ class IRBuilder(val id: MuInternalID,
def genSym(name: Option[String]): MuID = { def genSym(name: Option[String]): MuID = {
val id = nextID() val id = nextID()
name foreach { n => name foreach { n =>
idNameMap(id) = n idNameMap(id) = validateName(n)
} }
id id
} }
...@@ -218,8 +219,8 @@ class IRBuilder(val id: MuInternalID, ...@@ -218,8 +219,8 @@ class IRBuilder(val id: MuInternalID,
val _node = new NodeFuncVer(id, func, bbs) val _node = new NodeFuncVer(id, func, bbs)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newBB(id: MuID, norParamIDs: Seq[MuID], excParamID: Option[MuID], insts: Seq[MuInstNode]): Unit = { def newBB(id: MuID, norParamIDs: Seq[MuID], norParamTys: Seq[MuTypeNode], excParamID: Option[MuID], insts: Seq[MuInstNode]): Unit = {
val _node = new NodeBB(id, norParamIDs, excParamID, insts) val _node = new NodeBB(id, norParamIDs, norParamTys, excParamID, insts)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newDestClause(id: MuID, dest: MuBBNode, vars: Seq[MuVarNode]): Unit = { def newDestClause(id: MuID, dest: MuBBNode, vars: Seq[MuVarNode]): Unit = {
...@@ -250,8 +251,8 @@ class IRBuilder(val id: MuInternalID, ...@@ -250,8 +251,8 @@ class IRBuilder(val id: MuInternalID,
val _node = new NodeNscThrowExc(id, exc) val _node = new NodeNscThrowExc(id, exc)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newBinOp(id: MuID, resultID: MuID, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClaues: Option[MuExcClause]): Unit = { def newBinOp(id: MuID, resultID: MuID, optr: BinOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode, excClause: Option[MuExcClause]): Unit = {
val _node = new NodeBinOp(id, resultID, optr, ty, opnd1, opnd2, excClaues) val _node = new NodeBinOp(id, resultID, optr, ty, opnd1, opnd2, excClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode): Unit = { def newCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode): Unit = {
...@@ -278,8 +279,8 @@ class IRBuilder(val id: MuInternalID, ...@@ -278,8 +279,8 @@ class IRBuilder(val id: MuInternalID,
val _node = new NodeSwitch(id, opndTy, opnd, defaultDest, cases, dests) val _node = new NodeSwitch(id, opndTy, opnd, defaultDest, cases, dests)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newCall(id: MuID, resultIds: Seq[MuID], sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = { def newCall(id: MuID, resultIDs: Seq[MuID], sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeCall(id, resultIds, sig, callee, args, excClause, keepaliveClause) val _node = new NodeCall(id, resultIDs, sig, callee, args, excClause, keepaliveClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newTailCall(id: MuID, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode]): Unit = { def newTailCall(id: MuID, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode]): Unit = {
...@@ -370,32 +371,32 @@ class IRBuilder(val id: MuInternalID, ...@@ -370,32 +371,32 @@ class IRBuilder(val id: MuInternalID,
val _node = new NodeFence(id, ord) val _node = new NodeFence(id, ord)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newTrap(id: MuID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = { def newTrap(id: MuID, resultIDs: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeTrap(id, resultIds, rettys, excClause, keepaliveClause) val _node = new NodeTrap(id, resultIDs, rettys, excClause, keepaliveClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newWatchPoint(id: MuID, wpid: MuWPID, resultIds: Seq[MuID], rettys: Seq[MuTypeNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = { def newWatchPoint(id: MuID, wpid: MuWPID, resultIDs: Seq[MuID], rettys: Seq[MuTypeNode], dis: MuDestClause, ena: MuDestClause, exc: Option[MuDestClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeWatchPoint(id, wpid, resultIds, rettys, excClause, keepaliveClause) val _node = new NodeWatchPoint(id, wpid, resultIDs, rettys, dis, ena, exc, keepaliveClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newWPBranch(id: MuID, wpid: MuWPID): Unit = { def newWPBranch(id: MuID, wpid: MuWPID, dis: MuDestClause, ena: MuDestClause): Unit = {
val _node = new NodeWPBranch(id, wpid) val _node = new NodeWPBranch(id, wpid, dis, ena)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newCCall(id: MuID, resultIds: Seq[MuID], callconv: Flag, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = { def newCCall(id: MuID, resultIDs: Seq[MuID], callconv: Flag, calleeTy: MuTypeNode, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode], excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeCCall(id, resultIds, callconv, calleeTy, sig, callee, args, excClause, keepaliveClause) val _node = new NodeCCall(id, resultIDs, callconv, calleeTy, sig, callee, args, excClause, keepaliveClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newNewThread(id: MuID, resultID: MuID, stack: MuVarNode, threadlocal: Option[MuVarNode], newStackClause: MuNewStackClause, excClause: Option[MuExcClause]): Unit = { def newNewThread(id: MuID, resultID: MuID, stack: MuVarNode, threadlocal: Option[MuVarNode], newStackClause: MuNewStackClause, excClause: Option[MuExcClause]): Unit = {
val _node = new NodeNewThread(id, resultID, stack, threadlocal, newStackClause, excClause) val _node = new NodeNewThread(id, resultID, stack, threadlocal, newStackClause, excClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newSwapStack(id: MuID, resultIds: Seq[MuID], swappee: MuVarNode, curStackClause: MuCurStackClause, newStackClause: MuNewStackClause, excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = { def newSwapStack(id: MuID, resultIDs: Seq[MuID], swappee: MuVarNode, curStackClause: MuCurStackClause, newStackClause: MuNewStackClause, excClause: Option[MuExcClause], keepaliveClause: Option[MuKeepaliveClause]): Unit = {
val _node = new NodeSwapStack(id, resultIds, swappee, curStackClause, newStackClause, excClause, keepaliveClause) val _node = new NodeSwapStack(id, resultIDs, swappee, curStackClause, newStackClause, excClause, keepaliveClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
def newCommInst(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]): Unit = { def newCommInst(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]): Unit = {
val _node = new NodeCommInst(id, resultIds, opcode, flags, tys, sigs, args, excClause, keepaliveClause) val _node = new NodeCommInst(id, resultIDs, opcode, flags, tys, sigs, args, excClause, keepaliveClause)
onNewNodeCreated(_node) onNewNodeCreated(_node)
} }
// GEN:END:IRBUILDERNODE_CONSTRUCTORS // GEN:END:IRBUILDERNODE_CONSTRUCTORS
......
...@@ -47,6 +47,11 @@ abstract class IRTypeNode extends TypeSigLike ...@@ -47,6 +47,11 @@ abstract class IRTypeNode extends TypeSigLike
abstract class IRSigNode extends TypeSigLike abstract class IRSigNode extends TypeSigLike
abstract class IRConstNode extends OtherTopLevelNode abstract class IRConstNode extends OtherTopLevelNode
// Other nodes with refimpl-level superclasses
abstract class IRInstNode extends IRBuilderNode
abstract class IRCurStackClauseNode