about summary refs log tree commit diff
path: root/src/librustc_trans
AgeCommit message (Collapse)AuthorLines
2018-05-17Rename trans to codegen everywhere.Irina Popa-24578/+0
2018-05-15Pull common parameters into GenericParamDefvarkor-7/+1
This leads to a lot of simplifications, as most code doesn't actually need to know about the specific lifetime/type data; rather, it's concerned with properties like name, index and def_id.
2018-05-15Refactor to address commentsvarkor-28/+20
2018-05-15Use GenericParamCount instead of FxHashMapvarkor-1/+7
2018-05-15Eliminate ty::Generics::types()varkor-1/+1
And with one final incanation, the specific kind iterators were banished from ty::Generics, never to be seen again!
2018-05-15Generalise cases of explicit iteration of specific kindsvarkor-4/+19
2018-05-15Rename `has_type_parameters` to `requires_monomorphization`varkor-1/+1
2018-05-15Fix generics type parameter handling in mirivarkor-1/+1
2018-05-15Prefer iterator to vecvarkor-1/+1
2018-05-15Consolidate ty::Genericsvarkor-1/+1
2018-05-14Auto merge of #50648 - nox:volatile-store, r=eddybbors-81/+74
Fix volatile_store and nontemporal_store Fixes #50371.
2018-05-13Introduce OperandValue::nontemporal_store and use it in the intrinsicsAnthony Ramine-78/+64
We use a new MemFlags bitflags type to merge some store code paths.
2018-05-13Introduce OperandValue::volatile_store and use it in the intrinsicsAnthony Ramine-28/+35
Fixes #50371.
2018-05-13Auto merge of #50622 - eddyb:make-room-for-ghosts, r=nikomatsakisbors-7/+4
rustc: leave space for fields of uninhabited types to allow partial initialization. Fixes #49298 by only collapsing uninhabited enum variants, and only if they only have ZST fields. Fixes #50442 incidentally (@nox's optimization didn't take into account uninhabited variants).
2018-05-12Auto merge of #50686 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-15/+26
Rollup of 13 pull requests Successful merges: - #50544 (Cleanup some dependencies) - #50545 (Made some functions in time module const) - #50550 (use fmt::Result where applicable) - #50558 (Remove all reference to DepGraph::work_products) - #50602 (Update canonicalize docs) - #50607 (Allocate Symbol strings from an arena) - #50613 (Migrate the toolstate update bot to rust-highfive) - #50624 (fs::write: Add example writing a &str) - #50634 (Do not silently truncate offsets for `read_at`/`write_at` on emscripten) - #50644 (AppVeyor: Read back trace from crash dump on failure.) - #50661 (Ignore non .rs files for tidy libcoretest) - #50663 (rustc: Allow an edition's feature on that edition) - #50667 (rustc: Only suggest deleting `extern crate` if it works) Failed merges:
2018-05-12Rollup merge of #50558 - whitfin:issue-50500, r=michaelwoeristerMark Simulacrum-15/+26
Remove all reference to DepGraph::work_products This is an attempt at fixing #50500. It will remove the `work_products` key from `DepGraphData` completely, in favour of just passing the relevant data around. I went in a little blindly; everything appears to work just fine but I'd appreciate any additional advice people. I didn't want to remove too much of what was already there, so I kept the structure pretty much the same (aside from some naming tweaks) - if anyone has suggestions on how to streamline it a little better, happy to follow up. r? @michaelwoerister
2018-05-12Set PrepareForThinLTO flag when using ThinLTONikita Popov-2/+5
The LLVM PassManager has a PrepareForThinLTO flag, which is intended when compilation occurs in conjunction with linking by ThinLTO. The flag has two effects: * The NameAnonGlobal pass is run after all other passes, which ensures that all globals have a name. * In optimized builds, a number of late passes (mainly related to vectorization and unrolling) are disabled, on the rationale that these a) will increase codesize of the intermediate artifacts and b) will be run by ThinLTO again anyway. This patch enables the use of PrepareForThinLTO if Thin or ThinLocal linking is used. The background for this change is the CI failure in #49479, which we assume to be caused by the NameAnonGlobal pass not being run. As this changes which passes LLVM runs, this might have performance (or other) impact, so we want to land this separately.
2018-05-12Auto merge of #50249 - Zoxc:allocation-const, r=oli-obkbors-73/+92
Introduce ConstValue and use it instead of miri's Value for constant values r? @oli-obk
2018-05-11Auto merge of #50105 - mixi:crt-included, r=alexcrichtonbors-0/+27
Use the correct crt*.o files when linking musl targets. This is supposed to support optionally using the system copy of musl libc instead of the included one if supported. This currently only affects the start files, which is enough to allow building rustc on musl targets. Most of the changes are analogous to crt-static. Excluding the start files is something musl based distributions usually patch into their copy of rustc: - https://github.com/alpinelinux/aports/blob/eb064c8/community/rust/musl-fix-linux_musl_base.patch - https://github.com/voidlinux/void-packages/blob/77400fc/srcpkgs/rust/patches/link-musl-dynamically.patch For third-party distributions that not yet carry those patches it would be nice if it was supported without the need to patch upstream sources. ## Reasons ### What breaks? Some start files were missed when originally writing the logic to swap in musl start files (gcc comes with its own start files, which are suppressed by -nostdlib, but not manually included later on). This caused #36710, which also affects rustc with the internal llvm copy or any other system libraries that need crtbegin/crtend. ### How is it fixed? The system linker already has all the logic to decide which start files to include, so we can just defer to it (except of course if it doesn't target musl). ### Why is it optional? In #40113 it was first tried to remove the start files, which broke compiling musl-targeting static binaries with a glibc-targeting compiler. This is why it eventually landed without removing the start files. Being an option side-steps the issue. ### Why are the start files still installed? This has the nice side-effect, that the produced rust-std-* binaries can still be used by on a glibc-targeting system with a rustc built against glibc. ## Does it work? With the following build script (using [musl-cross-make](https://github.com/richfelker/musl-cross-make)): https://shadowice.org/~mixi/rust-musl/build.sh, I was able to cross-compile a musl-host musl-targeting rustc on a glibc-based system. The resulting binaries are at https://shadowice.org/~mixi/rust-musl/binaries/. This also requires #50103 and #50104 (which are also applied to the branch the build script uses).
2018-05-11Update naming in line with PR commentsIsaac Whitfield-5/+7
2018-05-11Neaten a couple of long signaturesIsaac Whitfield-4/+8
2018-05-11Remove shared access to DepGraph::work_productsIsaac Whitfield-15/+20
2018-05-11Add a query to convert from ConstValue to AllocationJohn Kåre Alsaker-6/+7
2018-05-11Introduce ConstValue and use it instead of miri's Value for constant valuesJohn Kåre Alsaker-72/+90
2018-05-10rustc: leave space for fields of uninhabited types to allow partial ↵Eduard-Mihai Burtescu-7/+4
initialization.
2018-05-10Rollup merge of #50569 - michaelwoerister:cross-lang-lto-2, r=alexcrichtonAlex Crichton-7/+58
Allow for specifying a linker plugin for cross-language LTO This PR makes the `-Zcross-lang-lto` flag optionally take the path to the `LLVMgold.so` linker plugin. If this path is specified, `rustc` will invoke the linker with the correct arguments (i.e. `-plugin` and various `-plugin-opt`s). This can be used to ergonomically enable cross-language LTO for Rust programs with C/C++ dependencies: ``` clang -O2 test.c -otest.o -c -flto=thin llvm-ar -rv libxxx.a test.o rustc -L. main.rs -Zcross-lang-lto=/usr/lib64/LLVMgold.so -O -Clink-arg=-fuse-ld=gold ``` - Note that in theory this should work with Gold, LLD, and newer versions of binutils' LD but on my current system I could only get it to work with Gold. - Also note that this will work best if the Clang version and Rust's LLVM version are close enough. Clang 6.0 works well with the current nightly. r? @alexcrichton
2018-05-09Allow for specifying a linker plugin for cross-language LTOMichael Woerister-7/+58
2018-05-08Insert fields from TypeAndMut into TyRef to allow layout optimizationJohn Kåre Alsaker-13/+14
2018-05-08Store the GeneratorInterior in the new GeneratorSubstsJohn Kåre Alsaker-7/+8
2018-05-08Store generator movability outside GeneratorInteriorJohn Kåre Alsaker-3/+3
2018-05-07Auto merge of #50000 - michaelwoerister:cross-lang-lto, r=alexcrichtonbors-3/+13
Add some groundwork for cross-language LTO. Implements part of #49879: - Adds a `-Z cross-lang-lto` flag to rustc - Makes sure that bitcode is embedded in object files if the flag is set. This should already allow for using cross language LTO for staticlibs (where one has to invoke the linker manually anyway). However, `rustc` will not try to enable LTO for its own linker invocations yet. r? @alexcrichton
2018-05-06issue-49938: Reference tagged unions discr(iminant) as tagSamuel Wilson-4/+4
Refer https://github.com/rust-lang/rust/issues/49938 Previously tagged unions' tag was refered to as a discr(iminant). Here the changes use tag instead which is the correct terminology when refering to the memory representation of tagged unions.
2018-05-03Don't run LTO passes in rustc when cross-lang LTO is enabled.Michael Woerister-0/+4
2018-05-03Use correct section name for embedded LLVM bitcode on OSX.Michael Woerister-2/+6
2018-05-03Add -Z cross-lang-lto flag in order to support linker-based LTO.Michael Woerister-1/+2
2018-05-03Declare embedded LLVM bitcode section readonly.Michael Woerister-0/+1
2018-05-02Auto merge of #50278 - eddyb:mir-succ-iter, r=nikomatsakisbors-1/+1
rustc: return iterators from Terminator(Kind)::successors(_mut). Minor cleanup (and potentially speedup) prompted by @nnethercote's `SmallVec` experiments. This PR assumes `.count()` and `.nth(i)` on `iter::Chain<option::IntoIter, slice::Iter(Mut)>` are `O(1)`, but otherwise all of the uses appear to immediately iterate through the successors. r? @nikomatsakis
2018-05-01musl: link crt{begin,end}.o from the system compilerJohannes Nixdorf-0/+11
This fixes #36710 with +crt-static. We only need to add crtbegin.o and crtend.o as we only do static linking with the bundled start files and there is no static-pie support in rustc yet.
2018-05-01Auto merge of #50198 - oli-obk:const_prop, r=eddybbors-28/+9
Remove some unused code
2018-05-01rustc: return impl Iterator from Terminator(Kind)::successors(_mut).Eduard-Mihai Burtescu-1/+1
2018-05-01Auto merge of #49724 - kennytm:range-inc-start-end-methods, r=Kimundibors-12/+12
Introduce RangeInclusive::{new, start, end} methods and make the fields private. cc #49022
2018-05-01Auto merge of #48786 - nagisa:fp, r=nikomatsakisbors-2/+0
Add force-frame-pointer flag to allow control of frame pointer ommision Rebase of #47152 plus some changes suggested by https://github.com/rust-lang/rust/issues/48785. Fixes #11906 r? @nikomatsakis
2018-05-01Don't force-enable frame pointers when generating debug infoBjörn Steinbrink-2/+0
We apparently used to generate bad/incomplete debug info causing debuggers not to find symbols of stack allocated variables. This was somehow worked around by having frame pointers. With the current codegen, this seems no longer necessary, so we can remove the code that force-enables frame pointers whenever debug info is requested. Since certain situations, like profiling code profit from having frame pointers, we add a -Cforce-frame-pointers flag to always enable frame pointers. Fixes #11906
2018-05-01Auto merge of #50304 - nox:uninhabited-output, r=eddybbors-3/+3
Mark functions returning uninhabited types as noreturn
2018-05-01Removed direct field usage of RangeInclusive in rustc itself.kennytm-11/+11
2018-04-30Unify MIR assert messages and const eval errorsOliver Schneider-24/+5
2018-04-30Merge ConstMathError into EvalErrorKindOliver Schneider-3/+2
2018-04-30Remove the `rustc_const_math` crateOliver Schneider-4/+2
2018-04-30Remove ConstFloatOliver Schneider-1/+4
2018-04-30Make the fields of RangeInclusive private.kennytm-1/+1
Added new()/start()/end() methods to RangeInclusive. Changed the lowering of `..=` to use RangeInclusive::new().