Skip to main content

Lto

Struct Lto 

Source
pub struct Lto {
    pub requested: bool,
    pub jobs: LtoJobs,
    pub partition: Partition,
    pub compression: Option<u8>,
}
Expand description

What the -flto family asked for, which is a whole optimization this compiler does not do yet.

Link time optimization is the optimizer run once over the whole program instead of once per translation unit, which is the only way an inliner ever sees across a file boundary and is where most of what is left on the table after -O2 is. spec/09-optimizer.md says how it will work here: the IR goes into a section of the object, the driver finds those sections at link time, merges them into one module and generates code with everything visible.

None of that exists, so the whole family is read, checked and recorded rather than acted on. That is a different answer from the one -gsplit-dwarf gets in the same specification, and the difference is what ignoring each of them does. Ignoring -gsplit-dwarf means a file a build asked for never appears. Ignoring this means a program that is correct and slower than it could have been, which is what section 4.1 means by a hint about speed, and which is also what every compilation at -O0 already is.

The other half of the argument is about the object. gcc’s -flto object holds the bytecode and no machine code at all, so it is only useful to a link that knows about it; the objects here always hold the code, which is what -ffat-lto-objects asks gcc for. So a build that passes -flto to this compiler gets objects that are strictly more usable than the ones it would have got, rather than different ones.

Fields§

§requested: bool

Whether the last of -flto and -fno-lto on the command line was the first of the two.

§jobs: LtoJobs

How many processes to spread the link time work over.

§partition: Partition

How the program is cut up before the work is spread.

§compression: Option<u8>

How hard to compress the IR on its way into the object, from -flto-compression-level=, where None means whatever the compressor does when nobody says. Between 0 and 19, which is zstd’s range and is the range gcc checks against.

Trait Implementations§

Source§

impl Clone for Lto

Source§

fn clone(&self) -> Lto

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Lto

Source§

impl Debug for Lto

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Lto

Source§

fn default() -> Lto

Returns the “default value” for a type. Read more
Source§

impl Eq for Lto

Source§

impl PartialEq for Lto

Source§

fn eq(&self, other: &Lto) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Lto

Auto Trait Implementations§

§

impl Freeze for Lto

§

impl RefUnwindSafe for Lto

§

impl Send for Lto

§

impl Sync for Lto

§

impl Unpin for Lto

§

impl UnsafeUnpin for Lto

§

impl UnwindSafe for Lto

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.