about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/mir
AgeCommit message (Collapse)AuthorLines
2018-11-16Great separation of librustc_codegen_llvm: librustc_codegen_ssa compilesDenis Merigoux-4421/+0
2018-11-16Beginning of moving all backend-agnostic code to rustc_codegen_ssaDenis Merigoux-3/+3
2018-11-16[eddyb/rebase cleanup] abstracted FuncletEduard-Mihai Burtescu-15/+12
2018-11-16Moved common.rs enumsDenis Merigoux-2/+2
2018-11-16Starting to move backend-agnostic code into codegen_utilsDenis Merigoux-3/+5
IntPredicate moved
2018-11-16Generalized mir::codegen_mir (and all subsequent functions)Denis Merigoux-534/+502
2018-11-16Generalized base::coerce_unsized_intoDenis Merigoux-94/+48
2018-11-16Generalized base::unsize_thin_ptrDenis Merigoux-1/+2
2018-11-16Generalized base::unsized_infoDenis Merigoux-7/+7
2018-11-16Traitified IntrinsicCallMethodsDenis Merigoux-14/+6
2018-11-16Transfered memcpy and memset to BuilderMethodsDenis Merigoux-12/+6
2018-11-16Added StaticMethods traitDenis Merigoux-29/+30
2018-11-16Generalized memset and memcpyDenis Merigoux-6/+10
2018-11-16Removing LLVM content from CommonMethods -> ConstMethodsDenis Merigoux-6/+6
2018-11-16Prefixed type methods & removed trait impl for write::CodegenContextDenis Merigoux-23/+28
2018-11-16Prefixed const methods with "const" instead of "c"Denis Merigoux-79/+79
2018-11-16Traitification of type_ methodsDenis Merigoux-51/+59
The methods are now attached to CodegenCx instead of Type
2018-11-16Use the method form for CodegenCx everywhereDenis Merigoux-15/+12
2018-11-16All CommonMethods now real methods (not static)Denis Merigoux-3/+2
2018-11-16CommonWriteMethods are not static any moreDenis Merigoux-4/+4
2018-11-16Split CommonMethods to accomodate for use in back/write.rsDenis Merigoux-1/+1
2018-11-16Added self argument for Codegen CommonMethod trait methodsDenis Merigoux-62/+63
2018-11-16Replaced Codegen field access by trait methodDenis Merigoux-157/+157
2018-11-16Traitification of common.rs methodsDenis Merigoux-107/+108
2018-11-16New files and folders for traitsDenis Merigoux-10/+13
Moved common enums to common
2018-11-16Use associated types instead of type parameters inside the BuilderMethods traitDenis Merigoux-6/+3
2018-11-16Removed genericity over Value in various functionsDenis Merigoux-18/+16
Prelude to using associated types in traits rather than type parameters
2018-11-16Generalized RealPredicateDenis Merigoux-5/+4
2018-11-16Generalized IntPredicate in the BuilderMethods traitDenis Merigoux-19/+19
2018-11-16Generalized BasicBlocks in BuilderMethods traitDenis Merigoux-2/+4
2018-11-16Generalized base.rs#call_memcpy and everything that it usesDenis Merigoux-34/+76
Generalized operand.rs#nontemporal_store and fixed tidy issues Generalized operand.rs#nontemporal_store's implem even more With a BuilderMethod trait implemented by Builder for LLVM Cleaned builder.rs : no more code duplication, no more ValueTrait Full traitification of builder.rs
2018-11-16Reduced line length to pass tidyDenis Merigoux-21/+24
Generalized FunctionCx Added ValueTrait and first change Generalize CondegenCx Generalized the Builder struct defined in librustc_codegen_llvm/builder.rs
2018-11-16rustc_codegen_llvm: begin generalizing over backend values.Irina Popa-64/+86
2018-11-15Auto merge of #55716 - RalfJung:escape-to-raw, r=oli-obkbors-1/+2
Add escape-to-raw MIR statement Add a new MIR "ghost state statement": Escaping a ptr to permit raw accesses. ~~This includes #55549, [click here](https://github.com/RalfJung/rust/compare/miri-visitor...RalfJung:escape-to-raw) for just the new commits.~~
2018-11-12Use type safe `VariantIdx` instead of `usize` everywhereOliver Scherer-10/+11
2018-11-10Auto merge of #55650 - nikic:funnel-shift, r=nagisabors-1/+2
Implement rotate using funnel shift on LLVM >= 7 Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore. Fixes #52457.
2018-11-08Rollup merge of #55633 - nikic:memcpy-align, r=nagisaMark Rousskov-4/+5
Support memcpy/memmove with differing src/dst alignment If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version. Fixes #49740.
2018-11-07no more action on ref or cast, but add new MIR statement for escaping a ptr ↵Ralf Jung-1/+2
to raw
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-3/+3
2018-11-04Support memcpy/memmove with differing src/dst alignmentNikita Popov-4/+5
If LLVM 7 is used, generate memcpy/memmove with differing src/dst alignment. I've added new FFI functions to construct these through the builder API, which is more convenient than dealing with differing intrinsic signatures depending on the LLVM version.
2018-11-03Implement rotate using funnel shift on LLVM >= 7Nikita Popov-1/+2
Implement the rotate_left and rotate_right operations using llvm.fshl and llvm.fshr if they are available (LLVM >= 7). Originally I wanted to expose the funnel_shift_left and funnel_shift_right intrinsics and implement rotate_left and rotate_right on top of them. However, emulation of funnel shifts requires emitting a conditional to check for zero shift amount, which is not necessary for rotates. I was uncomfortable doing that here, as I don't want to rely on LLVM to optimize away that conditional (and for variable rotates, I'm not sure it can). We should revisit that question when we raise our minimum version requirement to LLVM 7 and don't need emulation code anymore.
2018-11-03Auto merge of #54383 - mikeyhew:custom-receivers-object-safety, r=nikomatsakisbors-6/+38
Take 2: Implement object-safety and dynamic dispatch for arbitrary_self_types This replaces #50173. Over the months that that PR was open, we made a lot of changes to the way this was going to be implemented, and the long, meandering comment thread and commit history would have been confusing to people reading it in the future. So I decided to package everything up with new, straighforward commits and open a new PR. Here are the main points. Please read the commit messages for details. - To simplify codegen, we only support receivers that have the ABI of a pointer. That means they are builtin pointer types, or newtypes thereof. - We introduce a new trait: `DispatchFromDyn<T>`, similar to `CoerceUnsized<T>`. `DispatchFromDyn` has extra requirements that `CoerceUnsized` does not: when you implement `DispatchFromDyn` for a struct, there cannot be any extra fields besides the field being coerced and `PhantomData` fields. This ensures that the struct's ABI is the same as a pointer. - For a method's receiver (e.g. `self: Rc<Self>`) to be object-safe, it needs to have the following property: - let `DynReceiver` be the receiver when `Self = dyn Trait` - let `ConcreteReceiver` be the receiver when `Self = T`, where `T` is some unknown `Sized` type that implements `Trait`, and is the erased type of the trait object. - `ConcreteReceiver` must implement `DispatchFromDyn<DynReceiver>` In the case of `Rc<Self>`, this requires `Rc<T>: DispatchFromDyn<Rc<dyn Trait>>` These rules are explained more thoroughly in the doc comment on `receiver_is_dispatchable` in object_safety.rs. r? @nikomatsakis and @eddyb cc @arielb1 @cramertj @withoutboats Special thanks to @nikomatsakis for getting me un-stuck when implementing the object-safety checks, and @eddyb for helping with the codegen parts. EDIT 2018-11-01: updated because CoerceSized has been replaced with DispatchFromDyn
2018-11-02Auto merge of #55087 - levex:e0669-improve-span, r=nagisabors-8/+5
rustc: improve E0669 span E0669 refers to an operand that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. r? @nagisa cc/ @parched
2018-11-01Add comments explaining how codegen works for `dyn Trait` methodsMichael Hewson-2/+6
2018-11-01Implement object-safety for arbitrary_self_types: part 2Michael Hewson-6/+34
For now, all of the receivers that we care about are just a newtyped pointer — i.e. `Box<Self>`, `Rc<Self>`, `Pin<Box<Self>>`, `Pin<&mut Self>`. This is much simpler to implement in codeine than the more general case, because the ABI is the same as a pointer. So we add some checks in typeck/coherence/builtin.rs to make sure that implementors of CoerceSized are just newtyped pointers. In this commit, we also implement the codegen bits.
2018-10-29Emit Retag statements, kill Validate statementsRalf Jung-2/+3
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-28inline-asm: emit as many E0669 errors as we canLevente Kurusa-8/+5
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-10-27Auto merge of #54183 - qnighy:by-value-object-safety, r=oli-obkbors-2/+9
Implement by-value object safety This PR implements **by-value object safety**, which is part of unsized rvalues #48055. That means, with `#![feature(unsized_locals)]`, you can call a method `fn foo(self, ...)` on trait objects. One aim of this is to enable `Box<FnOnce>` in the near future. The difficulty here is this: when constructing a vtable for a trait `Foo`, we can't just put the function `<T as Foo>::foo` into the table. If `T` is no larger than `usize`, `self` is usually passed directly. However, as the caller of the vtable doesn't know the concrete `Self` type, we want a variant of `<T as Foo>::foo` where `self` is always passed by reference. Therefore, when the compiler encounters such a method to be generated as a vtable entry, it produces a newly introduced instance called `InstanceDef::VtableShim(def_id)` (that wraps the original instance). the shim just derefs the receiver and calls the original method. We give different symbol names for the shims by appending `::{{vtable-shim}}` to the symbol path (and also adding vtable-shimness as an ingredient to the symbol hash). r? @eddyb