Commit Graph

1218 Commits

Author SHA1 Message Date
antoyo
1a9ae8d473
Merge pull request #133 from bjorn3/less_exports
Don't export global allocs which are not statics
2022-02-27 10:28:28 -05:00
bjorn3
beb1767842 Don't export global allocs which are not statics
They aren't be referenced outside of the current cgu anyway. This should make
optimizations a bit more effective.
2022-02-27 10:14:50 +01:00
antoyo
710b7415cd
Merge pull request #132 from bjorn3/panic_unwind
Support -Cpanic=unwind without unwinding
2022-02-27 00:14:57 -05:00
bjorn3
ac4baf3fd6 Allow unreachable blocks for now
The cleanup blocks normally executed when unwinding are unreachable for
now as unwinding is not yet implemented.
2022-02-26 19:35:33 +01:00
bjorn3
f7063174a4 Support -Cpanic=unwind without unwinding 2022-02-26 19:35:33 +01:00
antoyo
1fb9821f82
Merge pull request #131 from bjorn3/fix_non_singleton_builder
Fix miscompilation when cg_ssa is using multiple builders at the same time
2022-02-26 13:02:18 -05:00
bjorn3
9d098424cd Add and change a TODO 2022-02-26 18:30:07 +01:00
bjorn3
3e35fab71e Fix inttoptr 2022-02-26 09:41:37 +01:00
bjorn3
a7c1c47c83 Fix review comments 2022-02-25 17:25:32 +01:00
bjorn3
62e9b50f8d Remove current_block field of CodegenCx
This field often had the wrong value when using multiple builders at the
same time.
2022-02-25 15:38:23 +01:00
bjorn3
07afdb8c0d Use bitcast for ptrtoint and inttoptr
This works now
2022-02-25 15:36:08 +01:00
bjorn3
b48ed38482 Make bx.block non-optional 2022-02-25 15:30:07 +01:00
bjorn3
ff6b398f1b Use bx.switch_to_block where possible 2022-02-25 15:28:56 +01:00
antoyo
ddbbded08f
Merge pull request #130 from bjorn3/rustup
Rustup to rustc 1.61.0-nightly (4b043faba 2022-02-24)
2022-02-25 09:12:31 -05:00
bjorn3
d565f60054 Rustup to rustc 1.61.0-nightly (4b043faba 2022-02-24) 2022-02-25 11:29:57 +01:00
bjorn3
471234f8aa Sync from rust 3d127e2040 2022-02-24 19:25:07 +01:00
bors
648d038c86 Auto merge of #94123 - bjorn3:cg_ssa_singleton_builder, r=tmiasko
Partially move cg_ssa towards using a single builder

Not all codegen backends can handle hopping between blocks well. For example Cranelift requires blocks to be terminated before switching to building a new block. Rust-gpu requires a `RefCell` to allow hopping between blocks and cg_gcc currently has a buggy implementation of hopping between blocks. This PR reduces the amount of cases where cg_ssa switches between blocks before they are finished and mostly fixes the block hopping in cg_gcc. (~~only `scalar_to_backend` doesn't handle it correctly yet in cg_gcc~~ fixed that one.)

`@antoyo` please review the cg_gcc changes.
2022-02-24 12:28:19 +00:00
bjorn3
18c34e41a4 Introduce Bx::switch_to_block 2022-02-24 12:18:21 +01:00
bjorn3
56b7080bdb Remove build_sibling_block 2022-02-20 13:38:15 +01:00
antoyo
164aa39fbe
Merge pull request #127 from JBBgameich/readme-compiler-rt
README: Add compiler-rt cloning step
2022-02-19 14:02:18 -05:00
Jonah Brüchert
4cdcf035a6
README: Add compiler-rt cloning step 2022-02-19 19:59:03 +01:00
Mark Rousskov
e855e2d15c Move ty::print methods to Drop-based scope guards 2022-02-16 17:24:23 -05:00
bjorn3
40d30ceb43 Unconditionally update symbols
All paths to an ArchiveBuilder::build call update_symbols first.
2022-02-10 18:27:18 +01:00
bors
22a30689ed Auto merge of #93511 - cjgillot:query-copy, r=oli-obk
Ensure that queries only return Copy types.

This should pervent the perf footgun of returning a result with an expensive `Clone` impl (like a `Vec` of a hash map).

I went for the stupid solution of allocating on an arena everything that was not `Copy`. Some query results could be made Copy easily, but I did not really investigate.
2022-02-10 09:37:07 +00:00
Camille GILLOT
1b2337c19d Make FnAbiError Copy. 2022-02-09 20:11:29 +01:00
Camille GILLOT
96340e5668 Ensure that queries only return Copy types. 2022-02-09 20:07:38 +01:00
cynecx
20506e31ab #[used(linker)] attribute (https://github.com/dtolnay/linkme/issues/41) 2022-02-06 20:23:23 +01:00
antoyo
b4ad63c687
Merge pull request #122 from bjorn3/rustup
Rustup to rustc 1.60.0-nightly (a00e130da 2022-01-29)
2022-02-01 12:32:43 -05:00
bjorn3
477d102697 Move coretests to the 2021 edition 2022-02-01 17:58:06 +01:00
bjorn3
5067ad9edc Replace unimplemented with todo in apply_attrs_to_cleanup_callsite 2022-02-01 17:58:06 +01:00
bjorn3
9c3a1235c5 Fix type_kind implementation 2022-02-01 17:58:03 +01:00
bjorn3
7aaa87bcd2 Rustup to rustc 1.60.0-nightly (a00e130da 2022-01-29) 2022-02-01 17:50:17 +01:00
bjorn3
28ba4302cc Sync from rust a00e130dae 2022-02-01 17:49:41 +01:00
antoyo
72d89b0c85
Merge pull request #125 from rust-lang/fix/simd-slice
Implement simd_neg
2022-01-31 19:37:33 -05:00
Antoni Boucher
9c3cce661f Implement simd_neg 2022-01-31 18:39:14 -05:00
antoyo
41f20fa3a5
Support 128-bit integers on platforms without native support (#103)
* Use sized integer types

* Add support for integer types not supported on some platforms

* Add feature to test non-native integers in CI
2022-01-30 21:45:14 -05:00
antoyo
b7bfb21242
Merge pull request #118 from bjorn3/function_sections
Support -Zfunction-sections
2022-01-26 10:22:06 -05:00
bjorn3
99941cd9d2 Support -Zfunction-sections
This puts every function and data object in their own section. This
allows the linker to omit unused functions and data objects with
--gc-sections.

On linux this shrinks a hello world binary without optimizations
(neither sysroot nor binary) from 17MB to 13MB. It shrinks a hello world
binary with only sysroot optimizations from 14MB to 13MB. For comparison
cg_llvm produces a 3.5MB debug mode hello world binary with an optimized
sysroot. Cg_clif produces a 10MB debug mode hello world binary without
an optimized sysroot.
2022-01-26 15:13:55 +01:00
antoyo
5dc660b106
Support upgrading the alignment of a global variable (#121)
* Renable failing test
* Update to newest gccjit.rs
2022-01-26 08:57:17 -05:00
antoyo
fc236785a2
Merge pull request #115 from bjorn3/foreign_statics
Correctly import foreign statics
2022-01-25 09:17:50 -05:00
bjorn3
6663f4e78e Move rustup component installation to rust-toolchain
This allows cargo check to function correctly without having to first
run prepare_build.sh. cg_clif has been using rust-toolchain too for a
while now.
2022-01-25 13:28:42 +01:00
bjorn3
cd5d42aad7 Correctly import foreign statics
Previously foreign statics would actually cause a local static to be
defined and exported. This issue was found because std::env::vars() was
found to return no env vars despite many being defined. This was caused
by libstd importing environ as foreign static. The accidental definition
of environ caused libstd to read a null pointer which was interpreted as
there being no environment variables at all.

Also fix tests. STDOUT is not defined by libc. The correct name is stdout.
This previously worked as STDOUT was incorrectly defined as null pointer
during codegen.
2022-01-25 13:16:44 +01:00
bjorn3
4bdc78436b Merge landing_pad and set_cleanup into cleanup_landing_pad 2022-01-24 14:10:05 +01:00
bjorn3
2eaf0bc20a Merge add_handler into catch_switch
Some codegen backends may require all handlers to be immediately known
2022-01-24 14:10:05 +01:00
bjorn3
81597f2721 Remove unused return values from resume and cleanup_ret
Given that these instructions are diverging, not every codegen backend
may be able to produce a return value for them.
2022-01-24 13:48:09 +01:00
bjorn3
ba419539d5 Reorder unwinding related builder methods to differentiate between dwarf and msvc instructions 2022-01-24 13:45:34 +01:00
William D. Jones
94dc3753aa Add preliminary support for inline assembly for msp430. 2022-01-22 23:42:46 -05:00
bjorn3
47c311a705 Use Symbol for target features in asm handling
This saves a couple of Symbol::intern calls
2022-01-17 18:06:27 +01:00
Antoni Boucher
e690fb1273 Add comment 2022-01-15 08:57:34 -05:00
Tomasz Miąsko
68cbb46913 Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00