diff options
| author | bors <bors@rust-lang.org> | 2021-08-04 18:22:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-08-04 18:22:29 +0000 |
| commit | d54fbb98555c107fb62fb5ae1a5b8f4fc6ed3edc (patch) | |
| tree | 63f0a2cc0ac3e03b2a749db84f2c2477ba381d23 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 6fe0886723c9e08b800c9951f1c6f6a57b2bf22c (diff) | |
| parent | 8e0df32ad6dd4e171742dc159a08f247c1a256ab (diff) | |
| download | rust-d54fbb98555c107fb62fb5ae1a5b8f4fc6ed3edc.tar.gz rust-d54fbb98555c107fb62fb5ae1a5b8f4fc6ed3edc.zip | |
Auto merge of #87695 - tmiasko:gep-opaque-pointers, r=nagisa
Prepare GEP building for opaque pointers
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index 4cdc8a4155b..7666803911e 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -1551,6 +1551,16 @@ extern "C" void LLVMRustSetLinkage(LLVMValueRef V, LLVMSetLinkage(V, fromRust(RustLinkage)); } +extern "C" LLVMValueRef LLVMRustConstInBoundsGEP2(LLVMTypeRef Ty, + LLVMValueRef ConstantVal, + LLVMValueRef *ConstantIndices, + unsigned NumIndices) { + ArrayRef<Constant *> IdxList(unwrap<Constant>(ConstantIndices, NumIndices), + NumIndices); + Constant *Val = unwrap<Constant>(ConstantVal); + return wrap(ConstantExpr::getInBoundsGetElementPtr(unwrap(Ty), Val, IdxList)); +} + // 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) |
