about summary refs log tree commit diff
path: root/src/test/codegen
AgeCommit message (Collapse)AuthorLines
2017-03-03fix codegen testAriel Ben-Yehuda-5/+3
2017-03-02Add support for x86-interrupt calling conventionPhilipp Oppermann-0/+28
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-02-22Update codegen test with new attributesJames Miller-2/+2
2017-02-10Rebase fixupsSimonas Kazlauskas-1/+1
2017-02-10Fix codegen testSimonas Kazlauskas-3/+7
2017-02-09Auto merge of #38109 - tromey:main-subprogram, r=michaelwoeristerbors-0/+56
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-08emit "align 1" metadata on loads/stores of packed structsAriel Ben-Yehuda-0/+29
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-04Emit DW_AT_main_subprogramTom Tromey-0/+56
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-01-19travis: Get an emscripten builder onlineAlex Crichton-0/+1
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-04Replace BlockAndBuilder with Builder.Mark Simulacrum-2/+2
2016-12-22Cleaned up the code and added tests.Ivan Molodetskikh-0/+85
2016-12-03Ignore test on -windows-gnu.Vadim Chugunov-1/+2
2016-12-01Emit 'dllimport' attribute for dylib foreign items on Windows.Vadim Chugunov-0/+103
2016-11-13Fix codegen test after change of llvm type naming schemeMichael Woerister-4/+4
2016-10-25Auto merge of #36421 - TimNN:check-abis, r=alexcrichtonbors-0/+6
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-25adapt testsTim Neumann-0/+6
2016-10-21Adapt codegen test to new naming scheme for generated symbols.Michael Woerister-3/+3
2016-10-17Expand .zip() specialization to .map() and .cloned()Ulrik Sverdrup-0/+9
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-05emit an assume that cast-from enums are in rangeAriel Ben-Yehuda-0/+24
Fixes #36955.
2016-09-29Change the `local` prefix to `_`Jonas Schievink-4/+4
There's no need for a long prefix, since there's nothing to distinguish anymore.
2016-09-27Fix codegen test (value names changed)Jonas Schievink-4/+4
2016-09-25Auto merge of #36151 - camlorn:struct_layout_optimization, r=eddybbors-2/+2
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-24Update codegen/link_section.rs.Austin Hicks-2/+2
2016-09-24librustc_mir: Propagate constants during copy propagation.Patrick Walton-2/+2
This optimization kicks in a lot when bootstrapping the compiler.
2016-09-19librustc: Implement def-use chains and trivial copy propagation on MIR.Patrick Walton-2/+2
This only supports trivial cases in which there is exactly one def and one use.
2016-09-13Auto merge of #36181 - seanmonstar:likely, r=nikomatsakisbors-0/+41
core: add likely and unlikely intrinsics I'm no good at reading assembly, but I have tried a stage1 compiler with this patch, and it does cause different asm output. Additionally, testing this compiler on my httparse crate with some `likely` usage added in to the branches does affect benchmarks. However, I'm sure a codegen test should be included, if anyone knows what it should look like. There isn't an entry in `librustc_trans/context.rs` in this diff, because it already exists (`llvm.expect.i1` is used for array indices). ---- Even though this does affect httparse benchmarks, it doesn't seem to affect it the same way GCC's `__builtin_expect` affects picohttpparser. I was confused that the deviation on the benchmarks grew hugely when testing this, especially since I'm absolutely certain that the branchs where I added `likely` were always `true`. I chalk that up to GCC and LLVM handle branch prediction differently. cc #26179
2016-09-02core: add likely and unlikely intrinsicsSean McArthur-0/+41
2016-08-30Feature gate the sysv64 abi as feature(abi_sysv64) and add testsCensoredUsername-0/+24
2016-08-24Disable old trans access via -Z orbit, #[rustc_no_mir] or --disable-orbit.Eduard Burtescu-45/+30
2016-08-14[MIR] Add Storage{Live,Dead} statements to emit llvm.lifetime.{start,end}.Eduard Burtescu-0/+54
2016-07-19Add codegen test to make sure that closures are 'internalized' properly.Michael Woerister-0/+20
2016-07-08Fix codegen tests by make sure items are translated in AST order.Michael Woerister-7/+7
2016-06-20trans: generalize immediate temporaries to all MIR locals.Eduard Burtescu-1/+6
2016-06-14specialize zip: Add codegen testUlrik Sverdrup-0/+22
2016-06-13Auto merge of #34252 - dsprenkels:issue-32364-test, r=eddybbors-0/+24
Add regression test for #32364 This PR adds a regression test for #32364. r? @eddyb
2016-06-13Add regression test for #32364Daan Sprenkels-0/+24
2016-06-12Auto merge of #34241 - dsprenkels:issue-32031-test, r=eddybbors-0/+33
add a test case for issue #32031 I propose a test case to finish the fix for issue #32031. Please review this commit thoroughly, as I have never written a codegen test before. r? @eddyb
2016-06-12add a test case for issue #32031Daan Sprenkels-0/+33
2016-06-08trans: always use a memcpy for ABI argument/return casts.Eduard Burtescu-4/+12
2016-05-26Fix stores codegen passSimonas Kazlauskas-4/+4
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-0/+31
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-03-22Add testsTicki-0/+69
2016-03-18Add intrinsics for float arithmetic with `fast` flag enabledUlrik Sverdrup-0/+60
`fast` a.k.a UnsafeAlgebra is the flag for enabling all "unsafe" (according to llvm) float optimizations. See LangRef for more information http://llvm.org/docs/LangRef.html#fast-math-flags Providing these operations with less precise associativity rules (for example) is useful to numerical applications. For example, the summation loop: let sum = 0.; for element in data { sum += *element; } Using the default floating point semantics, this loop expresses the floats must be added in a sequence, one after another. This constraint is usually completely unintended, and it means that no autovectorization is possible.
2016-03-17Add #[rustc_no_mir] to make tests pass with -Z orbit.Eduard Burtescu-0/+17
2016-03-17tests: Use arguments in codegen/stores.rs to turn aggregates into immediates.Eduard Burtescu-15/+8
2016-03-17tests: Force instantiation of extern fns.Eduard Burtescu-0/+5
2016-02-10Workaround LLVM optimizer bug by not marking &mut pointers as noaliasBjörn Steinbrink-3/+6
LLVM's memory dependence analysis doesn't properly account for calls that could unwind and thus effectively act as a branching point. This can lead to stores that are only visible when the call unwinds being removed, possibly leading to calls to drop() functions with b0rked memory contents. As there is no fix for this in LLVM yet and we want to keep compatibility to current LLVM versions anyways, we have to workaround this bug by omitting the noalias attribute on &mut function arguments. Benchmarks suggest that the performance loss by this change is very small. Thanks to @RalfJung for pushing me towards not removing too many noalias annotations and @alexcrichton for helping out with the test for this bug. Fixes #29485
2016-02-04Avoid quadratic growth of functions due to cleanupsBjörn Steinbrink-0/+47
If a new cleanup is added to a cleanup scope, the cached exits for that scope are cleared, so all previous cleanups have to be translated again. In the worst case this means that we get N distinct landing pads where the last one has N cleanups, then N-1 and so on. As new cleanups are to be executed before older ones, we can instead cache the number of already translated cleanups in addition to the block that contains them, and then only translate new ones, if any and then jump to the cached ones, getting away with linear growth instead. For the crate in #31381 this reduces the compile time for an optimized build from >20 minutes (I cancelled the build at that point) to about 11 seconds. Testing a few crates that come with rustc show compile time improvements somewhere between 1 and 8%. The "big" winner being rustc_platform_intrinsics which features code similar to that in #31381. Fixes #31381
2016-01-12[MIR] Avoid some code generation for stores of ZSTSimonas Kazlauskas-0/+27
Fixes #30831
2015-11-20Avoid FCA loads and extractvalue when copying fat pointersBjörn Steinbrink-0/+22
Since fat pointers do not qualify as structural types, they got copied using load_ty and store_ty, which means that we load an FCA and use extractvalue to get the components of the fat pointer. This breaks certain optimizations in LLVM. Found via apasel422/ref_count#13