Support serializing CodegenContext
This commit is contained in:
parent
506ed6dcb7
commit
2c44bb13c6
3 changed files with 13 additions and 11 deletions
|
|
@ -23,6 +23,7 @@ use rustc_hir::find_attr;
|
|||
use rustc_incremental::{
|
||||
copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess,
|
||||
};
|
||||
use rustc_macros::{Decodable, Encodable};
|
||||
use rustc_metadata::fs::copy_to_stdout;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
|
|
@ -50,7 +51,7 @@ use crate::{
|
|||
const PRE_LTO_BC_EXT: &str = "pre-lto.bc";
|
||||
|
||||
/// What kind of object file to emit.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Encodable, Decodable)]
|
||||
pub enum EmitObj {
|
||||
// No object file.
|
||||
None,
|
||||
|
|
@ -64,7 +65,7 @@ pub enum EmitObj {
|
|||
}
|
||||
|
||||
/// What kind of llvm bitcode section to embed in an object file.
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
#[derive(Clone, Copy, PartialEq, Encodable, Decodable)]
|
||||
pub enum BitcodeSection {
|
||||
// No bitcode section.
|
||||
None,
|
||||
|
|
@ -74,6 +75,7 @@ pub enum BitcodeSection {
|
|||
}
|
||||
|
||||
/// Module-specific configuration for `optimize_and_codegen`.
|
||||
#[derive(Encodable, Decodable)]
|
||||
pub struct ModuleConfig {
|
||||
/// Names of additional optimization passes to run.
|
||||
pub passes: Vec<String>,
|
||||
|
|
@ -319,7 +321,7 @@ pub type TargetMachineFactoryFn<B> = Arc<
|
|||
>;
|
||||
|
||||
/// Additional resources used by optimize_and_codegen (not module specific)
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Encodable, Decodable)]
|
||||
pub struct CodegenContext {
|
||||
// Resources needed when running LTO
|
||||
pub lto: Lto,
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ pub enum CFProtection {
|
|||
Full,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable_Generic)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash, HashStable_Generic, Encodable, Decodable)]
|
||||
pub enum OptLevel {
|
||||
/// `-Copt-level=0`
|
||||
No,
|
||||
|
|
@ -108,7 +108,7 @@ pub enum OptLevel {
|
|||
/// and taking other command line options into account.
|
||||
///
|
||||
/// Note that linker plugin-based LTO is a different mechanism entirely.
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Encodable, Decodable)]
|
||||
pub enum Lto {
|
||||
/// Don't do any LTO whatsoever.
|
||||
No,
|
||||
|
|
@ -190,7 +190,7 @@ pub enum CoverageLevel {
|
|||
}
|
||||
|
||||
// The different settings that the `-Z offload` flag can have.
|
||||
#[derive(Clone, PartialEq, Hash, Debug)]
|
||||
#[derive(Clone, PartialEq, Hash, Debug, Encodable, Decodable)]
|
||||
pub enum Offload {
|
||||
/// Entry point for `std::offload`, enables kernel compilation for a gpu device
|
||||
Device,
|
||||
|
|
@ -201,7 +201,7 @@ pub enum Offload {
|
|||
}
|
||||
|
||||
/// The different settings that the `-Z autodiff` flag can have.
|
||||
#[derive(Clone, PartialEq, Hash, Debug)]
|
||||
#[derive(Clone, PartialEq, Hash, Debug, Encodable, Decodable)]
|
||||
pub enum AutoDiff {
|
||||
/// Enable the autodiff opt pipeline
|
||||
Enable,
|
||||
|
|
@ -528,7 +528,7 @@ impl FmtDebug {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Hash, Debug)]
|
||||
#[derive(Clone, PartialEq, Hash, Debug, Encodable, Decodable)]
|
||||
pub enum SwitchWithOptPath {
|
||||
Enabled(Option<PathBuf>),
|
||||
Disabled,
|
||||
|
|
@ -583,7 +583,7 @@ pub enum MirStripDebugInfo {
|
|||
/// DWARF provides a mechanism which allows the linker to skip the sections which don't require
|
||||
/// link-time relocation - either by putting those sections in DWARF object files, or by keeping
|
||||
/// them in the object file in such a way that the linker will skip them.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Hash, Encodable, Decodable)]
|
||||
pub enum SplitDwarfKind {
|
||||
/// Sections which do not require relocation are written into object file but ignored by the
|
||||
/// linker.
|
||||
|
|
@ -1539,7 +1539,7 @@ pub enum EntryFnType {
|
|||
|
||||
pub use rustc_hir::attrs::CrateType;
|
||||
|
||||
#[derive(Clone, Hash, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Hash, Debug, PartialEq, Eq, Encodable, Decodable)]
|
||||
pub enum Passes {
|
||||
Some(Vec<String>),
|
||||
All,
|
||||
|
|
|
|||
|
|
@ -1082,7 +1082,7 @@ crate::target_spec_enum! {
|
|||
}
|
||||
|
||||
crate::target_spec_enum! {
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Encodable, Decodable)]
|
||||
pub enum SplitDebuginfo {
|
||||
/// Split debug-information is disabled, meaning that on supported platforms
|
||||
/// you can find all debug information in the executable itself. This is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue