Commit graph

100 commits

Author SHA1 Message Date
Luca Barbato e185c6c3d3 powerpc: Ignore the stack-probes test 2017-07-18 08:50:58 +00:00
Ariel Ben-Yehuda ecf62e4cdc [LLVM] Avoid losing the !nonnull attribute in SROA
This still does not work on 32-bit archs because of an LLVM limitation,
but this is only an optimization, so let's push it on 64-bit only for now.

Fixes #37945
2017-07-12 14:38:49 +03:00
Alex Crichton 5dbd97de3d rustc: Implement stack probes for x86
This commit implements stack probes on x86/x86_64 using the freshly landed
support upstream in LLVM. The purpose of stack probes here are to guarantee a
segfault on stack overflow rather than having a chance of running over the guard
page already present on all threads by accident.

At this time there's no support for any other architecture because LLVM itself
does not have support for other architectures.
2017-07-06 08:58:19 -07:00
Alex Crichton 695dee063b rustc: Implement the #[global_allocator] attribute
This PR is an implementation of [RFC 1974] which specifies a new method of
defining a global allocator for a program. This obsoletes the old
`#![allocator]` attribute and also removes support for it.

[RFC 1974]: https://github.com/rust-lang/rfcs/pull/197

The new `#[global_allocator]` attribute solves many issues encountered with the
`#![allocator]` attribute such as composition and restrictions on the crate
graph itself. The compiler now has much more control over the ABI of the
allocator and how it's implemented, allowing much more freedom in terms of how
this feature is implemented.

cc #27389
2017-07-05 14:37:01 -07:00
bors 04145943a2 Auto merge of #39409 - pnkfelix:mir-borrowck2, r=nikomatsakis
MIR EndRegion Statements (was MIR dataflow for Borrows)

This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow).

An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...)

This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
2017-06-19 13:01:27 +00:00
Simonas Kazlauskas 406eddf5e1 Add a no-system-llvm compilecheck header 2017-06-15 19:11:55 +03:00
Felix S. Klock II 163d40d1d8 Update test/codegen/drop.rs to reflect inconsequential change in basic block ordering. 2017-06-12 13:06:42 +02:00
Simonas Kazlauskas 8938269db6 Upgrade LLVM
Includes https://github.com/rust-lang/llvm/pull/80
Includes https://github.com/rust-lang/llvm/pull/79

Also adds tests and thus fixes #24194
2017-06-08 17:09:28 +03:00
Eduard-Mihai Burtescu 1a2eb4953e rustc_trans: do not store pair fields if they are ZSTs. 2017-06-06 21:13:13 +03:00
kennytm 3e6c83de1d
compiletest: Force directive to be first complete word in header comment.
Refactored some related code to take advantage of this change.
2017-06-02 23:28:22 +08:00
Falco Hirschenberger f83901bb89 Adding support for the llvm prefetch intrinsic
Related to #37251
2017-06-01 08:34:16 +02:00
Cameron Hart 1dd082fb3e Add simple [repr(align)] codegen test.
Checks alloca and memcpy are aligned correctly.
2017-05-01 23:13:22 +10:00
Michael Woerister 8ea050d89d Disable path remapping test on Windows. 2017-04-28 13:30:07 +02:00
Michael Woerister 5c62ce4a82 Make codegen test for remap-path-prefix more thorough. 2017-04-26 15:44:02 +02:00
Michael Woerister 39ffea31df Implement a file-path remapping feature in support of debuginfo and reproducible builds. 2017-04-26 15:44:02 +02:00
Ariel Ben-Yehuda 3bf00450cb remove cleanup branches to the resume block
This improves LLVM performance by 10% lost during the shimmir transition.
2017-04-22 21:00:50 +03:00
Ariel Ben-Yehuda ed3810bf5e lower move_val_init during MIR construction
Because of its "magic" order-of-evaluation semantics, `move_val_init`
must be lowered during MIR construction in order to work.
2017-04-18 15:09:11 +03:00
Corey Farwell e6f6b445aa Rollup merge of #40702 - mrhota:global_asm, r=nagisa
Implement global_asm!() (RFC 1548)

This is a first attempt. ~~One (potential) problem I haven't solved is how to handle multiple usages of `global_asm!` in a module/crate. It looks like `LLVMSetModuleInlineAsm` overwrites module asm, and `LLVMAppendModuleInlineAsm` is not provided in LLVM C headers 😦~~

I can provide more detail as needed, but honestly, there's not a lot going on here.

r? @eddyb

CC @Amanieu @jackpot51

Tracking issue: #35119
2017-04-14 17:41:03 -04:00
A.J. Gardner da0742c070 Add global_asm tests 2017-04-12 19:12:50 -05:00
Eduard-Mihai Burtescu 9b5c577dbd rustc_trans: avoid a separate entry BB if START_BLOCK has no backedges. 2017-04-12 20:20:53 +03:00
Eduard-Mihai Burtescu f0636b61c7 rustc_trans: use ty::layout for ABI computation instead of LLVM types. 2017-04-09 16:06:56 +03:00
Björn Steinbrink 0ba7da3449 Ignore tests for the personality slot lifetimes on MSVC
Exception handling on MSVC targets doesn't use personality slots.
2017-03-31 20:09:37 +02:00
Björn Steinbrink 1eaa113581 Emit proper lifetime start intrinsics for personality slots
We currently only emit a single call to the lifetime start intrinsic
for the personality slot alloca. This happens because we create that
call at the time that we create the alloca, instead of creating it each
time we start using it. Because LLVM usually removes the alloca before
the lifetime intrinsics are even considered, this didn't cause any
problems yet, but we should fix this anyway.
2017-03-29 20:43:01 +02:00
Alex Crichton ef90d32f07
rustc: Always emit the uwtable attribute on Windows
This commit alters the translation layer to unconditionally emit the `uwtable`
LLVM attribute on Windows regardless of the `no_landing_pads` setting.
Previously I believe we omitted this attribute as an optimization when the
`-Cpanic=abort` flag was passed, but this unfortunately caused problems for
Gecko.

It [was discovered] that there was trouble unwinding through Rust functions due
to foreign exceptions such as illegal instructions or otherwise in-practice
methods used to abort a process. In testing it looked like the major difference
between a working binary and a non-working binary is indeed this `uwtable`
attribute, but this PR has unfortunately not been thoroughly tested in terms of
compiling Gecko with `-C panic=abort` *and* this PR to see whether it works, so
this is still somewhat working on just suspicion.

[was discovered]: https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
2017-03-21 16:47:10 -04:00
Ariel Ben-Yehuda 32c9893432 emit !align attributes on stores of operand pairs
cc #40373
2017-03-13 11:52:41 +02:00
topecongiro 7dc36e9d99 Add tests for issues with the 'E-needtest' label. 2017-03-07 14:01:19 +09:00
bors f0b514524f Auto merge of #40133 - arielb1:operand-lifetimes, r=eddyb
[MIR] improve operand lifetimes

r? @eddyb
2017-03-03 13:12:08 +00:00
Ariel Ben-Yehuda 3ffa971212 fix codegen test 2017-03-03 13:54:19 +02:00
Philipp Oppermann b44805875e Add support for x86-interrupt calling convention
Tracking issue: https://github.com/rust-lang/rust/issues/40180

This calling convention can be used for definining interrupt handlers on
32-bit and 64-bit x86 targets. The compiler then uses `iret` instead of
`ret` for returning and ensures that all registers are restored to their
original values.

Usage:

```
extern "x86-interrupt" fn handler(stack_frame: &ExceptionStackFrame) {…}
```

for interrupts and exceptions without error code and

```
extern "x86-interrupt" fn page_fault_handler(stack_frame: &ExceptionStackFrame,
                                             error_code: u64) {…}
```

for exceptions that push an error code (e.g., page faults or general
protection faults). The programmer must ensure that the correct version
is used for each interrupt.

For more details see the [LLVM PR][1] and the corresponding [proposal][2].

[1]: https://reviews.llvm.org/D15567
[2]: http://lists.llvm.org/pipermail/cfe-dev/2015-September/045171.html
2017-03-02 19:01:15 +01:00
James Miller d80cf80b16 Update codegen test with new attributes 2017-02-22 09:49:12 +13:00
Simonas Kazlauskas 49ccc106da Rebase fixups 2017-02-10 19:47:09 +02:00
Simonas Kazlauskas 76d9a4e646 Fix codegen test 2017-02-10 19:44:00 +02:00
bors 4053276354 Auto merge of #38109 - tromey:main-subprogram, r=michaelwoerister
Emit DW_AT_main_subprogram

This changes rustc to emit DW_AT_main_subprogram on the "main" program.
This lets gdb suitably stop at the user's main in response to
"start" (rather than the library's main, which is what happens
currently).

Fixes #32620
r? michaelwoerister
2017-02-09 17:09:50 +00: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
Tom Tromey b037c5211b Emit DW_AT_main_subprogram
This changes rustc to emit DW_AT_main_subprogram on the "main" program.
This lets gdb suitably stop at the user's main in response to
"start" (rather than the library's main, which is what happens
currently).

Fixes #32620
r? michaelwoerister
2017-02-04 23:19:39 -07:00
Alex Crichton e8f9d2d43a travis: Get an emscripten builder online
This commit adds a new entry to the Travis matrix which will execute emscripten
test suites. Along the way it updates a few bits of the test suite to continue
passing on emscripten, such as:

* Ignoring i128/u128 tests as they're presumably just not working (didn't
  investigate as to why)
* Disabling a few process tests (not working on emscripten)
* Ignore some num tests in libstd (#39119)
* Fix some warnings when compiling
2017-01-19 13:54:19 -08:00
Mark Simulacrum 1be170b01a Replace BlockAndBuilder with Builder. 2017-01-04 11:33:31 -07:00
Ivan Molodetskikh 5e2cea9a4e
Cleaned up the code and added tests. 2016-12-22 14:54:42 +03:00
Vadim Chugunov 2e03549e67 Ignore test on -windows-gnu. 2016-12-03 15:01:09 -08:00
Vadim Chugunov bc019dfb39 Emit 'dllimport' attribute for dylib foreign items on Windows. 2016-12-01 16:22:04 -08:00
Michael Woerister fd4ee0021e Fix codegen test after change of llvm type naming scheme 2016-11-13 19:49:56 -05:00
bors 586a988313 Auto merge of #36421 - TimNN:check-abis, r=alexcrichton
check target abi support

This PR checks for each extern function / block whether the ABI / calling convention used is supported by the current target.

This was achieved by adding an `abi_blacklist` field to the target specifications, listing the calling conventions unsupported for that target.
2016-10-25 21:49:59 -07:00
Tim Neumann 1422ac9a8f adapt tests 2016-10-25 19:56:36 +02:00
Michael Woerister e46c1ad9c9 Adapt codegen test to new naming scheme for generated symbols. 2016-10-21 18:29:25 -04:00
Ulrik Sverdrup ed5015939f Expand .zip() specialization to .map() and .cloned()
Implement .zip() specialization for Map and Cloned.

The crucial thing for transparent specialization is that we want to
preserve the potential side effects.

The simplest example is that in this code snippet:

`(0..6).map(f).zip((0..4).map(g)).count()`

`f` will be called five times, and `g` four times. The last time for `f`
is when the other iterator is at its end, so this element is unused.
This side effect can be preserved without disturbing code generation for
simple uses of `.map()`.

The `Zip::next_back()` case is even more complicated, unfortunately.
2016-10-17 10:58:21 +02:00
Ariel Ben-Yehuda 45fe3a1a2a emit an assume that cast-from enums are in range
Fixes #36955.
2016-10-05 14:12:30 +03:00
Jonas Schievink 34155a87f6 Change the local prefix to _
There's no need for a long prefix, since there's nothing to distinguish
anymore.
2016-09-29 01:11:54 +02:00
Jonas Schievink 168a0795c6 Fix codegen test (value names changed) 2016-09-27 02:20:46 +02:00
bors 9966397b61 Auto merge of #36151 - camlorn:struct_layout_optimization, r=eddyb
refactor to remove trans::adt and make rustc::ty::layout authoritative

I asked on IRC about optimizing struct layout by reordering fields from most-aligned to least-aligned and somehow ended up getting talked into doing this.  The goal here is to make `layout` authoritative and to remove `adt`.  The former has been accomplished by reimplementing `represent_type_uncached` and the latter is in progress.  @eddyb thought I should make the PR now.

My plan is to reserve the actual optimization for a second PR, as this work is useful by itself.
2016-09-25 18:47:00 -07:00
Austin Hicks f2f7ace213 Update codegen/link_section.rs. 2016-09-24 21:56:26 -04:00