Skip to content

Commit

Permalink
[AVR][NO UPSTREAM] Disable the floating point conversion and bignum m…
Browse files Browse the repository at this point in the history
…odules

These do not compile because of avr-rust/rust-legacy-fork#92.

The error message looks like

```
Impossible reg-to-reg copy
UNREACHABLE executed at /home/dylan/projects/llvm-project/llvm/lib/Target/AVR/AVRInstrInfo.cpp:75!
Stack dump:
0.	Program arguments: ./bin/llc -march=avr -mcpu=atmega328p bugpoint-reduced-simplified.ll -o /dev/null
1.	Running pass 'Function Pass Manager' on module 'bugpoint-reduced-simplified.ll'.
2. Running pass 'Post-RA pseudo instruction expansion pass' on function '@_ZN3lib3num7flt2dec8strategy5grisu22max_pow10_no_more_than17h83b3c65a945b5158E'
```

avr-rust/rust-legacy-fork#92
  • Loading branch information
dylanmckay committed Feb 22, 2018
1 parent 9859185 commit 3c1d53d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@

use fmt::{Formatter, Result, LowerExp, UpperExp, Display, Debug};
use mem;
#[cfg(not(target_arch = "avr"))]
use num::flt2dec;

// Don't inline this so callers don't use the stack space this function
// requires unless they have to.
#[inline(never)]
#[cfg(not(target_arch = "avr"))]
fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
sign: flt2dec::Sign, precision: usize) -> Result
where T: flt2dec::DecodableFloat
Expand Down
4 changes: 4 additions & 0 deletions core/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut};
use marker::PhantomData;
use mem;
#[cfg(not(target_arch = "avr"))]
use num::flt2dec;
use ops::Deref;
use result;
use slice;
use str;

#[cfg(not(target_arch = "avr"))]
mod float;
mod num;
mod builders;
Expand Down Expand Up @@ -1262,6 +1264,7 @@ impl<'a> Formatter<'a> {
/// Takes the formatted parts and applies the padding.
/// Assumes that the caller already has rendered the parts with required precision,
/// so that `self.precision` can be ignored.
#[cfg(not(target_arch = "avr"))]
fn pad_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
if let Some(mut width) = self.width {
// for the sign-aware zero padding, we render the sign first and
Expand Down Expand Up @@ -1301,6 +1304,7 @@ impl<'a> Formatter<'a> {
}
}

#[cfg(not(target_arch = "avr"))]
fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
fn write_bytes(buf: &mut Write, s: &[u8]) -> Result {
buf.write_str(unsafe { str::from_utf8_unchecked(s) })
Expand Down
4 changes: 4 additions & 0 deletions core/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> {
mod wrapping;

// All these modules are technically private and only exposed for coretests:
#[cfg(not(target_arch = "avr"))]
pub mod flt2dec;
#[cfg(not(target_arch = "avr"))]
pub mod dec2flt;
#[cfg(not(target_arch = "avr"))]
pub mod bignum;
pub mod diy_float;

Expand Down Expand Up @@ -3577,6 +3580,7 @@ impl fmt::Display for ParseIntError {
}

#[stable(feature = "rust1", since = "1.0.0")]
#[cfg(not(target_arch = "avr"))]
pub use num::dec2flt::ParseFloatError;

// Conversion traits for primitive integer and float types
Expand Down

0 comments on commit 3c1d53d

Please sign in to comment.