Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
llvm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
llvm-watermarker
Commits
088a6bba
Commit
088a6bba
authored
Dec 28, 2018
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rustcの出力するLLVM IRから実行可能ファイルを生成するデモを追加
parent
deca457d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
8 deletions
+56
-8
Makefile
example/Makefile
+8
-8
Makefile
example/fizzbuzz-rs/Makefile
+21
-0
fizzbuzz.rs
example/fizzbuzz-rs/fizzbuzz.rs
+8
-0
probestack.s
example/fizzbuzz-rs/probestack.s
+19
-0
No files found.
example/Makefile
View file @
088a6bba
include
../common.mk
.PHONY
:
all test clean
all
:
${
MAKE
}
-C
fizzbuzz all
${
MAKE
}
-C
8cc all
${
MAKE
}
-C
zlib all
${
MAKE
}
-C
fizzbuzz all
${
MAKE
}
-C
8cc all
${
MAKE
}
-C
zlib all
${
MAKE
}
-C
fizzbuzz-rs all
test
:
${
MAKE
}
-C
fizzbuzz
test
${
MAKE
}
-C
8cc
test
${
MAKE
}
-C
zlib
test
${
MAKE
}
-C
fizzbuzz
test
${
MAKE
}
-C
8cc
test
${
MAKE
}
-C
zlib
test
${
MAKE
}
-C
fizzbuzz-rs
test
example/fizzbuzz-rs/Makefile
0 → 100644
View file @
088a6bba
include
../../common.mk
LDFLAGS
:=
\
-pthread
\
-lbacktrace
\
-ldl
\
-ljemalloc
all
:
${BIN_DIR}/fizzbuzz.out
#
${BIN_DIR}/fizzbuzz-wm.out
${BIN_DIR}/fizzbuzz.out
:
${OBJ_DIR}/fizzbuzz.ll ${OBJ_DIR}/probestack.o
@
mkdir
-p
${
@D
}
clang
-o
$@
$^
${
LDFLAGS
}
${OBJ_DIR}/fizzbuzz.ll
:
fizzbuzz.rs
@
mkdir
-p
${
@D
}
rustc
-O
-Clto
--emit
=
llvm-ir
-o
$@
$<
${OBJ_DIR}/probestack.o
:
probestack.s
@
mkdir
-p
${
@D
}
clang
-o
$@
-c
$<
example/fizzbuzz-rs/fizzbuzz.rs
0 → 100644
View file @
088a6bba
fn
main
()
{
(
1
..=
50
)
.for_each
(|
i
|
match
(
i
%
3
,
i
%
5
)
{
(
0
,
0
)
=>
println!
(
"Fizz Buzz"
),
(
0
,
_
)
=>
println!
(
"Fizz"
),
(
_
,
0
)
=>
println!
(
"Buzz"
),
(
_
,
_
)
=>
println!
(
"{}"
,
i
),
});
}
example/fizzbuzz-rs/probestack.s
0 → 100644
View file @
088a6bba
# To avoid undefined reference to `__rust_probestack`.
# From https://github.com/rust-lang-nursery/compiler-builtins/blob/master/src/probestack.rs
.global __rust_probestack
__rust_probestack:
mov %rax, %r11
cmp $0x1000, %r11
jna 3f
2:
sub $0x1000, %rsp
test %rsp, 8(%rsp)
sub $0x1000, %r11
cmp $0x1000, %r11
ja 2b
3:
sub %r11, %rsp
test %rsp, 8(%rsp)
add %rax, %rsp
ret
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment