about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/allocator.rs
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2020-10-14 18:22:10 +0200
committerest31 <MTest31@outlook.com>2020-10-15 12:02:23 +0200
commit0d1aa1e0346630189b779da0939e8138a8e6d668 (patch)
treedf045171720cf7ec7a7dc87d896823f87134c709 /compiler/rustc_codegen_llvm/src/allocator.rs
parent64ba25d0f2137aade97a0cfabc9ad2547bd6b376 (diff)
downloadrust-0d1aa1e0346630189b779da0939e8138a8e6d668.tar.gz
rust-0d1aa1e0346630189b779da0939e8138a8e6d668.zip
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.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/allocator.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/allocator.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/allocator.rs b/compiler/rustc_codegen_llvm/src/allocator.rs
index e028b2c2dc7..237ef688f88 100644
--- a/compiler/rustc_codegen_llvm/src/allocator.rs
+++ b/compiler/rustc_codegen_llvm/src/allocator.rs
@@ -16,10 +16,10 @@ pub(crate) unsafe fn codegen(
 ) {
     let llcx = &*mods.llcx;
     let llmod = mods.llmod();
-    let usize = match &tcx.sess.target.target.target_pointer_width[..] {
-        "16" => llvm::LLVMInt16TypeInContext(llcx),
-        "32" => llvm::LLVMInt32TypeInContext(llcx),
-        "64" => llvm::LLVMInt64TypeInContext(llcx),
+    let usize = match tcx.sess.target.target.pointer_width {
+        16 => llvm::LLVMInt16TypeInContext(llcx),
+        32 => llvm::LLVMInt32TypeInContext(llcx),
+        64 => llvm::LLVMInt64TypeInContext(llcx),
         tws => bug!("Unsupported target word size for int: {}", tws),
     };
     let i8 = llvm::LLVMInt8TypeInContext(llcx);