Implement optimize(size) and optimize(speed)
This commit is contained in:
parent
095b44c83b
commit
f38d0da893
26 changed files with 260 additions and 108 deletions
|
@ -144,16 +144,17 @@ pub fn is_pie_binary(sess: &Session) -> bool {
|
|||
}
|
||||
|
||||
pub unsafe fn create_module(
|
||||
sess: &Session,
|
||||
tcx: TyCtxt,
|
||||
llcx: &'ll llvm::Context,
|
||||
mod_name: &str,
|
||||
) -> &'ll llvm::Module {
|
||||
let sess = tcx.sess;
|
||||
let mod_name = SmallCStr::new(mod_name);
|
||||
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
|
||||
|
||||
// Ensure the data-layout values hardcoded remain the defaults.
|
||||
if sess.target.target.options.is_builtin {
|
||||
let tm = ::back::write::create_target_machine(sess, false);
|
||||
let tm = ::back::write::create_target_machine(tcx, false);
|
||||
llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm);
|
||||
llvm::LLVMRustDisposeTargetMachine(tm);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue