WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

IRBuilder.scala 17.2 KB
Newer Older
1
package uvm.ir.irbuilder
Kunshan Wang's avatar
Kunshan Wang committed
2
3

import scala.collection.mutable.ArrayBuffer
4
import scala.collection.mutable.HashMap
Kunshan Wang's avatar
Kunshan Wang committed
5

Kunshan Wang's avatar
Kunshan Wang committed
6
import uvm._
7
8
9
import uvm.comminsts.CommInst
import uvm.refimpl.MuInternalID
import uvm.refimpl.integerize.HasID
Kunshan Wang's avatar
Kunshan Wang committed
10
11
12
import uvm.ssavariables._
import uvm.types._
import uvm.utils.IDFactory
Kunshan Wang's avatar
Kunshan Wang committed
13

Kunshan Wang's avatar
Kunshan Wang committed
14
object IRBuilder {
Kunshan Wang's avatar
Kunshan Wang committed
15

Kunshan Wang's avatar
Kunshan Wang committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  val validChars = {
    val table = new Array[Boolean](256)
    for (ch <- 'A' to 'Z') { table(ch) = true }
    for (ch <- 'a' to 'z') { table(ch) = true }
    for (ch <- '0' to '9') { table(ch) = true }
    for (ch <- "_-.") { table(ch) = true }
    table
  }

  val validSymbols = {
    val table = new Array[Boolean](256)
    for (ch <- 32 to 126) { table(ch) = true }
    table('"') = false
    table
  }
31

32
  def validateName(name: String): MuName = {
Kunshan Wang's avatar
Kunshan Wang committed
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    if (name.startsWith("%")) {
      throw new IllegalNameException("Name must be global (starting with '@') when using the IR building API. Found: %s".format(name))
    } else if (!name.startsWith("@")) {
      throw new IllegalNameException("Name must start with '@'. Found: %s".format(name))
    } else {
      for (ch <- name.substring(1) if !validChars(ch)) {
        throw new IllegalNameException("'%c' is not a valid character for Mu name. Name: %s".format(ch, name))
      }
    }

    name
  }

  def validateSymbol(sym: String): String = {
    for (ch <- sym if !validSymbols(ch)) {
      throw new IllegalSymbolException("'%c' is not a valid character for external symbol. Symbol: %s".format(ch, sym))
    }

    sym
  }
Kunshan Wang's avatar
Kunshan Wang committed
53

Kunshan Wang's avatar
Kunshan Wang committed
54
55
}

56
57
58
59
60
trait IRBuilderListener {
  def onBundleLoad(irBuilder: IRBuilder, bundle: TrantientBundle): Unit
  def onBundleAbort(irBuilder: IRBuilder): Unit
}

61
/** The client-visible API for constructing Mu IR bundles. */
62
63
64
class IRBuilder(val id: MuInternalID,
    globalBundle: GlobalBundle, idFactory: IDFactory, irBuilderListener: Option[IRBuilderListener])
    extends HasID {
65
  import IRBuilder._
Kunshan Wang's avatar
Kunshan Wang committed
66
  import IRBuilderNode._
Kunshan Wang's avatar
Kunshan Wang committed
67
68

  private def nextID(): Int = idFactory.getID()
69
  
Kunshan Wang's avatar
Kunshan Wang committed
70
71
72
73
74
75
  private val idNameMap = new HashMap[MuID, MuName]()
  private val nodeList = new ArrayBuffer[IRBuilderNode]()
  
  private def onNewNodeCreated(node: IRBuilderNode): Unit = {
    nodeList += node
  }
Kunshan Wang's avatar
Kunshan Wang committed
76
  
77
78
79
80
  def makeBundle(): TrantientBundle = {
    val bc = new BundleConstructor(idNameMap.toMap, nodeList, globalBundle)
    bc.makeBundle()
  }
81
82
83
84
85
  
  def load(): Unit = {
    val trantientBundle = makeBundle()
    irBuilderListener.foreach { l => l.onBundleLoad(this, trantientBundle) }
  }
Kunshan Wang's avatar
Kunshan Wang committed
86
  
87
88
89
90
  def abort(): Unit = {
    irBuilderListener.foreach { l => l.onBundleAbort(this) }
  }

Kunshan Wang's avatar
Kunshan Wang committed
91
92
93
  def genSym(name: Option[String]): MuID = {
    val id = nextID()
    name foreach { n =>
94
      idNameMap(id) = validateName(n)
Kunshan Wang's avatar
Kunshan Wang committed
95
96
    }
    id
Kunshan Wang's avatar
Kunshan Wang committed
97
98
  }
  
99
100
  // The following functions are generated from irBuilderNodes.scala by /migrate_scripts/irbuildernodestoirbuildermethods.py
  
Kunshan Wang's avatar
Kunshan Wang committed
101
102
103
104
  // GEN:BEGIN:IRBUILDERNODE_CONSTRUCTORS
  def newTypeInt(id: MuID, len: Int): Unit = {
    val _node = new NodeTypeInt(id, len)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
105
  }
Kunshan Wang's avatar
Kunshan Wang committed
106
107
108
  def newTypeFloat(id: MuID): Unit = {
    val _node = new NodeTypeFloat(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
109
  }
Kunshan Wang's avatar
Kunshan Wang committed
110
111
112
  def newTypeDouble(id: MuID): Unit = {
    val _node = new NodeTypeDouble(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
113
  }
Kunshan Wang's avatar
Kunshan Wang committed
114
115
116
  def newTypeUPtr(id: MuID, ty: MuTypeNode): Unit = {
    val _node = new NodeTypeUPtr(id, ty)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
117
  }
Kunshan Wang's avatar
Kunshan Wang committed
118
119
120
  def newTypeUFuncPtr(id: MuID, sig: MuFuncSigNode): Unit = {
    val _node = new NodeTypeUFuncPtr(id, sig)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
121
  }
Kunshan Wang's avatar
Kunshan Wang committed
122
123
124
  def newTypeStruct(id: MuID, fieldTys: Seq[MuTypeNode]): Unit = {
    val _node = new NodeTypeStruct(id, fieldTys)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
125
  }
Kunshan Wang's avatar
Kunshan Wang committed
126
127
128
  def newTypeHybrid(id: MuID, fixedTys: Seq[MuTypeNode], varTy: MuTypeNode): Unit = {
    val _node = new NodeTypeHybrid(id, fixedTys, varTy)
    onNewNodeCreated(_node)
129
  }
Kunshan Wang's avatar
Kunshan Wang committed
130
131
132
  def newTypeArray(id: MuID, elemTy: MuTypeNode, len: Long): Unit = {
    val _node = new NodeTypeArray(id, elemTy, len)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
133
  }
Kunshan Wang's avatar
Kunshan Wang committed
134
135
136
  def newTypeVector(id: MuID, elemTy: MuTypeNode, len: Long): Unit = {
    val _node = new NodeTypeVector(id, elemTy, len)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
137
  }
Kunshan Wang's avatar
Kunshan Wang committed
138
139
140
  def newTypeVoid(id: MuID): Unit = {
    val _node = new NodeTypeVoid(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
141
  }
Kunshan Wang's avatar
Kunshan Wang committed
142
143
144
  def newTypeRef(id: MuID, ty: MuTypeNode): Unit = {
    val _node = new NodeTypeRef(id, ty)
    onNewNodeCreated(_node)
145
  }
Kunshan Wang's avatar
Kunshan Wang committed
146
147
148
  def newTypeIRef(id: MuID, ty: MuTypeNode): Unit = {
    val _node = new NodeTypeIRef(id, ty)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
149
  }
Kunshan Wang's avatar
Kunshan Wang committed
150
151
152
  def newTypeWeakRef(id: MuID, ty: MuTypeNode): Unit = {
    val _node = new NodeTypeWeakRef(id, ty)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
153
  }
Kunshan Wang's avatar
Kunshan Wang committed
154
155
156
  def newTypeFuncRef(id: MuID, sig: MuFuncSigNode): Unit = {
    val _node = new NodeTypeFuncRef(id, sig)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
157
  }
Kunshan Wang's avatar
Kunshan Wang committed
158
159
160
  def newTypeTagRef64(id: MuID): Unit = {
    val _node = new NodeTypeTagRef64(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
161
  }
Kunshan Wang's avatar
Kunshan Wang committed
162
163
164
  def newTypeThreadRef(id: MuID): Unit = {
    val _node = new NodeTypeThreadRef(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
165
  }
Kunshan Wang's avatar
Kunshan Wang committed
166
167
168
  def newTypeStackRef(id: MuID): Unit = {
    val _node = new NodeTypeStackRef(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
169
  }
Kunshan Wang's avatar
Kunshan Wang committed
170
171
172
  def newTypeFrameCursorRef(id: MuID): Unit = {
    val _node = new NodeTypeFrameCursorRef(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
173
  }
Kunshan Wang's avatar
Kunshan Wang committed
174
175
176
  def newTypeIRBuilderRef(id: MuID): Unit = {
    val _node = new NodeTypeIRBuilderRef(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
177
  }
Kunshan Wang's avatar
Kunshan Wang committed
178
179
180
  def newFuncSig(id: MuID, paramTys: Seq[MuTypeNode], retTys: Seq[MuTypeNode]): Unit = {
    val _node = new NodeFuncSig(id, paramTys, retTys)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
181
  }
Kunshan Wang's avatar
Kunshan Wang committed
182
183
184
  def newConstInt(id: MuID, ty: MuTypeNode, value: BigInt): Unit = {
    val _node = new NodeConstInt(id, ty, value)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
185
  }
Kunshan Wang's avatar
Kunshan Wang committed
186
187
188
  def newConstFloat(id: MuID, ty: MuTypeNode, value: Float): Unit = {
    val _node = new NodeConstFloat(id, ty, value)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
189
  }
Kunshan Wang's avatar
Kunshan Wang committed
190
191
192
  def newConstDouble(id: MuID, ty: MuTypeNode, value: Double): Unit = {
    val _node = new NodeConstDouble(id, ty, value)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
193
  }
Kunshan Wang's avatar
Kunshan Wang committed
194
195
196
  def newConstNull(id: MuID, ty: MuTypeNode): Unit = {
    val _node = new NodeConstNull(id, ty)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
197
  }
Kunshan Wang's avatar
Kunshan Wang committed
198
199
200
  def newConstSeq(id: MuID, ty: MuTypeNode, elems: Seq[MuGlobalVarNode]): Unit = {
    val _node = new NodeConstSeq(id, ty, elems)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
201
  }
Kunshan Wang's avatar
Kunshan Wang committed
202
203
204
  def newConstExtern(id: MuID, ty: MuTypeNode, symbol: String): Unit = {
    val _node = new NodeConstExtern(id, ty, symbol)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
205
  }
Kunshan Wang's avatar
Kunshan Wang committed
206
207
208
  def newGlobalCell(id: MuID, ty: MuTypeNode): Unit = {
    val _node = new NodeGlobalCell(id, ty)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
209
  }
Kunshan Wang's avatar
Kunshan Wang committed
210
211
212
  def newFunc(id: MuID, sig: MuFuncSigNode): Unit = {
    val _node = new NodeFunc(id, sig)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
213
  }
Kunshan Wang's avatar
Kunshan Wang committed
214
  def newExpFunc(id: MuID, func: MuFuncNode, callconv: Flag, cookie: MuConstIntNode): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
215
216
    val _node = new NodeExpFunc(id, func, callconv, cookie)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
217
  }
Kunshan Wang's avatar
Kunshan Wang committed
218
219
220
  def newFuncVer(id: MuID, func: MuFuncNode, bbs: Seq[MuBBNode]): Unit = {
    val _node = new NodeFuncVer(id, func, bbs)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
221
  }
222
223
  def newBB(id: MuID, norParamIDs: Seq[MuID], norParamTys: Seq[MuTypeNode], excParamID: Option[MuID], insts: Seq[MuInstNode]): Unit = {
    val _node = new NodeBB(id, norParamIDs, norParamTys, excParamID, insts)
Kunshan Wang's avatar
Kunshan Wang committed
224
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
225
  }
Kunshan Wang's avatar
Kunshan Wang committed
226
227
228
  def newDestClause(id: MuID, dest: MuBBNode, vars: Seq[MuVarNode]): Unit = {
    val _node = new NodeDestClause(id, dest, vars)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
229
  }
Kunshan Wang's avatar
Kunshan Wang committed
230
231
232
  def newExcClause(id: MuID, nor: MuDestClause, exc: MuDestClause): Unit = {
    val _node = new NodeExcClause(id, nor, exc)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
233
  }
Kunshan Wang's avatar
Kunshan Wang committed
234
235
  def newKeepaliveClause(id: MuID, vars: Seq[MuLocalVarNode]): Unit = {
    val _node = new NodeKeepaliveClause(id, vars)
Kunshan Wang's avatar
Kunshan Wang committed
236
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
237
  }
Kunshan Wang's avatar
Kunshan Wang committed
238
239
240
  def newCscRetWith(id: MuID, rettys: Seq[MuVarNode]): Unit = {
    val _node = new NodeCscRetWith(id, rettys)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
241
  }
Kunshan Wang's avatar
Kunshan Wang committed
242
243
244
  def newCscKillOld(id: MuID): Unit = {
    val _node = new NodeCscKillOld(id)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
245
  }
Kunshan Wang's avatar
Kunshan Wang committed
246
247
248
  def newNscPassValues(id: MuID, tys: Seq[MuTypeNode], vars: Seq[MuVarNode]): Unit = {
    val _node = new NodeNscPassValues(id, tys, vars)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
249
  }
Kunshan Wang's avatar
Kunshan Wang committed
250
251
252
  def newNscThrowExc(id: MuID, exc: MuVarNode): Unit = {
    val _node = new NodeNscThrowExc(id, exc)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
253
  }
254
255
  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, excClause)
Kunshan Wang's avatar
Kunshan Wang committed
256
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
257
  }
Kunshan Wang's avatar
Kunshan Wang committed
258
  def newCmp(id: MuID, resultID: MuID, optr: CmpOptr.Value, ty: MuTypeNode, opnd1: MuVarNode, opnd2: MuVarNode): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
259
260
    val _node = new NodeCmp(id, resultID, optr, ty, opnd1, opnd2)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
261
  }
Kunshan Wang's avatar
Kunshan Wang committed
262
  def newConv(id: MuID, resultID: MuID, optr: ConvOptr.Value, fromTy: MuTypeNode, toTy: MuTypeNode, opnd: MuVarNode): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
263
264
    val _node = new NodeConv(id, resultID, optr, fromTy, toTy, opnd)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
265
  }
Kunshan Wang's avatar
Kunshan Wang committed
266
267
268
  def newSelect(id: MuID, resultID: MuID, condTy: MuTypeNode, opndTy: MuTypeNode, cond: MuVarNode, ifTrue: MuVarNode, ifFalse: MuVarNode): Unit = {
    val _node = new NodeSelect(id, resultID, condTy, opndTy, cond, ifTrue, ifFalse)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
269
  }
Kunshan Wang's avatar
Kunshan Wang committed
270
271
272
  def newBranch(id: MuID, dest: MuDestClause): Unit = {
    val _node = new NodeBranch(id, dest)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
273
  }
Kunshan Wang's avatar
Kunshan Wang committed
274
275
276
  def newBranch2(id: MuID, cond: MuVarNode, ifTrue: MuDestClause, ifFalse: MuDestClause): Unit = {
    val _node = new NodeBranch2(id, cond, ifTrue, ifFalse)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
277
  }
Kunshan Wang's avatar
Kunshan Wang committed
278
279
280
  def newSwitch(id: MuID, opndTy: MuTypeNode, opnd: MuVarNode, defaultDest: MuDestClause, cases: Seq[MuConstNode], dests: Seq[MuDestClause]): Unit = {
    val _node = new NodeSwitch(id, opndTy, opnd, defaultDest, cases, dests)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
281
  }
282
283
  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)
Kunshan Wang's avatar
Kunshan Wang committed
284
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
285
  }
Kunshan Wang's avatar
Kunshan Wang committed
286
287
288
  def newTailCall(id: MuID, sig: MuFuncSigNode, callee: MuVarNode, args: Seq[MuVarNode]): Unit = {
    val _node = new NodeTailCall(id, sig, callee, args)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
289
  }
Kunshan Wang's avatar
Kunshan Wang committed
290
291
292
  def newRet(id: MuID, rvs: Seq[MuVarNode]): Unit = {
    val _node = new NodeRet(id, rvs)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
293
  }
Kunshan Wang's avatar
Kunshan Wang committed
294
295
296
  def newThrow(id: MuID, exc: MuVarNode): Unit = {
    val _node = new NodeThrow(id, exc)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
297
  }
Kunshan Wang's avatar
Kunshan Wang committed
298
299
300
  def newExtractValue(id: MuID, resultID: MuID, strty: MuTypeNode, index: Int, opnd: MuVarNode): Unit = {
    val _node = new NodeExtractValue(id, resultID, strty, index, opnd)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
301
  }
Kunshan Wang's avatar
Kunshan Wang committed
302
303
304
  def newInsertValue(id: MuID, resultID: MuID, strty: MuTypeNode, index: Int, opnd: MuVarNode, newval: MuVarNode): Unit = {
    val _node = new NodeInsertValue(id, resultID, strty, index, opnd, newval)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
305
  }
Kunshan Wang's avatar
Kunshan Wang committed
306
307
308
  def newExtractElement(id: MuID, resultID: MuID, seqty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode): Unit = {
    val _node = new NodeExtractElement(id, resultID, seqty, indty, opnd, index)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
309
  }
Kunshan Wang's avatar
Kunshan Wang committed
310
311
312
  def newInsertElement(id: MuID, resultID: MuID, seqty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode, newval: MuVarNode): Unit = {
    val _node = new NodeInsertElement(id, resultID, seqty, indty, opnd, index, newval)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
313
  }
Kunshan Wang's avatar
Kunshan Wang committed
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
  def newShuffleVector(id: MuID, resultID: MuID, vecty: MuTypeNode, maskty: MuTypeNode, vec1: MuVarNode, vec2: MuVarNode, mask: MuVarNode): Unit = {
    val _node = new NodeShuffleVector(id, resultID, vecty, maskty, vec1, vec2, mask)
    onNewNodeCreated(_node)
  }
  def newNew(id: MuID, resultID: MuID, allocty: MuTypeNode, excClause: Option[MuExcClause]): Unit = {
    val _node = new NodeNew(id, resultID, allocty, excClause)
    onNewNodeCreated(_node)
  }
  def newNewHybrid(id: MuID, resultID: MuID, allocty: MuTypeNode, lenty: MuTypeNode, length: MuVarNode, excClause: Option[MuExcClause]): Unit = {
    val _node = new NodeNewHybrid(id, resultID, allocty, lenty, length, excClause)
    onNewNodeCreated(_node)
  }
  def newAlloca(id: MuID, resultID: MuID, allocty: MuTypeNode, excClause: Option[MuExcClause]): Unit = {
    val _node = new NodeAlloca(id, resultID, allocty, excClause)
    onNewNodeCreated(_node)
  }
  def newAllocaHybrid(id: MuID, resultID: MuID, allocty: MuTypeNode, lenty: MuTypeNode, length: MuVarNode, excClause: Option[MuExcClause]): Unit = {
    val _node = new NodeAllocaHybrid(id, resultID, allocty, lenty, length, excClause)
    onNewNodeCreated(_node)
  }
  def newGetIRef(id: MuID, resultID: MuID, refty: MuTypeNode, opnd: MuVarNode): Unit = {
    val _node = new NodeGetIRef(id, resultID, refty, opnd)
    onNewNodeCreated(_node)
  }
  def newGetFieldIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, index: Int, opnd: MuVarNode): Unit = {
    val _node = new NodeGetFieldIRef(id, resultID, isPtr, refty, index, opnd)
    onNewNodeCreated(_node)
  }
  def newGetElemIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, indty: MuTypeNode, opnd: MuVarNode, index: MuVarNode): Unit = {
    val _node = new NodeGetElemIRef(id, resultID, isPtr, refty, indty, opnd, index)
    onNewNodeCreated(_node)
  }
  def newShiftIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, offty: MuTypeNode, opnd: MuVarNode, offset: MuVarNode): Unit = {
    val _node = new NodeShiftIRef(id, resultID, isPtr, refty, offty, opnd, offset)
    onNewNodeCreated(_node)
  }
  def newGetVarPartIRef(id: MuID, resultID: MuID, isPtr: Boolean, refty: MuTypeNode, opnd: MuVarNode): Unit = {
    val _node = new NodeGetVarPartIRef(id, resultID, isPtr, refty, opnd)
    onNewNodeCreated(_node)
  }
Kunshan Wang's avatar
Kunshan Wang committed
354
  def newLoad(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, excClause: Option[MuExcClause]): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
355
356
    val _node = new NodeLoad(id, resultID, isPtr, ord, refty, loc, excClause)
    onNewNodeCreated(_node)
Kunshan Wang's avatar
Kunshan Wang committed
357
  }
Kunshan Wang's avatar
Kunshan Wang committed
358
  def newStore(id: MuID, isPtr: Boolean, ord: MemoryOrder.Value, refty: MuTypeNode, loc: MuVarNode, newval: MuVarNode, excClause: Option[MuExcClause]): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
359
360
361
    val _node = new NodeStore(id, isPtr, ord, refty, loc, newval, excClause)
    onNewNodeCreated(_node)
  }
Kunshan Wang's avatar
Kunshan Wang committed
362
  def newCmpXchg(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]): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
363
364
365
    val _node = new NodeCmpXchg(id, valueResultID, succResultID, isPtr, isWeak, ordSucc, ordFail, refty, loc, expected, desired, excClause)
    onNewNodeCreated(_node)
  }
Kunshan Wang's avatar
Kunshan Wang committed
366
  def newAtomicRMW(id: MuID, resultID: MuID, isPtr: Boolean, ord: MemoryOrder.Value, optr: AtomicRMWOptr.Value, refTy: MuTypeNode, loc: MuVarNode, opnd: MuVarNode, excClause: Option[MuExcClause]): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
367
368
369
    val _node = new NodeAtomicRMW(id, resultID, isPtr, ord, optr, refTy, loc, opnd, excClause)
    onNewNodeCreated(_node)
  }
Kunshan Wang's avatar
Kunshan Wang committed
370
  def newFence(id: MuID, ord: MemoryOrder.Value): Unit = {
Kunshan Wang's avatar
Kunshan Wang committed
371
372
373
    val _node = new NodeFence(id, ord)
    onNewNodeCreated(_node)
  }
374
375
  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)
Kunshan Wang's avatar
Kunshan Wang committed
376
377
    onNewNodeCreated(_node)
  }
378
379
  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, dis, ena, exc, keepaliveClause)
Kunshan Wang's avatar
Kunshan Wang committed
380
381
    onNewNodeCreated(_node)
  }
382
383
  def newWPBranch(id: MuID, wpid: MuWPID, dis: MuDestClause, ena: MuDestClause): Unit = {
    val _node = new NodeWPBranch(id, wpid, dis, ena)
Kunshan Wang's avatar
Kunshan Wang committed
384
385
    onNewNodeCreated(_node)
  }
386
387
  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)
Kunshan Wang's avatar
Kunshan Wang committed
388
389
390
391
392
393
    onNewNodeCreated(_node)
  }
  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)
    onNewNodeCreated(_node)
  }
394
395
  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)
Kunshan Wang's avatar
Kunshan Wang committed
396
397
    onNewNodeCreated(_node)
  }
398
399
  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)
Kunshan Wang's avatar
Kunshan Wang committed
400
401
402
    onNewNodeCreated(_node)
  }
  // GEN:END:IRBUILDERNODE_CONSTRUCTORS
Kunshan Wang's avatar
Kunshan Wang committed
403

404
  // SCRIPT: END HERE
Kunshan Wang's avatar
Kunshan Wang committed
405
}