summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAmaury Sechet <deadalnix@gmail.com>2016-02-17 22:51:03 +0000
committerAmaury Sechet <deadalnix@gmail.com>2016-02-17 22:51:03 +0000
commit053ac453b9f8e6045fd915abde13663636383429 (patch)
tree11e543ce651600bd9337e89f9bfe055d4b0fae0c /llvm/lib
parent2a9ac0d2c538a97711bb39f44551a7836ca07fb5 (diff)
downloadbcm5719-llvm-053ac453b9f8e6045fd915abde13663636383429.tar.gz
bcm5719-llvm-053ac453b9f8e6045fd915abde13663636383429.zip
Add support for memory operations (load/store/gep) in C API echo test
Summary: As per title. Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17245 llvm-svn: 261174
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Core.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp
index 73764af4da9..585a24020bc 100644
--- a/llvm/lib/IR/Core.cpp
+++ b/llvm/lib/IR/Core.cpp
@@ -2147,6 +2147,16 @@ LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca) {
return wrap(unwrap<AllocaInst>(Alloca)->getAllocatedType());
}
+/*--.. Operations on gep instructions (only) ...............................--*/
+
+LLVMBool LLVMIsInBounds(LLVMValueRef GEP) {
+ return unwrap<GetElementPtrInst>(GEP)->isInBounds();
+}
+
+void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool b) {
+ return unwrap<GetElementPtrInst>(GEP)->setIsInBounds(b);
+}
+
/*--.. Operations on phi nodes .............................................--*/
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
@@ -2172,6 +2182,8 @@ LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index) {
unsigned LLVMGetNumIndices(LLVMValueRef Inst) {
auto *I = unwrap(Inst);
+ if (auto *GEP = dyn_cast<GetElementPtrInst>(I))
+ return GEP->getNumIndices();
if (auto *EV = dyn_cast<ExtractValueInst>(I))
return EV->getNumIndices();
if (auto *IV = dyn_cast<InsertValueInst>(I))
OpenPOWER on IntegriCloud