-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for x86 64 bit integer stack arguments. (#2007)
* Add support for x86 64 bit integer stack arguments. * Address comments. * Address comments.
- Loading branch information
1 parent
3aa9f31
commit db2b19a
Showing
7 changed files
with
151 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
CC = clang | ||
CFLAGS = -g -frecord-command-line -O0 | ||
|
||
all: test.bc test | ||
|
||
test.bc: test.c | ||
$(CC) $(CFLAGS) -c -emit-llvm $< -o $@ | ||
|
||
test: test.c | ||
$(CC) $< -o $@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f test.bc test | ||
|
Binary file not shown.
Binary file not shown.
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,8 @@ | ||
unsigned long test(unsigned long a, unsigned long b, unsigned long c, unsigned long d,unsigned long e, unsigned long f, unsigned long g, unsigned long h) { | ||
return g - h; | ||
} | ||
|
||
int main() { | ||
return 0; | ||
} | ||
|
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,23 @@ | ||
enable_experimental; | ||
|
||
m <- llvm_load_module "test.bc"; | ||
|
||
// Test a function with more than 6 arguments to ensure that the remaining | ||
// arguments are spilled to the stack on x86-64. | ||
let test_spec = do { | ||
x <- llvm_fresh_var "x" (llvm_int 64); | ||
llvm_execute_func | ||
[ llvm_term {{ 0 : [64] }} | ||
, llvm_term {{ 1 : [64] }} | ||
, llvm_term {{ 2 : [64] }} | ||
, llvm_term {{ 3 : [64] }} | ||
, llvm_term {{ 4 : [64] }} | ||
, llvm_term {{ 5 : [64] }} | ||
, llvm_term x | ||
, llvm_term {{ 1 : [64] }} | ||
]; | ||
llvm_return (llvm_term {{ x - 1 }}); | ||
}; | ||
|
||
llvm_verify_x86 m "./test" "test" [] true test_spec w4; | ||
|
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,9 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
clang -c -emit-llvm -g -frecord-command-line test.c | ||
# clang -c -target x86_64 test.c | ||
# ld.lld -o test test.o | ||
clang -o test test.c | ||
$SAW test.saw | ||
|
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