GitLab will be upgraded on 30 Jan 2023 from 2.00 pm (AEDT) to 3.00 pm (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.

controlFlow.scala 876 Bytes
Newer Older
Kunshan Wang's avatar
Kunshan Wang committed
1
2
3
package uvm

import uvm.types._
Kunshan Wang's avatar
Kunshan Wang committed
4
import uvm.ssavariables._
Kunshan Wang's avatar
Kunshan Wang committed
5
6
7
8
9
10
11
12

case class FuncSig(var retTy: Type, var paramTy: Seq[Type]) extends IdentifiedSettable

object FuncSig {
  def prettyPrint(sig: FuncSig): String =
    "%s (%s)".format(sig.retTy.repr, sig.paramTy.map(_.repr).mkString(" "))
}

Kunshan Wang's avatar
Kunshan Wang committed
13
class Function extends GlobalVariable {
Kunshan Wang's avatar
Kunshan Wang committed
14
  var sig: FuncSig = null
Kunshan Wang's avatar
Kunshan Wang committed
15
  var versions: List[FuncVer] = Nil
Kunshan Wang's avatar
Kunshan Wang committed
16
17
}

Kunshan Wang's avatar
Kunshan Wang committed
18
19
20
/**
 * A version of a function. Also known as a "control flow graph".
 */
Kunshan Wang's avatar
Kunshan Wang committed
21
class FuncVer extends IdentifiedSettable {
Kunshan Wang's avatar
Kunshan Wang committed
22
  var func: Function = null
Kunshan Wang's avatar
Kunshan Wang committed
23
  var bbs: Seq[BasicBlock] = null
Kunshan Wang's avatar
Kunshan Wang committed
24
  var entry: BasicBlock = null
Kunshan Wang's avatar
Kunshan Wang committed
25
26
  var params: Seq[Parameter] = null

Kunshan Wang's avatar
Kunshan Wang committed
27
28
  val bbNs: Namespace[BasicBlock] = new SimpleNamespace[BasicBlock]()
  val localVarNs: Namespace[LocalVariable] = new SimpleNamespace[LocalVariable]()
Kunshan Wang's avatar
Kunshan Wang committed
29
30
31
}

class BasicBlock extends IdentifiedSettable {
Kunshan Wang's avatar
Kunshan Wang committed
32
  var insts: Seq[Instruction] = null
Kunshan Wang's avatar
Kunshan Wang committed
33
}