[llvm-commits] CVS: llvm-gcc/gcc/llvm-types.c llvm-representation.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Jul 6 22:15:02 PDT 2004
Changes in directory llvm-gcc/gcc:
llvm-types.c updated: 1.9 -> 1.10
llvm-representation.h updated: 1.7 -> 1.8
---
Log message:
Add a global IntPtrTy type.
---
Diffs of the changes: (+10 -2)
Index: llvm-gcc/gcc/llvm-types.c
diff -u llvm-gcc/gcc/llvm-types.c:1.9 llvm-gcc/gcc/llvm-types.c:1.10
--- llvm-gcc/gcc/llvm-types.c:1.9 Tue Jun 8 02:12:43 2004
+++ llvm-gcc/gcc/llvm-types.c Tue Jul 6 22:13:44 2004
@@ -60,6 +60,12 @@
case ArrayTyID: return llvm_type_get_size(Ty->Elements[0])*Ty->x.Array.Size;
case StructTyID: return Ty->x.Struct.Size;
case PointerTyID: /* Target dependant pointer size */
+ switch (ptr_mode) {
+ case SImode: case PSImode: return 4;
+ case DImode: case PDImode: return 8;
+ default:
+ assert(0 && "Unknown mode for pointer type!");
+ }
return (TREE_INT_CST_LOW(TYPE_SIZE(ptr_type_node))+7)/8;
default:
fprintf(stderr, "ERROR: Type doesn't have size: ");
@@ -96,7 +102,7 @@
llvm_type *FloatTy = &TheFloatTy;
llvm_type *DoubleTy = &TheDoubleTy;
llvm_type *LabelTy = &TheLabelTy;
-llvm_type *VoidPtrTy = 0;
+llvm_type *VoidPtrTy = 0, *IntPtrTy;
/*===---------------------------------------------------------------------===*\
* More complex type functions built on primitives
@@ -203,6 +209,8 @@
/* Commonly used derived types... */
VoidPtrTy = llvm_type_get_pointer(VoidTy);
+
+ IntPtrTy = llvm_type_get_size(VoidPtrTy) == 4 ? IntTy : LongTy;
}
llvm_type *llvm_type_get_cannonical_struct(llvm_type *Ty) {
Index: llvm-gcc/gcc/llvm-representation.h
diff -u llvm-gcc/gcc/llvm-representation.h:1.7 llvm-gcc/gcc/llvm-representation.h:1.8
--- llvm-gcc/gcc/llvm-representation.h:1.7 Wed Jun 2 13:45:07 2004
+++ llvm-gcc/gcc/llvm-representation.h Tue Jul 6 22:13:44 2004
@@ -405,7 +405,7 @@
extern llvm_type *VoidTy, *BoolTy, *UByteTy, *SByteTy, *UShortTy, *ShortTy;
extern llvm_type *UIntTy, *IntTy, *ULongTy, *LongTy, *FloatTy, *DoubleTy;
-extern llvm_type *LabelTy, *VoidPtrTy;
+extern llvm_type *LabelTy, *VoidPtrTy, *IntPtrTy;
void llvm_type_print(llvm_type *Ty, FILE *F);
void llvm_type_dump(llvm_type *Ty);
More information about the llvm-commits
mailing list