x64: remove fn arg test for now

pull/4567/head
Alexander Medvednikov 2020-04-23 20:55:18 +02:00
parent ebc41375f1
commit 8cb88d5c9a
4 changed files with 13 additions and 9 deletions

View File

@ -332,6 +332,13 @@ pub fn (mut g Gen) sub32(reg Register, val int) {
g.write32(val)
}
pub fn (mut g Gen) add(reg Register, val int) {
g.write8(0x48)
g.write8(0x81)
g.write8(0xe8 + reg) // TODO rax is different?
g.write32(val)
}
fn (mut g Gen) leave() {
g.write8(0xc9)
}
@ -617,7 +624,7 @@ fn (mut g Gen) fn_decl(node ast.FnDecl) {
// g.write32(SEVENS)
g.push(.rbp)
g.mov_rbp_rsp()
// g.sub32(.rsp, 0x10)
g.sub32(.rsp, 0x20)
}
if node.args.len > 0 {
// g.mov(.r12, 0x77777777)
@ -640,7 +647,9 @@ fn (mut g Gen) fn_decl(node ast.FnDecl) {
// return
}
if !is_main {
g.leave() // g.pop(.rbp)
g.leave()
// g.add(.rsp, 0x20)
// g.pop(.rbp)
}
g.ret()
}

View File

@ -46,6 +46,6 @@ fn args() {
fn main() {
test()
loop()
//loop()
args()
}

View File

@ -6,8 +6,3 @@ hello
hello
hello
hello
===args===
foo
foo(1)
foo(2)
foo

View File

@ -56,6 +56,7 @@ fn test_perform_speak() {
}
*/
}
*/
/*
interface Speak2er {
@ -92,4 +93,3 @@ fn test_register() {
handle_reg(f)
}
*/
*/