diff options
| author | Manuel Drehwald <git@manuel.drehwald.info> | 2025-06-16 14:23:06 -0700 |
|---|---|---|
| committer | Manuel Drehwald <git@manuel.drehwald.info> | 2025-06-16 14:23:06 -0700 |
| commit | 6359123d25e8ff38c6fbf280559d5f829bec691f (patch) | |
| tree | 887d5247e61d141314d8c116407f4a05ea69c912 /compiler/rustc_codegen_llvm/src/context.rs | |
| parent | 7d3a1d49ab6bba49eae6536c77fc52152c9e3768 (diff) | |
| download | rust-6359123d25e8ff38c6fbf280559d5f829bec691f.tar.gz rust-6359123d25e8ff38c6fbf280559d5f829bec691f.zip | |
add and use generic get_const_int function
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 8d6e1d8941b..0684c69ec00 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -678,11 +678,8 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> { llvm::LLVMMetadataAsValue(self.llcx(), metadata) } - // FIXME(autodiff): We should split `ConstCodegenMethods` to pull the reusable parts - // onto a trait that is also implemented for GenericCx. - pub(crate) fn get_const_i64(&self, n: u64) -> &'ll Value { - let ty = unsafe { llvm::LLVMInt64TypeInContext(self.llcx()) }; - unsafe { llvm::LLVMConstInt(ty, n, llvm::False) } + pub(crate) fn get_const_int(&self, ty: &'ll Type, val: u64) -> &'ll Value { + unsafe { llvm::LLVMConstInt(ty, val, llvm::False) } } pub(crate) fn get_function(&self, name: &str) -> Option<&'ll Value> { |
