Skip to content

Commit 4ebf028

Browse files
committed
Support parameters with local symbols to fix #3
Works with Apple clang version 13.1.6 (clang-1316.0.21.2)
1 parent 595a07d commit 4ebf028

File tree

5 files changed

+1983
-1958
lines changed

5 files changed

+1983
-1958
lines changed

Iril/Compilation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,10 +2213,10 @@ public void WriteAssembly (string path)
22132213
if (hasEntryPoint) {
22142214
var text = @"{
22152215
""runtimeOptions"": {
2216-
""tfm"": ""netcoreapp2.1"",
2216+
""tfm"": ""net6.0"",
22172217
""framework"": {
22182218
""name"": ""Microsoft.NETCore.App"",
2219-
""version"": ""2.1.0""
2219+
""version"": ""6.0.0""
22202220
}
22212221
}
22222222
}

Iril/IR/FunctionDefinition.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public enum ParameterAttributes
122122
NoAlias = 1 << 10,
123123
Align8 = 1 << 11,
124124
Byval = 1 << 12,
125+
NoUndef = 1 << 13,
125126
}
126127

127128
public class FunctionDeclaration

Iril/IR/IR.jay

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ namespace Iril.IR
4040
%token FCMP OEQ OGT OGE OLT OLE ONE ORD UEQ UNE UNO
4141
%token PHI SELECT CALL TAIL VA_ARG ASM SIDEEFFECT
4242
%token LANDINGPAD CATCH CATCHPAD CLEANUPPAD
43+
%token NOUNDEF
4344

4445
%start module
4546

@@ -532,10 +533,18 @@ parameter
532533
{
533534
$$ = new Parameter (LocalSymbol.None, (LType)$1);
534535
}
536+
| type LOCAL_SYMBOL
537+
{
538+
$$ = new Parameter ((LocalSymbol)$2, (LType)$1);
539+
}
535540
| type parameter_attributes
536541
{
537542
$$ = new Parameter (LocalSymbol.None, (LType)$1);
538543
}
544+
| type parameter_attributes LOCAL_SYMBOL
545+
{
546+
$$ = new Parameter ((LocalSymbol)$3, (LType)$1);
547+
}
539548
| METADATA
540549
{
541550
$$ = new Parameter (LocalSymbol.None, IntegerType.I32);
@@ -557,6 +566,7 @@ parameter_attributes
557566
parameter_attribute
558567
: NONNULL { $$ = ParameterAttributes.NonNull; }
559568
| NOCAPTURE { $$ = ParameterAttributes.NoCapture; }
569+
| NOUNDEF { $$ = ParameterAttributes.NoUndef; }
560570
| READONLY { $$ = ParameterAttributes.ReadOnly; }
561571
| WRITEONLY { $$ = ParameterAttributes.WriteOnly; }
562572
| READNONE { $$ = ParameterAttributes.ReadNone; }

Iril/IR/Lexer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class MultiCharToken
6565
{ Symbol.Intern ("phi"), Token.PHI },
6666
{ Symbol.Intern ("ret"), Token.RET },
6767
{ Symbol.Intern ("nocapture"), Token.NOCAPTURE },
68+
{ Symbol.Intern ("noundef"), Token.NOUNDEF },
6869
{ Symbol.Intern ("writeonly"), Token.WRITEONLY },
6970
{ Symbol.Intern ("readonly"), Token.READONLY },
7071
{ Symbol.Intern ("attributes"), Token.ATTRIBUTES },

0 commit comments

Comments
 (0)