Skip to content
Permalink
Browse files
Rebase to the llvm-project monorepo
The new git submodule src/llvm-project is a monorepo replacing src/llvm
and src/tools/{clang,lld,lldb}.  This also serves as a rebase for these
projects to the new 8.x branch from trunk.

The src/llvm-emscripten fork is unchanged for now.
  • Loading branch information
cuviper committed Jan 25, 2019
1 parent bf669d1 commit df0466d0bb807a7266cc8ac9931cd43b3e84b62e
Showing 18 changed files with 166 additions and 65 deletions.
@@ -1,7 +1,3 @@
[submodule "src/llvm"]
path = src/llvm
url = https://github.com/rust-lang/llvm.git
branch = master
[submodule "src/rust-installer"]
path = src/tools/rust-installer
url = https://github.com/rust-lang/rust-installer.git
@@ -38,20 +34,13 @@
[submodule "src/stdsimd"]
path = src/stdsimd
url = https://github.com/rust-lang-nursery/stdsimd.git
[submodule "src/tools/lld"]
path = src/tools/lld
url = https://github.com/rust-lang/lld.git
[submodule "src/tools/lldb"]
path = src/tools/lldb
url = https://github.com/rust-lang-nursery/lldb.git
branch = rust-release-80-v2
[submodule "src/tools/clang"]
path = src/tools/clang
url = https://github.com/rust-lang-nursery/clang.git
branch = rust-release-80-v2
[submodule "src/doc/rustc-guide"]
path = src/doc/rustc-guide
url = https://github.com/rust-lang/rustc-guide.git
[submodule "src/doc/edition-guide"]
path = src/doc/edition-guide
url = https://github.com/rust-lang-nursery/edition-guide
url = https://github.com/rust-lang-nursery/edition-guide.git
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/8.0-2019-01-16
@@ -23,7 +23,7 @@ The Rust Project includes packages written by third parties.
The following third party packages are included, and carry
their own copyright notices and license terms:

* LLVM. Code for this package is found in src/llvm.
* LLVM. Code for this package is found in src/llvm-project.

Copyright (c) 2003-2013 University of Illinois at
Urbana-Champaign. All rights reserved.
@@ -73,8 +73,8 @@ their own copyright notices and license terms:
OTHER DEALINGS WITH THE SOFTWARE.

* Additional libraries included in LLVM carry separate
BSD-compatible licenses. See src/llvm/LICENSE.txt for
details.
BSD-compatible licenses. See src/llvm-project/llvm/LICENSE.TXT
for details.

* compiler-rt, in src/compiler-rt is dual licensed under
LLVM's license and MIT:
@@ -701,21 +701,13 @@ def update_submodules(self):
filtered_submodules = []
submodules_names = []
for module in submodules:
if module.endswith("llvm"):
if self.get_toml('llvm-config'):
if module.endswith("llvm-project"):
if self.get_toml('llvm-config') and self.get_toml('lld') != 'true':
continue
if module.endswith("llvm-emscripten"):
backends = self.get_toml('codegen-backends')
if backends is None or not 'emscripten' in backends:
continue
if module.endswith("lld"):
config = self.get_toml('lld')
if config is None or config == 'false':
continue
if module.endswith("lldb") or module.endswith("clang"):
config = self.get_toml('lldb')
if config is None or config == 'false':
continue
check = self.check_submodule(module, slow_submodules)
filtered_submodules.append((module, check))
submodules_names.append(module)
@@ -788,7 +788,24 @@ fn copy_src_dirs(builder: &Builder, src_dirs: &[&str], exclude_dirs: &[&str], ds
if spath.ends_with("~") || spath.ends_with(".pyc") {
return false
}
if (spath.contains("llvm/test") || spath.contains("llvm\\test")) &&

const LLVM_PROJECTS: &[&str] = &[
"llvm-project/clang", "llvm-project\\clang",
"llvm-project/lld", "llvm-project\\lld",
"llvm-project/lldb", "llvm-project\\lldb",
"llvm-project/llvm", "llvm-project\\llvm",
];
if spath.contains("llvm-project") && !spath.ends_with("llvm-project")
&& !LLVM_PROJECTS.iter().any(|path| spath.contains(path))
{
return false;
}

const LLVM_TEST: &[&str] = &[
"llvm-project/llvm/test", "llvm-project\\llvm\\test",
"llvm-emscripten/test", "llvm-emscripten\\test",
];
if LLVM_TEST.iter().any(|path| spath.contains(path)) &&
(spath.ends_with(".ll") ||
spath.ends_with(".td") ||
spath.ends_with(".s")) {
@@ -2076,7 +2093,7 @@ impl Step for LlvmTools {
}

builder.info(&format!("Dist LlvmTools stage{} ({})", stage, target));
let src = builder.src.join("src/llvm");
let src = builder.src.join("src/llvm-project/llvm");
let name = pkgname(builder, "llvm-tools");

let tmp = tmpdir(builder);
@@ -2135,7 +2152,7 @@ impl Step for Lldb {
const DEFAULT: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/tools/lldb")
run.path("src/llvm-project/lldb").path("src/tools/lldb")
}

fn make_run(run: RunConfig) {
@@ -2160,7 +2177,7 @@ impl Step for Lldb {
}

builder.info(&format!("Dist Lldb ({})", target));
let src = builder.src.join("src/tools/lldb");
let src = builder.src.join("src/llvm-project/lldb");
let name = pkgname(builder, "lldb");

let tmp = tmpdir(builder);
@@ -36,7 +36,10 @@ impl Step for Llvm {
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/llvm").path("src/llvm-emscripten")
run.path("src/llvm-project")
.path("src/llvm-project/llvm")
.path("src/llvm")
.path("src/llvm-emscripten")
}

fn make_run(run: RunConfig) {
@@ -97,7 +100,7 @@ impl Step for Llvm {
t!(fs::create_dir_all(&out_dir));

// http://llvm.org/docs/CMake.html
let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm" };
let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm-project/llvm" };
let mut cfg = cmake::Config::new(builder.src.join(root));

let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
@@ -189,8 +192,7 @@ impl Step for Llvm {
}

if want_lldb {
cfg.define("LLVM_EXTERNAL_CLANG_SOURCE_DIR", builder.src.join("src/tools/clang"));
cfg.define("LLVM_EXTERNAL_LLDB_SOURCE_DIR", builder.src.join("src/tools/lldb"));
cfg.define("LLVM_ENABLE_PROJECTS", "clang;lldb");
// For the time being, disable code signing.
cfg.define("LLDB_CODESIGN_IDENTITY", "");
} else {
@@ -411,7 +413,7 @@ impl Step for Lld {
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("src/tools/lld")
run.path("src/llvm-project/lld").path("src/tools/lld")
}

fn make_run(run: RunConfig) {
@@ -441,7 +443,7 @@ impl Step for Lld {
let _time = util::timeit(&builder);
t!(fs::create_dir_all(&out_dir));

let mut cfg = cmake::Config::new(builder.src.join("src/tools/lld"));
let mut cfg = cmake::Config::new(builder.src.join("src/llvm-project/lld"));
configure_cmake(builder, target, &mut cfg);

// This is an awful, awful hack. Discovered when we migrated to using
@@ -45,8 +45,7 @@ function fetch_submodule {
rm $cached
}

included="src/llvm src/llvm-emscripten src/doc/book src/doc/rust-by-example"
included="$included src/tools/lld src/tools/clang src/tools/lldb"
included="src/llvm-project src/llvm-emscripten src/doc/book src/doc/rust-by-example"
modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)"
modules=($modules)
use_git=""
@@ -12,7 +12,7 @@ use self::source_loc::InternalDebugLocation::{self, UnknownLocation};

use llvm;
use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags,
DILexicalBlock};
DISPFlags, DILexicalBlock};
use rustc::hir::CodegenFnAttrFlags;
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
use rustc::ty::subst::{Substs, UnpackedKind};
@@ -283,7 +283,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
let linkage_name = mangled_name_of_instance(self, instance);

let scope_line = span_start(self, span).line;
let is_local_to_unit = is_node_local_to_unit(self, def_id);

let function_name = CString::new(name).unwrap();
let linkage_name = SmallCStr::new(&linkage_name.as_str());
@@ -300,6 +299,14 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
flags |= DIFlags::FlagNoReturn;
}

let mut spflags = DISPFlags::SPFlagDefinition;
if is_node_local_to_unit(self, def_id) {
spflags |= DISPFlags::SPFlagLocalToUnit;
}
if self.sess().opts.optimize != config::OptLevel::No {
spflags |= DISPFlags::SPFlagOptimized;
}

let fn_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateFunction(
DIB(self),
@@ -309,11 +316,9 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
file_metadata,
loc.line as c_uint,
function_type_metadata,
is_local_to_unit,
true,
scope_line as c_uint,
flags,
self.sess().opts.optimize != config::OptLevel::No,
spflags,
llfn,
template_parameters,
None)
@@ -2,7 +2,7 @@ use super::debuginfo::{
DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
DINameSpace, DIFlags,
DINameSpace, DIFlags, DISPFlags,
};

use libc::{c_uint, c_int, size_t, c_char};
@@ -591,6 +591,20 @@ pub mod debuginfo {
const FlagMainSubprogram = (1 << 21);
}
}

// These values **must** match with LLVMRustDISPFlags!!
bitflags! {
#[repr(C)]
#[derive(Default)]
pub struct DISPFlags: ::libc::uint32_t {
const SPFlagZero = 0;
const SPFlagVirtual = 1;
const SPFlagPureVirtual = 2;
const SPFlagLocalToUnit = (1 << 2);
const SPFlagDefinition = (1 << 3);
const SPFlagOptimized = (1 << 4);
}
}
}

extern { pub type ModuleBuffer; }
@@ -1387,11 +1401,9 @@ extern "C" {
File: &'a DIFile,
LineNo: c_uint,
Ty: &'a DIType,
isLocalToUnit: bool,
isDefinition: bool,
ScopeLine: c_uint,
Flags: DIFlags,
isOptimized: bool,
SPFlags: DISPFlags,
Fn: &'a Value,
TParam: &'a DIArray,
Decl: Option<&'a DIDescriptor>)
@@ -1529,7 +1541,7 @@ extern "C" {
AlignInBits: u32,
Elements: &'a DIArray,
ClassType: &'a DIType,
IsFixed: bool)
IsScoped: bool)
-> &'a DIType;

pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
Submodule llvm deleted from f4728e
Submodule llvm-project added at a27fbe
@@ -789,7 +789,7 @@ struct LLVMRustThinLTOData {
StringMap<GVSummaryMapTy> ModuleToDefinedGVSummaries;

#if LLVM_VERSION_GE(7, 0)
LLVMRustThinLTOData() : Index(/* isPerformingAnalysis = */ false) {}
LLVMRustThinLTOData() : Index(/* HaveGVs = */ false) {}
#endif
};

@@ -865,7 +865,12 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
auto deadIsPrevailing = [&](GlobalValue::GUID G) {
return PrevailingType::Unknown;
};
#if LLVM_VERSION_GE(8, 0)
computeDeadSymbolsWithConstProp(Ret->Index, Ret->GUIDPreservedSymbols,
deadIsPrevailing, /* ImportEnabled = */ true);
#else
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols, deadIsPrevailing);
#endif
#else
computeDeadSymbols(Ret->Index, Ret->GUIDPreservedSymbols);
#endif

0 comments on commit df0466d

Please sign in to comment.