[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Dec 21 23:02:00 PST 2003
Changes in directory llvm/lib/Target:
TargetData.cpp updated: 1.40 -> 1.41
---
Log message:
finegrainify namespacification
add new getIntPtrType() method
---
Diffs of the changes: (+13 -3)
Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.40 llvm/lib/Target/TargetData.cpp:1.41
--- llvm/lib/Target/TargetData.cpp:1.40 Tue Nov 11 16:41:33 2003
+++ llvm/lib/Target/TargetData.cpp Sun Dec 21 23:01:15 2003
@@ -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 @@
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 @@
return Result;
}
-} // End llvm namespace
More information about the llvm-commits
mailing list