mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
Update rust to build with newer llvm versions.
This commit is contained in:
parent
d360c481e8
commit
698022d351
@ -153,7 +153,6 @@ mod write {
|
||||
True, // unit-at-a-time
|
||||
True, // unroll loops
|
||||
True, // simplify lib calls
|
||||
True, // have exceptions
|
||||
threshold); // inline threshold
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,7 @@ const uint LLVMNoImplicitFloatAttribute = 8388608u;
|
||||
const uint LLVMNakedAttribute = 16777216u;
|
||||
const uint LLVMInlineHintAttribute = 33554432u;
|
||||
const uint LLVMStackAttribute = 469762048u; // 7 << 26
|
||||
const uint LLVMUWTableAttribute = 1073741824u; // 1 << 30
|
||||
|
||||
|
||||
// Consts for the LLVM IntPredicate type, pre-cast to uint.
|
||||
@ -813,7 +814,6 @@ native mod llvm = llvm_lib {
|
||||
Bool UnitAtATime,
|
||||
Bool UnrollLoops,
|
||||
Bool SimplifyLibCalls,
|
||||
Bool HaveExceptions,
|
||||
uint InliningThreshold);
|
||||
|
||||
/** Destroys a memory buffer. */
|
||||
|
@ -1820,6 +1820,11 @@ fn set_no_inline(ValueRef f) {
|
||||
lib::llvm::llvm::Attribute);
|
||||
}
|
||||
|
||||
fn set_uwtable(ValueRef f) {
|
||||
llvm::LLVMAddFunctionAttr(f, lib::llvm::LLVMUWTableAttribute as
|
||||
lib::llvm::llvm::Attribute);
|
||||
}
|
||||
|
||||
fn set_always_inline(ValueRef f) {
|
||||
llvm::LLVMAddFunctionAttr(f, lib::llvm::LLVMAlwaysInlineAttribute as
|
||||
lib::llvm::llvm::Attribute);
|
||||
@ -6962,6 +6967,7 @@ fn trans_fn(@local_ctxt cx, &span sp, &ast::_fn f, ast::def_id fid,
|
||||
option::t[ty_self_pair] ty_self,
|
||||
&vec[ast::ty_param] ty_params, &ast::ann ann) {
|
||||
auto llfndecl = cx.ccx.item_ids.get(fid);
|
||||
set_uwtable(llfndecl);
|
||||
|
||||
// Set up arguments to the function.
|
||||
auto fcx = new_fn_ctxt(cx, sp, llfndecl);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "llvm/Analysis/Passes.h"
|
||||
#include "llvm/Support/StandardPasses.h"
|
||||
#include "llvm/Support/PassManagerBuilder.h"
|
||||
#include "llvm/PassManager.h"
|
||||
#include "llvm-c/Core.h"
|
||||
#include <cstdlib>
|
||||
@ -8,22 +8,29 @@ using namespace llvm;
|
||||
|
||||
extern "C" void LLVMAddStandardFunctionPasses(LLVMPassManagerRef PM,
|
||||
unsigned int OptimizationLevel) {
|
||||
createStandardFunctionPasses(unwrap(PM), OptimizationLevel);
|
||||
PassManagerBuilder PMBuilder;
|
||||
PMBuilder.OptLevel = OptimizationLevel;
|
||||
FunctionPassManager *FPM = (FunctionPassManager*) unwrap(PM);
|
||||
PMBuilder.populateFunctionPassManager(*FPM);
|
||||
}
|
||||
|
||||
extern "C" void LLVMAddStandardModulePasses(LLVMPassManagerRef PM,
|
||||
unsigned int OptimizationLevel, LLVMBool OptimizeSize,
|
||||
LLVMBool UnitAtATime, LLVMBool UnrollLoops, LLVMBool SimplifyLibCalls,
|
||||
LLVMBool HaveExceptions, unsigned int InliningThreshold) {
|
||||
Pass *InliningPass;
|
||||
if (InliningThreshold)
|
||||
InliningPass = createFunctionInliningPass(InliningThreshold);
|
||||
else
|
||||
InliningPass = NULL;
|
||||
unsigned int InliningThreshold) {
|
||||
|
||||
createStandardModulePasses(unwrap(PM), OptimizationLevel, OptimizeSize,
|
||||
UnitAtATime, UnrollLoops, SimplifyLibCalls,
|
||||
HaveExceptions, InliningPass);
|
||||
PassManagerBuilder PMBuilder;
|
||||
PMBuilder.OptLevel = OptimizationLevel;
|
||||
PMBuilder.SizeLevel = OptimizeSize;
|
||||
PMBuilder.DisableUnitAtATime = !UnitAtATime;
|
||||
PMBuilder.DisableUnrollLoops = !UnrollLoops;
|
||||
|
||||
PMBuilder.DisableSimplifyLibCalls = !SimplifyLibCalls;
|
||||
|
||||
if (InliningThreshold)
|
||||
PMBuilder.Inliner = createFunctionInliningPass(InliningThreshold);
|
||||
|
||||
PassManager *MPM = (PassManager*) unwrap(PM);
|
||||
PMBuilder.populateModulePassManager(*MPM);
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ extern "C" const char *LLVMRustGetLastError(void) {
|
||||
extern "C" void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);
|
||||
extern "C" void LLVMAddStandardModulePasses(LLVMPassManagerRef PM,
|
||||
unsigned int OptimizationLevel, bool OptimizeSize, bool UnitAtATime,
|
||||
bool UnrollLoops, bool SimplifyLibCalls, bool HaveExceptions,
|
||||
bool UnrollLoops, bool SimplifyLibCalls,
|
||||
unsigned int InliningThreshold);
|
||||
|
||||
int *RustHackToFetchPassesO = (int*)LLVMAddBasicAliasAnalysisPass;
|
||||
@ -80,7 +80,6 @@ extern "C" void LLVMRustWriteOutputFile(LLVMPassManagerRef PMR,
|
||||
LLVMCodeGenFileType FileType) {
|
||||
|
||||
// Set compilation options.
|
||||
llvm::UnwindTablesMandatory = true;
|
||||
llvm::NoFramePointerElim = true;
|
||||
|
||||
InitializeAllTargets();
|
||||
|
Loading…
Reference in New Issue
Block a user