Commit Graph

73 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
209abc71e5 rustc_trans: rename bcx to bx. 2018-01-14 08:56:44 +02:00
Eduard-Mihai Burtescu
e69dacb431 rustc_trans: rename ccx to cx. 2018-01-14 08:56:44 +02:00
Eduard-Mihai Burtescu
fb7de6a041 rustc_trans: rename CrateContext to CodegenCx. 2018-01-14 08:55:57 +02:00
Eduard-Mihai Burtescu
2931af62f0 rustc_trans: access fields directly on CrateContext. 2018-01-14 08:55:43 +02:00
Eduard-Mihai Burtescu
5cab0bf0ad rustc_trans: always require alignment for load/store/memcpy. 2017-12-17 16:34:54 +02:00
Eduard-Mihai Burtescu
de3e581e29 rustc: support u128 discriminant ranges. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
b723af284a rustc_trans: go through layouts uniformly for fat pointers and variants. 2017-11-19 02:14:32 +02:00
Eduard-Mihai Burtescu
d0ab6e8644 rustc_trans: compute LLVM types from type layouts, not Rust types. 2017-11-19 02:14:31 +02:00
Eduard-Mihai Burtescu
5b1fdaeb80 rustc_trans: use more of the trans::mir and ty::layout APIs throughout. 2017-11-19 02:14:28 +02:00
Eduard-Mihai Burtescu
f44b099187 rustc_trans: avoid working with sizes/offsets and alignments as integers. 2017-11-19 02:14:24 +02:00
Tom Tromey
ae4cc60696 Emit debug info for trait object pointer
Emit better debugging information for a trait object pointer.  In
particular, now:

* The fields are explicitly represented in the DWARF;
* DWARF for the vtable itself is emitted; and
* The DWARF for the vtable's type has a DW_AT_containing_type which
  points to the concrete type for which the vtable was emitted.  This is
  a small DWARF extension, that allows debuggers to determine the real
  type of the object to which a trait object points.

I'll submit the gdb patch to take advantage of this new debuginfo once
this lands.

The vtable type is not currently complete -- it doesn't include members
for the pointers it contains.  This information was not needed for this
feature.

This addresses part 1 of #1563.
2017-11-15 01:48:14 -07:00
Jimmy Brisson
81f9d4e78f Wrap vtable_methods return type in RC 2017-10-13 09:34:13 -05:00
Jimmy Brisson
b640c2b95a get_vtable_methods => vtable_methods query 2017-10-13 09:34:13 -05:00
Jimmy Brisson
4e116e1426 Convert return type of get_vtable_methods to Vec 2017-10-13 09:32:29 -05:00
Alex Crichton
c72240acf7 rustc_trans: Refactor collection to use tcx
This commit refactors the `collect_crate_translation_items` function to only
require the `TyCtxt` instead of a `SharedCrateContext` in preparation for
query-ifying this portion of trans.
2017-09-17 09:41:43 -07:00
Douglas Campos
3fe4612d14 bring Ty into scope 2017-09-14 21:54:21 -04:00
Eduard-Mihai Burtescu
3ce31eb990 rustc: replace usize with u64 and ConstUsize. 2017-09-11 08:41:15 +03:00
Eduard-Mihai Burtescu
c977daf97c rustc_trans: avoid sizing_type_of everywhere possible. 2017-04-08 23:40:54 +03:00
Ariel Ben-Yehuda
f2c7917402 translate drop glue using MIR
Drop of arrays is now translated in trans::block in an ugly way that I
should clean up in a later PR, and does not handle panics in the middle
of an array drop, but this commit & PR are growing too big.
2017-03-18 02:53:08 +02:00
Ariel Ben-Yehuda
65a4266f1f refactor away callee::Callee and translate virtual calls through a MIR shim
These changes are in the same commit to avoid needing to adapt
meth::trans_object_shim to the new scheme.

One codegen-units test is broken because we instantiate the shims even
when they are not needed. This will be fixed in the next PR.
2017-03-18 02:53:07 +02:00
Ariel Ben-Yehuda
ffee9566bb move Instance to rustc and use it in the collector 2017-03-18 02:53:04 +02:00
James Miller
7af3406a49 Set metadata for vtable-related loads
Give LLVM much more information about vtable pointers. Without the extra
information, LLVM has to be rather pessimistic about vtables, preventing
a number of obvious optimisations.

* Makes the vtable pointer argument noalias and readonly.
* Marks loads of the vtable pointer as nonnull.
* Marks load from the vtable with `!invariant.load` metadata.

Fixes #39992
2017-02-21 21:08:06 +13:00
Ariel Ben-Yehuda
09825de61b emit "align 1" metadata on loads/stores of packed structs
According to the LLVM reference:
> A value of 0 or an omitted align argument means that the operation has
the ABI alignment for the target.

So loads/stores of fields of packed structs need to have their align set
to 1. Implement that by tracking the alignment of `LvalueRef`s.

Fixes #39376.
2017-02-08 22:23:21 +01:00
Mark Simulacrum
c3fe2590f5 Inline and remove Builder::entry_block 2017-01-04 11:38:10 -07:00
Mark Simulacrum
937e8da349 Purge FunctionContext 2017-01-04 11:33:59 -07:00
Mark Simulacrum
1be170b01a Replace BlockAndBuilder with Builder. 2017-01-04 11:33:31 -07:00
Mark Simulacrum
bd009dc444 Remove fn_ty from FunctionContext 2016-12-20 20:04:44 -07:00
Mark Simulacrum
d55e73954a Do not use BAB after calling unreachable.
This does not make unreachable and other terminators take self by-value
because it is deemed too difficult. We would need to create by-value
methods on BAB that call into Builder, due to the Deref to builder.
2016-12-20 20:04:43 -07:00
Mark Simulacrum
88202c5b83 Replace bcx.ccx() with bcx.ccx 2016-12-20 20:04:41 -07:00
Mark Simulacrum
6e3d8cda2c Fix and cleanup callee shims 2016-12-20 20:03:34 -07:00
Mark Simulacrum
0a71b38803 Remove llretslotptr from FunctionContext 2016-12-20 20:03:33 -07:00
Mark Simulacrum
97a2096e5e Inline and cleanup build_return_block 2016-12-20 20:03:31 -07:00
Mark Simulacrum
515d14f094 Inline/Replace finish with build_return_block 2016-12-20 20:03:31 -07:00
Mark Simulacrum
b48e74b5b0 Rename 'blk and 'bcx to 'a 2016-12-20 20:03:31 -07:00
Mark-Simulacrum
937001a1f8 Refactor Callee::call to take bcx by-reference.
Also change to not return anything; nothing used the return ValueRef.

Inlines with_cond.
2016-12-20 20:03:29 -07:00
Mark-Simulacrum
c4f6173af8 Replace init with get_entry_block. 2016-12-20 20:03:27 -07:00
Mark-Simulacrum
6441c977cb Remove push_ctxt 2016-12-20 20:02:50 -07:00
Mark-Simulacrum
8f3d824cc7 Remove common::Block. 2016-12-20 20:02:46 -07:00
Mark-Simulacrum
fec59c5f73 Replace lpad().and_then(..) with None 2016-12-20 20:01:41 -07:00
Mark-Simulacrum
59ef51c12a Replace build.rs with calling functions on builder directly 2016-12-20 20:01:40 -07:00
Mark-Simulacrum
bf7d4534a7 Refactor Block into BlockAndBuilder 2016-12-20 20:01:40 -07:00
Mark-Simulacrum
bb35d50cad Refactor TyTrait to contain a interned ExistentialPredicate slice.
Renames TyTrait to TyDynamic.
2016-11-28 18:09:13 -07:00
Zack M. Davis
1e7cd5edcc prefer if let to match with None => { } arm in some places
In #34268 (8531d581), we replaced matches of None to the unit value `()`
with `if let`s in places where it was deemed that this made the code
unambiguously clearer and more idiomatic. In #34638 (d37edef9), we did
the same for matches of None to the empty block `{}`.

A casual observer, upon seeing these commits fly by, might suppose that
the matter was then settled, that no further pull requests on this
utterly trivial point of style could or would be made. Unless ...

It turns out that sometimes people write the empty block with a space in
between the braces. Who knew?
2016-10-17 19:00:20 -07:00
Ariel Ben-Yehuda
ee338c31fe normalize types every time HR regions are erased
Associated type normalization is inhibited by higher-ranked regions.
Therefore, every time we erase them, we must re-normalize.

I was meaning to introduce this change some time ago, but we used
to erase regions in generic context, which broke this terribly (because
you can't always normalize in a generic context). That seems to be gone
now.

Ensure this by having a `erase_late_bound_regions_and_normalize`
function.

Fixes #37109 (the missing call was in mir::block).
2016-10-13 19:17:53 +03:00
Eduard Burtescu
ade79d7609 rustc_trans: simplify vtable and symbol handling. 2016-09-20 20:30:52 +03:00
Eduard Burtescu
89736e8671 rustc: remove ImplOrTraitItemId and TraitDef's associated_type_names. 2016-09-20 20:08:03 +03:00
Eduard Burtescu
8734aaa33e rustc_metadata: move more RBML tags to auto-serialization. 2016-09-20 20:08:02 +03:00
Oliver Schneider
a3f05cec76 clean up get_vtable's doc comment 2016-09-08 12:58:05 +02:00
Niko Matsakis
00d208eea8 remove normalize_infer_ctxt constructor 2016-08-31 22:06:01 -04:00
Eduard Burtescu
dffd238f8b rustc: pass ty::Region behind an interned 'tcx reference. 2016-08-27 01:15:06 +03:00