summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-22 05:01:15 +0000
committerChris Lattner <sabre@nondot.org>2003-12-22 05:01:15 +0000
commitbb661c18c8d7cca739d2053f1b33b21cdb65eecd (patch)
tree87f7057eb05238db450b41c686d84e52545742b6
parentdb65d6f14c14c2aae95bc6bf1b445efbc566fc6d (diff)
downloadbcm5719-llvm-bb661c18c8d7cca739d2053f1b33b21cdb65eecd.tar.gz
bcm5719-llvm-bb661c18c8d7cca739d2053f1b33b21cdb65eecd.zip
finegrainify namespacification
add new getIntPtrType() method llvm-svn: 10579
-rw-r--r--llvm/lib/Target/TargetData.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp
index ed6936dd122..91c9d01198c 100644
--- a/llvm/lib/Target/TargetData.cpp
+++ b/llvm/lib/Target/TargetData.cpp
@@ -21,8 +21,7 @@
#include "llvm/Module.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Constants.h"
-
-namespace llvm {
+using namespace llvm;
// Handle the Pass registration stuff necessary to use TargetData's.
namespace {
@@ -189,6 +188,18 @@ unsigned char TargetData::getTypeAlignment(const Type *Ty) const {
return Align;
}
+/// getIntPtrType - Return an unsigned integer type that is the same size or
+/// greater to the host pointer size.
+const Type *TargetData::getIntPtrType() const {
+ switch (getPointerSize()) {
+ default: assert(0 && "Unknown pointer size!");
+ case 2: return Type::UShortTy;
+ case 4: return Type::UIntTy;
+ case 8: return Type::ULongTy;
+ }
+}
+
+
uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
const std::vector<Value*> &Idx) const {
const Type *Ty = ptrTy;
@@ -223,4 +234,3 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
return Result;
}
-} // End llvm namespace
OpenPOWER on IntegriCloud