Rename target_pointer_width to pointer_width and turn it into an u32

Rename target_pointer_width to pointer_width because it is already
member of the Target struct.

The compiler supports only three valid values for target_pointer_width:
16, 32, 64. Thus it can safely be turned into an int.
This means less allocations and clones as well as easier handling of the type.
This commit is contained in:
est31 2020-10-14 18:22:10 +02:00
parent 64ba25d0f2
commit 0d1aa1e034
5 changed files with 28 additions and 24 deletions

View file

@ -307,7 +307,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
pub allocator_module_config: Arc<ModuleConfig>,
pub tm_factory: TargetMachineFactory<B>,
pub msvc_imps_needed: bool,
pub target_pointer_width: String,
pub target_pointer_width: u32,
pub target_arch: String,
pub debuginfo: config::DebugInfo,
@ -1022,7 +1022,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
tm_factory: TargetMachineFactory(backend.target_machine_factory(tcx.sess, ol)),
total_cgus,
msvc_imps_needed: msvc_imps_needed(tcx),
target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
target_pointer_width: tcx.sess.target.target.pointer_width,
target_arch: tcx.sess.target.target.arch.clone(),
debuginfo: tcx.sess.opts.debuginfo,
};