about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-09 23:06:40 +0000
committerbors <bors@rust-lang.org>2022-09-09 23:06:40 +0000
commit395e56f39849defec8d6941f76625d286a6e5ddc (patch)
tree8b8aa68d407f03734ed5618934a743e2151381cd /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent1d37ed661a6922e7a167609b8cd7eb31e972b19b (diff)
parent07a9c10fe6d67cbd3d33a17002e9b41310e6c3a0 (diff)
downloadrust-395e56f39849defec8d6941f76625d286a6e5ddc.tar.gz
rust-395e56f39849defec8d6941f76625d286a6e5ddc.zip
Auto merge of #101617 - Dylan-DPC:rollup-iiy4ipc, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #101366 (Restore old behaviour on broken UNC paths)
 - #101492 (Suggest adding array lengths to references to arrays if possible)
 - #101529 (Fix the example code and doctest for Formatter::sign_plus)
 - #101573 (update `ParamKindOrd`)
 - #101612 (Fix code generation of `Rvalue::Repeat` with 128 bit values)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 931ce78721c..6ee3c7d6821 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1618,6 +1618,14 @@ extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty,
   return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList));
 }
 
+extern "C" bool LLVMRustConstIntGetZExtValue(LLVMValueRef CV, uint64_t *value) {
+    auto C = unwrap<llvm::ConstantInt>(CV);
+    if (C->getBitWidth() > 64)
+      return false;
+    *value = C->getZExtValue();
+    return true;
+}
+
 // Returns true if both high and low were successfully set. Fails in case constant wasn’t any of
 // the common sizes (1, 8, 16, 32, 64, 128 bits)
 extern "C" bool LLVMRustConstInt128Get(LLVMValueRef CV, bool sext, uint64_t *high, uint64_t *low)