diff options
| author | James Barford-Evans <james.barford-evans@arm.com> | 2024-08-08 11:15:03 +0100 |
|---|---|---|
| committer | James Barford-Evans <james.barford-evans@arm.com> | 2024-08-08 11:15:03 +0100 |
| commit | 27ca35aa1b949186d6cdec22c4d5cc4b18aae691 (patch) | |
| tree | 8177627cf0007892cb56a823cb250ba3ad02c41a /compiler/rustc_codegen_llvm/src/common.rs | |
| parent | e60ebb2f2c1facba87e7971798f3cbdfd309cd23 (diff) | |
| download | rust-27ca35aa1b949186d6cdec22c4d5cc4b18aae691.tar.gz rust-27ca35aa1b949186d6cdec22c4d5cc4b18aae691.zip | |
const vector passed to codegen
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/common.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/common.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index 197bbb9ddbf..283518ed2bc 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -100,11 +100,6 @@ impl<'ll> CodegenCx<'ll, '_> { unsafe { llvm::LLVMConstArray2(ty, elts.as_ptr(), len) } } - pub fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value { - let len = c_uint::try_from(elts.len()).expect("LLVMConstVector elements len overflow"); - unsafe { llvm::LLVMConstVector(elts.as_ptr(), len) } - } - pub fn const_bytes(&self, bytes: &[u8]) -> &'ll Value { bytes_in_context(self.llcx, bytes) } @@ -224,6 +219,11 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { struct_in_context(self.llcx, elts, packed) } + fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value { + let len = c_uint::try_from(elts.len()).expect("LLVMConstVector elements len overflow"); + unsafe { llvm::LLVMConstVector(elts.as_ptr(), len) } + } + fn const_to_opt_uint(&self, v: &'ll Value) -> Option<u64> { try_as_const_integral(v).and_then(|v| unsafe { let mut i = 0u64; |
