aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/TransformInternals.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-08 20:19:56 +0000
committerChris Lattner <sabre@nondot.org>2001-11-08 20:19:56 +0000
commitc0b90e7dd575ba59035334397722d677231a8f13 (patch)
tree467e1fe4d7aba862ad59e87e82f69be25dea0b71 /lib/Transforms/TransformInternals.h
parent837bb2ce96f6c812bec6d0bdc9726bcb7fa8e850 (diff)
downloadexternal_llvm-c0b90e7dd575ba59035334397722d677231a8f13.zip
external_llvm-c0b90e7dd575ba59035334397722d677231a8f13.tar.gz
external_llvm-c0b90e7dd575ba59035334397722d677231a8f13.tar.bz2
Improve raising significantly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/TransformInternals.h')
-rw-r--r--lib/Transforms/TransformInternals.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Transforms/TransformInternals.h b/lib/Transforms/TransformInternals.h
index 94af200..ea42732 100644
--- a/lib/Transforms/TransformInternals.h
+++ b/lib/Transforms/TransformInternals.h
@@ -11,6 +11,7 @@
#include "llvm/BasicBlock.h"
#include "llvm/Instruction.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/DerivedTypes.h"
#include <map>
#include <set>
@@ -36,6 +37,14 @@ static inline bool isFirstClassType(const Type *Ty) {
return Ty->isPrimitiveType() || Ty->isPointerType();
}
+// getPointedToStruct - If the argument is a pointer type, and the pointed to
+// value is a struct type, return the struct type, else return null.
+//
+static inline const StructType *getPointedToStruct(const Type *Ty) {
+ const PointerType *PT = dyn_cast<PointerType>(Ty);
+ return PT ? dyn_cast<StructType>(PT->getValueType()) : 0;
+}
+
// ReplaceInstWithValue - Replace all uses of an instruction (specified by BI)
// with a value, then remove and delete the original instruction.
@@ -68,6 +77,10 @@ struct ValueMapCache {
typedef map<const Value *, Value *> ExprMapTy;
};
+
+bool ExpressionConvertableToType(Value *V, const Type *Ty, ValueTypeCache &Map);
+Value *ConvertExpressionToType(Value *V, const Type *Ty, ValueMapCache &VMC);
+
// RetValConvertableToType - Return true if it is possible
bool RetValConvertableToType(Value *V, const Type *Ty,
ValueTypeCache &ConvertedTypes);
@@ -102,4 +115,19 @@ public:
}
};
+// getStructOffsetType - Return a vector of offsets that are to be used to index
+// into the specified struct type to get as close as possible to index as we
+// can. Note that it is possible that we cannot get exactly to Offset, in which
+// case we update offset to be the offset we actually obtained. The resultant
+// leaf type is returned.
+//
+// If StopEarly is set to true (the default), the first object with the
+// specified type is returned, even if it is a struct type itself. In this
+// case, this routine will not drill down to the leaf type. Set StopEarly to
+// false if you want a leaf
+//
+const Type *getStructOffsetType(const Type *Ty, unsigned &Offset,
+ vector<ConstPoolVal*> &Offsets,
+ bool StopEarly = true);
+
#endif