-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checking of constant/writable arguments
Fix printing of #inline function calls
- Loading branch information
Showing
9 changed files
with
97 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
fn f(reg ptr u64[1] t) -> reg ptr u64[1] { | ||
t[0] = 1; | ||
return t; | ||
} | ||
|
||
export fn gfail() -> reg u64{ | ||
stack u64[1] s; | ||
reg const ptr u64[1] t; | ||
t = s; | ||
s = f(t); | ||
reg u64 r; | ||
r = s[0]; | ||
return r; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export | ||
fn sum(reg u64 x y) -> reg u64 { | ||
reg u64 z; | ||
z = #LEA(x + y); | ||
return z; | ||
} | ||
|
||
/* Inline call to an export function from an inline function. */ | ||
inline | ||
fn test() -> reg u64 { | ||
reg u64 a; | ||
#inline a = sum(42, 24); | ||
return a; | ||
} | ||
|
||
exec test() |
14 changes: 14 additions & 0 deletions
14
compiler/tests/success/pointers/test_writable_arguments.jazz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
fn f(reg ptr u64[1] t) -> reg ptr u64[1] { | ||
t[0] = 1; | ||
return t; | ||
} | ||
|
||
export fn g() -> reg u64{ | ||
stack u64[1] s; | ||
reg ptr u64[1] t; | ||
t = s; | ||
s = f((0 <= 1) ? t : t); | ||
reg u64 r; | ||
r = s[0]; | ||
return r; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
fn zerofill(reg mut ptr u64[1] x) -> reg ptr u64[1] { | ||
x[0] = 0; | ||
return x; | ||
} | ||
|
||
export | ||
fn main() -> reg u64 { | ||
stack u64[1] s; | ||
s = zerofill(s); | ||
reg u64 r; | ||
r = s[0]; | ||
return r; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters