aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-05-15 19:50:34 +0000
committerDan Gohman <gohman@apple.com>2008-05-15 19:50:34 +0000
commit041e2eb51721bcfecee5d9c9fc409ff185526e47 (patch)
treebb8e3b74ffb3950147e74e621ffa5e8f14040cd2 /lib/VMCore/ConstantFold.cpp
parentd208a803a614a0ce6d5a8c6df045fd130f5dfed7 (diff)
downloadexternal_llvm-041e2eb51721bcfecee5d9c9fc409ff185526e47.zip
external_llvm-041e2eb51721bcfecee5d9c9fc409ff185526e47.tar.gz
external_llvm-041e2eb51721bcfecee5d9c9fc409ff185526e47.tar.bz2
IR support for extractvalue and insertvalue instructions. Also, begin
moving toward making structs and arrays first-class types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 5138031..0913c48 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -447,6 +447,21 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(const Constant *V1,
return ConstantVector::get(&Result[0], Result.size());
}
+Constant *llvm::ConstantFoldExtractValue(const Constant *Agg,
+ Constant* const *Idxs,
+ unsigned NumIdx) {
+ // FIXME: implement some constant folds
+ return 0;
+}
+
+Constant *llvm::ConstantFoldInsertValue(const Constant *Agg,
+ const Constant *Val,
+ Constant* const *Idxs,
+ unsigned NumIdx) {
+ // FIXME: implement some constant folds
+ return 0;
+}
+
/// EvalVectorOp - Given two vector constants and a function pointer, apply the
/// function pointer to each element pair, producing a new ConstantVector
/// constant. Either or both of V1 and V2 may be NULL, meaning a
@@ -1408,8 +1423,7 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
const PointerType *Ptr = cast<PointerType>(C->getType());
const Type *Ty = GetElementPtrInst::getIndexedType(Ptr,
(Value **)Idxs,
- (Value **)Idxs+NumIdx,
- true);
+ (Value **)Idxs+NumIdx);
assert(Ty != 0 && "Invalid indices for GEP!");
return UndefValue::get(PointerType::get(Ty, Ptr->getAddressSpace()));
}
@@ -1426,8 +1440,7 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
const PointerType *Ptr = cast<PointerType>(C->getType());
const Type *Ty = GetElementPtrInst::getIndexedType(Ptr,
(Value**)Idxs,
- (Value**)Idxs+NumIdx,
- true);
+ (Value**)Idxs+NumIdx);
assert(Ty != 0 && "Invalid indices for GEP!");
return
ConstantPointerNull::get(PointerType::get(Ty,Ptr->getAddressSpace()));