Skip to content

Commit

Permalink
Add [isDynamic] and [isStatic] built-ins; Sort built-ins
Browse files Browse the repository at this point in the history
  • Loading branch information
MatwayBurkow committed Jan 11, 2021
1 parent 4ca248d commit 408381a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
52 changes: 33 additions & 19 deletions builtinImpl.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,13 @@ staticityOfBinResult: [
] when
] "mplBuiltinIsConst" @declareBuiltin ucall

[
refToVar: @processor @block pop;
processor compilable [
refToVar staticityOfVar Dynamic = makeValuePair VarCond @processor @block createVariable Static @processor @block makeStaticity @processor @block createPlainIR @block push
] when
] "mplBuiltinIsDynamic" @declareBuiltin ucall

[
refToVar: @processor @block pop;
processor compilable [
Expand All @@ -1371,6 +1378,13 @@ staticityOfBinResult: [
] when
] "mplBuiltinIsMoved" @declareBuiltin ucall

[
refToVar: @processor @block pop;
processor compilable [
refToVar staticityOfVar Static = makeValuePair VarCond @processor @block createVariable Static @processor @block makeStaticity @processor @block createPlainIR @block push
] when
] "mplBuiltinIsStatic" @declareBuiltin ucall

[
TRUE dynamic @processor.@usedFloatBuiltins set
[a:; a getVar.data.getTag VarReal32 = ["@llvm.log.f32" makeStringView]["@llvm.log.f64" makeStringView] if
Expand Down Expand Up @@ -1508,6 +1522,19 @@ staticityOfBinResult: [
VarCond VarNatX 1 + [a2:; a1:; "or" makeStringView] [or] [copy] [y:; x:;] mplNumberBinaryOp
] "mplBuiltinOr" @declareBuiltin ucall

[
block.nextLabelIsOverload ["duplicate overload specifier" @processor block compilerError] when
TRUE @block.@nextLabelIsOverload set
] "mplBuiltinOverload" @declareBuiltin ucall

[
debugMemory [
("compilerMaxAllocationSize=" getMemoryMetrics.memoryMaxAllocationSize LF) printList
] [
("compilerMaxAllocationSize is unknown, use -debugMemory flag" LF) printList
] uif
] "mplPrintCompilerMaxAllocationSize" @declareBuiltin ucall

[
refToName: @processor @block pop;
processor compilable [
Expand All @@ -1523,12 +1550,8 @@ staticityOfBinResult: [
] "mplBuiltinPrintCompilerMessage" @declareBuiltin ucall

[
@processor block defaultPrintStack
] "mplBuiltinPrintStack" @declareBuiltin ucall

[
@processor block defaultPrintStackTrace
] "mplBuiltinPrintStackTrace" @declareBuiltin ucall
block.astArrayIndex @processor @block printAstArrayTree
] "mplBuiltinPrintMatchingTree" @declareBuiltin ucall

[
("Print shadow events for block " block.id " in astNode " block.astArrayIndex LF) printList
Expand All @@ -1539,16 +1562,12 @@ staticityOfBinResult: [
] "mplBuiltinPrintShadowEvents" @declareBuiltin ucall

[
block.astArrayIndex @processor @block printAstArrayTree
] "mplBuiltinPrintMatchingTree" @declareBuiltin ucall
@processor block defaultPrintStack
] "mplBuiltinPrintStack" @declareBuiltin ucall

[
debugMemory [
("compilerMaxAllocationSize=" getMemoryMetrics.memoryMaxAllocationSize LF) printList
] [
("compilerMaxAllocationSize is unknown, use -debugMemory flag" LF) printList
] uif
] "mplPrintCompilerMaxAllocationSize" @declareBuiltin ucall
@processor block defaultPrintStackTrace
] "mplBuiltinPrintStackTrace" @declareBuiltin ucall

[
refToName: @processor @block pop;
Expand Down Expand Up @@ -1995,11 +2014,6 @@ tryFindInPath: [
TRUE @block.@nextLabelIsVirtual set
] "mplBuiltinVirtual" @declareBuiltin ucall

[
block.nextLabelIsOverload ["duplicate overload specifier" @processor block compilerError] when
TRUE @block.@nextLabelIsOverload set
] "mplBuiltinOverload" @declareBuiltin ucall

[
VarCond VarNatX 1 + [a2:; a1:; "xor" makeStringView] [xor] [copy] [y:; x:;] mplNumberBinaryOp
] "mplBuiltinXor" @declareBuiltin ucall
Expand Down
4 changes: 3 additions & 1 deletion builtins.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ builtins: (
{name: "fieldIndex" ; impl: @mplBuiltinFieldIndex ;}
{name: "fieldName" ; impl: @mplBuiltinFieldName ;}
{name: "floor" ; impl: @mplBuiltinFloor ;}
{name: "printCompilerMaxAllocationSize"; impl: @mplPrintCompilerMaxAllocationSize ;}
{name: "getCallTrace" ; impl: @mplBuiltinGetCallTrace ;}
{name: "has" ; impl: @mplBuiltinHas ;}
{name: "if" ; impl: @mplBuiltinIf ;}
Expand All @@ -60,7 +59,9 @@ builtins: (
{name: "is" ; impl: @mplBuiltinIs ;}
{name: "isCombined" ; impl: @mplBuiltinIsCombined ;}
{name: "isConst" ; impl: @mplBuiltinIsConst ;}
{name: "isDynamic" ; impl: @mplBuiltinIsDynamic ;}
{name: "isMoved" ; impl: @mplBuiltinIsMoved ;}
{name: "isStatic" ; impl: @mplBuiltinIsStatic ;}
{name: "log" ; impl: @mplBuiltinLog ;}
{name: "log10" ; impl: @mplBuiltinLog10 ;}
{name: "loop" ; impl: @mplBuiltinLoop ;}
Expand All @@ -74,6 +75,7 @@ builtins: (
{name: "newVarOfTheSameType" ; impl: @mplBuiltinNewVarOfTheSameType ;}
{name: "or" ; impl: @mplBuiltinOr ;}
{name: "overload" ; impl: @mplBuiltinOverload ;}
{name: "printCompilerMaxAllocationSize"; impl: @mplPrintCompilerMaxAllocationSize ;}
{name: "printCompilerMessage" ; impl: @mplBuiltinPrintCompilerMessage ;}
{name: "printMatchingTree" ; impl: @mplBuiltinPrintMatchingTree ;}
{name: "printShadowEvents" ; impl: @mplBuiltinPrintShadowEvents ;}
Expand Down

0 comments on commit 408381a

Please sign in to comment.