GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

Commit 7a05f9e1 authored by Kunshan Wang's avatar Kunshan Wang

Updating parser...

parent ed7707c2
......@@ -56,14 +56,14 @@ typeConstructor
;
funcSigConstructor
: retTy=type '(' (paramTy=type*) ')'
: retTy=type '(' (paramTy+=type*) ')'
;
constConstructor
: intLiteral # ConstInt
| floatLiteral # ConstFloat
| doubleLiteral # ConstDouble
| '{' constant* '}' # ConstStruct
| '{' GLOBAL_NAME* '}' # ConstStruct
| 'NULL' # ConstNull
| 'VEC' '{' constant* '}' # ConstVector
;
......@@ -245,9 +245,9 @@ callconv
;
intLiteral
: INT_DEC # DecIntLiteral
| INT_OCT # OctIntLiteral
| INT_HEX # HexIntLiteral
: INT_DEC
| INT_OCT
| INT_HEX
;
floatLiteral
......@@ -276,7 +276,7 @@ INT_DEC
;
INT_OCT
: ('+'|'-')? '0' DIGIT*
: ('+'|'-')? '0' OCT_DIGIT*
;
INT_HEX
......@@ -313,6 +313,11 @@ DIGIT_NON_ZERO
: [1-9]
;
fragment
OCT_DIGIT
: [0-7]
;
fragment
HEX_DIGIT
: [0-9a-fA-F]
......
......@@ -4,12 +4,22 @@ import uvm.types._
import uvm.ssavariables._
class Bundle {
/**
* Namespace of all SSA variables, global or local.
*/
val varNs = new SimpleNamespace[SSAVariable]()
/**
* All global SSA varaibles.
*/
val globalVarNs = new SimpleNamespace[GlobalVariable]()
val typeNs = new SimpleNamespace[Type]()
val funcSigNs = new SimpleNamespace[FuncSig]()
val declConstNs = new SimpleNamespace[DeclaredConstant]()
val globalDataNs = new SimpleNamespace[GlobalData]()
val constantNs = new SimpleNamespace[Constant]()
val globalCellNs = new SimpleNamespace[GlobalCell]()
val funcNs = new SimpleNamespace[Function]()
val globalValueNs = new SimpleNamespace[GlobalValue]()
private def simpleMerge[T <: Identified](oldNs: Namespace[T], newNs: Namespace[T]) {
for (cand <- newNs.all) {
......
......@@ -12,19 +12,20 @@ object FuncSig {
class Function extends GlobalVariable {
var sig: FuncSig = null
var versions: Seq[FuncVersion] = Nil
var versions: List[FuncVer] = Nil
}
/**
* A version of a function. Also known as a "control flow graph".
*/
class FuncVersion extends IdentifiedSettable {
class FuncVer extends IdentifiedSettable {
var func: Function = null
var bbs: Seq[BasicBlock] = null
var entry: BasicBlock = null
var params: Seq[Parameter] = null
val bbNs: Namespace[BasicBlock] = new SimpleNamespace[BasicBlock]
val bbNs: Namespace[BasicBlock] = new SimpleNamespace[BasicBlock]()
val localVarNs: Namespace[LocalVariable] = new SimpleNamespace[LocalVariable]()
}
class BasicBlock extends IdentifiedSettable {
......
package uvm.ir.textinput
class IDFactory(val initialID: Int = 65536) {
private var id: Int = initialID
def getID(): Int = {
val myID = id
id = id + 1
return myID
}
}
\ No newline at end of file
......@@ -24,7 +24,7 @@ class SimpleNamespace[T <: Identified] extends Namespace[T] {
def get(id: Int): Option[T] = idMap.get(id)
def get(name: String): Option[T] = nameMap.get(name)
def add(obj: T): Unit = {
def add(obj: T) {
for (obj2 <- get(obj.id)) {
throw new NameConflictException(
"Object %s ID-conflicts with %s".format(obj.repr, obj2.repr))
......
......@@ -24,15 +24,17 @@ case class ConstStruct(var constTy: Type, var fields: Seq[GlobalVariable]) exten
case class ConstNull(var constTy: Type) extends Constant
case class ConstVector(var constTy: Type, var elems: Seq[Constant]) extends Constant
case class GlobalCell(var cellTy: Type) extends GlobalVariable
// Local variables: Parameters and Instructions
abstract class LocalVariable extends SSAVariable {
var funcVer: FuncVersion = null
var funcVer: FuncVer = null
}
case class Parameter(override var funcVer: FuncVersion, var index: Int) extends LocalVariable
case class Parameter(override var funcVer: FuncVer, var index: Int) extends LocalVariable
// Instructions
......
......@@ -20,7 +20,7 @@ case class TypeIRef(var ty: Type) extends AbstractRefType
case class TypeWeakRef(var ty: Type) extends AbstractRefType
case class TypeStruct(var fieldTy: Seq[Type]) extends Type
case class TypeArray(var elemTy: Type, var len: Long) extends Type
case class TypeHybrid(var fixedPart: Type, var varPart: Type) extends Type
case class TypeHybrid(var fixedTy: Type, var varTy: Type) extends Type
case class TypeVoid() extends Type
case class TypeFunc(var sig: FuncSig) extends Type
case class TypeThread() extends Type
......
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