Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b4422cca
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b4422cca
编写于
4月 07, 2011
作者:
R
Rafael Ávila de Espíndola
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a -O option and change the Makefile to use it.
上级
ddf96ac3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
11 deletion
+17
-11
Makefile.in
Makefile.in
+1
-1
src/comp/driver/rustc.rs
src/comp/driver/rustc.rs
+11
-5
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+5
-5
未找到文件。
Makefile.in
浏览文件 @
b4422cca
...
...
@@ -14,7 +14,7 @@ CFG_INFO := $(info cfg: building on $(CFG_OSTYPE) $(CFG_CPUTYPE))
CFG_GCC_CFLAGS
:=
CFG_GCC_LINK_FLAGS
:=
CFG_BOOT_FLAGS
:=
$(BOOT_FLAGS)
CFG_RUSTC_FLAGS
:=
-nowarn
CFG_RUSTC_FLAGS
:=
-nowarn
-O
# On Darwin, we need to run dsymutil so the debugging information ends
# up in the right place. On other platforms, it automatically gets
...
...
src/comp/driver/rustc.rs
浏览文件 @
b4422cca
...
...
@@ -58,6 +58,7 @@ fn default_environment(session.session sess,
eval
.env
env
,
str
input
,
str
output
,
bool
shared
,
bool
optimize
,
vec
[
str
]
library_search_paths
)
{
auto
def
=
tup
(
0
,
0
);
auto
p
=
parser
.new_parser
(
sess
,
env
,
def
,
input
);
...
...
@@ -69,7 +70,7 @@ fn default_environment(session.session sess,
auto
type_cache
=
typeck_result
._1
;
// FIXME: uncomment once typestate_check works
// crate = typestate_check.check_crate(crate);
trans
.trans_crate
(
sess
,
crate
,
type_cache
,
output
,
shared
);
trans
.trans_crate
(
sess
,
crate
,
type_cache
,
output
,
shared
,
optimize
);
}
impure
fn
pretty_print_input
(
session
.session
sess
,
...
...
@@ -131,6 +132,9 @@ fn get_os() -> session.os {
let
bool
pretty
=
false
;
let
bool
glue
=
false
;
// FIXME: Maybe we should support -O0, -O1, -Os, etc
let
bool
optimize
=
false
;
auto
i
=
1u
;
auto
len
=
_
vec
.len
[
str
](
args
);
...
...
@@ -140,6 +144,8 @@ fn get_os() -> session.os {
if
(
_
str
.byte_len
(
arg
)
>
0u
&&
arg
.
(
0
)
==
'-'
as
u8
)
{
if
(
_
str
.eq
(
arg
,
"-nowarn"
))
{
do_warn
=
false
;
}
else
if
(
_
str
.eq
(
arg
,
"-O"
))
{
optimize
=
true
;
}
else
if
(
_
str
.eq
(
arg
,
"-glue"
))
{
glue
=
true
;
}
else
if
(
_
str
.eq
(
arg
,
"-shared"
))
{
...
...
@@ -189,10 +195,10 @@ fn get_os() -> session.os {
if
(
glue
)
{
alt
(
output_file
)
{
case
(
none
[
str
])
{
middle
.trans
.make_common_glue
(
"glue.bc"
);
middle
.trans
.make_common_glue
(
"glue.bc"
,
optimize
);
}
case
(
some
[
str
](
?
s
))
{
middle
.trans
.make_common_glue
(
s
);
middle
.trans
.make_common_glue
(
s
,
optimize
);
}
}
ret
;
...
...
@@ -217,11 +223,11 @@ fn get_os() -> session.os {
parts
+=
vec
(
".bc"
);
auto
ofile
=
_
str
.concat
(
parts
);
compile_input
(
sess
,
env
,
ifile
,
ofile
,
shared
,
library_search_paths
);
optimize
,
library_search_paths
);
}
case
(
some
[
str
](
?
ofile
))
{
compile_input
(
sess
,
env
,
ifile
,
ofile
,
shared
,
library_search_paths
);
optimize
,
library_search_paths
);
}
}
}
...
...
src/comp/middle/trans.rs
浏览文件 @
b4422cca
...
...
@@ -7003,7 +7003,7 @@ fn make_glues(ModuleRef llmod, type_names tn) -> @glue_fns {
vec_append_glue
=
make_vec_append_glue
(
llmod
,
tn
));
}
fn
make_common_glue
(
str
output
)
{
fn
make_common_glue
(
str
output
,
bool
optimize
)
{
// FIXME: part of this is repetitive and is probably a good idea
// to autogen it, but things like the memcpy implementation are not
// and it might be better to just check in a .ll file.
...
...
@@ -7029,14 +7029,15 @@ fn make_common_glue(str output) {
trans_exit_task_glue
(
glues
,
new_str_hash
[
ValueRef
](),
tn
,
llmod
);
run_passes
(
llmod
,
tru
e
);
run_passes
(
llmod
,
optimiz
e
);
llvm
.LLVMWriteBitcodeToFile
(
llmod
,
_
str
.buf
(
output
));
llvm
.LLVMDisposeModule
(
llmod
);
}
fn
trans_crate
(
session
.session
sess
,
@
ast
.crate
crate
,
&
ty
.type_cache
type_cache
,
str
output
,
bool
shared
)
{
&
ty
.type_cache
type_cache
,
str
output
,
bool
shared
,
bool
optimize
)
{
auto
llmod
=
llvm
.LLVMModuleCreateWithNameInContext
(
_
str
.buf
(
"rust_out"
),
llvm
.LLVMGetGlobalContext
());
...
...
@@ -7099,8 +7100,7 @@ fn trans_crate(session.session sess, @ast.crate crate,
// Translate the metadata.
middle
.metadata
.write_metadata
(
cx
,
crate
);
// FIXME: Add an -O option
run_passes
(
llmod
,
true
);
run_passes
(
llmod
,
optimize
);
llvm
.LLVMWriteBitcodeToFile
(
llmod
,
_
str
.buf
(
output
));
llvm
.LLVMDisposeModule
(
llmod
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录