@@ -46,6 +46,7 @@ public defstruct EBot <: HiEType
4646public defstruct EPackage :
4747 packageio: PackageIO with: (updater => sub-packageio)
4848 exps: Tuple<ETExp> with: (updater => sub-exps)
49+ function-info: False|Tuple<FunctionInfo> with: (default => false, updater => sub-function-info)
4950
5051public defn name (e:EPackage) :
5152 package(packageio(e))
@@ -544,6 +545,10 @@ public defstruct DetupleContext <: CastErrorContext
544545public defstruct GetVarContext <: CastErrorContext
545546public defstruct BranchContext <: CastErrorContext
546547
548+ public defstruct EProfile <: EIns :
549+ id: Int
550+ kind: Int
551+
547552;============================================================
548553;======================= Primitives =========================
549554;============================================================
@@ -761,6 +766,7 @@ defmethod print (o:OutputStream, e:EIns) :
761766 (e:ETypeof) : P $ "goto L%_ when typeof(%_, %_) else L%_" % [n1(e), y(e), type(e), n2(e)]
762767 (e:ECheckFail) : P $ "check-fail(%_) %_ : %_" % [ctxt(e), y(e), type(e)]
763768 (e:ESafepoint) : P $ "safepoint %_ ;%_" % [group-id(e), info?(e)]
769+ (e:EProfile) : P $ "profile(%_,%_)" % [id(e), kind(e)]
764770
765771defmethod print (o:OutputStream, t:CallType) :
766772 print{o, _} $ match(t) :
@@ -1001,6 +1007,7 @@ defsyntax el-ir :
10011007 defrule eins = (?x:#vloc : ?xt:#etype = load ?loc:#eloc) : ELoad(x, xt, loc)
10021008 defrule eins = (?x:#vloc = call ?t:#calltype ?f:#eimm(?ys:#eimm ...)) : ECall(x, f, to-tuple(ys), t, add-base-dir(closest-info()))
10031009 defrule eins = (?x:#vloc = ?y:#eimm) : EDef(x, y)
1010+ defrule eins = (profile(?id:#int, ?arg:#int)) : EProfile(id, arg)
10041011
10051012 defproduction calltype : CallType
10061013 defrule calltype = (guarded((?a1:#etype ...) -> ?a2:#etype)) : CallGuarded(to-tuple(a1), a2)
@@ -1305,7 +1312,7 @@ defmethod map<?T> (f:ELItem -> ELItem, item:ELItem&?T) -> ELItem&T :
13051312 (t:EBot) : t
13061313
13071314 ;EPackage
1308- (e:EPackage) : EPackage(packageio(e), h(exps(e)))
1315+ (e:EPackage) : EPackage(packageio(e), h(exps(e)), function-info(e) )
13091316
13101317 ;ETExps
13111318 (e:EDefGlobal) : EDefGlobal(n(e), h(type(e)), mutable?(e), lostanza?(e))
@@ -1420,6 +1427,9 @@ defmethod map<?T> (f:ELItem -> ELItem, item:ELItem&?T) -> ELItem&T :
14201427 ;Closures
14211428 (e:EClosure) : EClosure(n(e), h(targs(e)), h(ys(e)))
14221429
1430+ ;Profile
1431+ (e:EProfile) : EProfile(id(e), kind(e))
1432+
14231433;============================================================
14241434;===================== Definitions ==========================
14251435;============================================================
@@ -1478,6 +1488,7 @@ public defn varlocs (e:EIns) -> Tuple<EVarLoc> :
14781488 (e:ETypeof) : []
14791489 (e:ECheckFail) : []
14801490 (e:ESafepoint) : []
1491+ (e:EProfile) : []
14811492
14821493;Return the list of immediates that the instruction
14831494;uses to perform its action.
@@ -1532,6 +1543,7 @@ public defn uses (e:EIns) -> Seqable<EImm> :
15321543 (e:ETypeof) : [y(e)]
15331544 (e:ECheckFail) : [y(e)]
15341545 (e:ESafepoint) : []
1546+ (e:EProfile) : []
15351547
15361548;Return the list of immediates that the instruction
15371549;uses to retrieve its location.
0 commit comments