[llvm-branch-commits] [llvm-gcc-branch] r90593 - in /llvm-gcc-4.2/branches/Apple/Zoidberg/gcc: llvm-abi.h llvm-convert.cpp llvm-internal.h llvm-types.cpp tree.h
Devang Patel
dpatel at apple.com
Fri Dec 4 13:08:50 PST 2009
Author: dpatel
Date: Fri Dec 4 15:08:49 2009
New Revision: 90593
URL: http://llvm.org/viewvc/llvm-project?rev=90593&view=rev
Log:
$ svn merge -c 90590 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r90590 into '.':
U gcc/tree.h
U gcc/llvm-convert.cpp
U gcc/llvm-internal.h
U gcc/llvm-types.cpp
U gcc/llvm-abi.h
Modified:
llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-abi.h
llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp
llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-internal.h
llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-types.cpp
llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/tree.h
Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-abi.h?rev=90593&r1=90592&r2=90593&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-abi.h Fri Dec 4 15:08:49 2009
@@ -510,7 +510,7 @@
if (TREE_CODE(Field) == FIELD_DECL) {
const tree Ftype = getDeclaredType(Field);
const Type *FTy = ConvertType(Ftype);
- unsigned FNo = GetFieldIndex(Field);
+ unsigned FNo = GET_LLVM_FIELD_INDEX(Field);
assert(FNo != ~0U && "Case not handled yet!");
// Currently, a bvyal type inside a non-byval struct is a zero-length
Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp?rev=90593&r1=90592&r2=90593&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-convert.cpp Fri Dec 4 15:08:49 2009
@@ -6576,7 +6576,7 @@
tree field_offset = component_ref_field_offset (exp);
// If this is a normal field at a fixed offset from the start, handle it.
if (TREE_CODE(field_offset) == INTEGER_CST) {
- unsigned int MemberIndex = GetFieldIndex(FieldDecl);
+ unsigned int MemberIndex = GET_LLVM_FIELD_INDEX(FieldDecl);
// If the LLVM struct has zero field, don't try to index into it, just use
// the current pointer.
@@ -8082,7 +8082,7 @@
tree field_offset = component_ref_field_offset (exp);
// If this is a normal field at a fixed offset from the start, handle it.
if (TREE_CODE(field_offset) == INTEGER_CST) {
- unsigned int MemberIndex = GetFieldIndex(FieldDecl);
+ unsigned int MemberIndex = GET_LLVM_FIELD_INDEX(FieldDecl);
Constant *Ops[] = {
StructAddrLV,
Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-internal.h?rev=90593&r1=90592&r2=90593&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-internal.h Fri Dec 4 15:08:49 2009
@@ -126,18 +126,11 @@
///
std::vector<tree_node*> PointersToReresolve;
- /// FieldIndexMap - Holds the mapping from a FIELD_DECL to the index of the
- /// corresponding LLVM field.
- std::map<tree_node *, unsigned int> FieldIndexMap;
public:
TypeConverter() : ConvertingStruct(false) {}
const Type *ConvertType(tree_node *type);
- /// GetFieldIndex - Returns the index of the LLVM field corresponding to
- /// this FIELD_DECL.
- unsigned int GetFieldIndex(tree_node *field_decl);
-
/// GCCTypeOverlapsWithLLVMTypePadding - Return true if the specified GCC type
/// has any data that overlaps with structure padding in the specified LLVM
/// type.
@@ -165,7 +158,6 @@
private:
const Type *ConvertRECORD(tree_node *type, tree_node *orig_type);
const Type *ConvertUNION(tree_node *type, tree_node *orig_type);
- void SetFieldIndex(tree_node *field_decl, unsigned int Index);
bool DecodeStructFields(tree_node *Field, StructTypeConversionInfo &Info);
void DecodeStructBitField(tree_node *Field, StructTypeConversionInfo &Info);
void SelectUnionMember(tree_node *type, StructTypeConversionInfo &Info);
@@ -179,12 +171,6 @@
return TheTypeConverter->ConvertType(type);
}
-/// GetFieldIndex - Given FIELD_DECL obtain its index.
-///
-inline unsigned int GetFieldIndex(tree_node *field_decl) {
- return TheTypeConverter->GetFieldIndex(field_decl);
-}
-
/// getINTEGER_CSTVal - Return the specified INTEGER_CST value as a uint64_t.
///
uint64_t getINTEGER_CSTVal(tree_node *exp);
Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-types.cpp?rev=90593&r1=90592&r2=90593&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/llvm-types.cpp Fri Dec 4 15:08:49 2009
@@ -651,23 +651,6 @@
}
}
-/// GetFieldIndex - Returns the index of the LLVM field corresponding to
-/// this FIELD_DECL, or ~0U if the type the field belongs to has not yet
-/// been converted.
-unsigned int TypeConverter::GetFieldIndex(tree field_decl) {
- assert(TREE_CODE(field_decl) == FIELD_DECL && "Not a FIELD_DECL!");
- std::map<tree, unsigned int>::iterator I = FieldIndexMap.find(field_decl);
- assert(I != FieldIndexMap.end() && "Type not laid out for LLVM?");
- return I->second;
-}
-
-/// SetFieldIndex - Set the index of the LLVM field corresponding to
-/// this FIELD_DECL.
-void TypeConverter::SetFieldIndex(tree_node *field_decl, unsigned int Index) {
- assert(TREE_CODE(field_decl) == FIELD_DECL && "Not a FIELD_DECL!");
- FieldIndexMap[field_decl] = Index;
-}
-
bool TypeConverter::GCCTypeOverlapsWithLLVMTypePadding(tree type,
const Type *Ty) {
@@ -2242,7 +2225,7 @@
TREE_CODE(DECL_FIELD_OFFSET(Field)) == INTEGER_CST) {
if (HasOnlyZeroOffsets) {
// Set the field idx to zero for all members of a union.
- SetFieldIndex(Field, 0);
+ SET_LLVM_FIELD_INDEX(Field, 0);
} else {
uint64_t FieldOffsetInBits = getFieldOffsetInBits(Field);
tree FieldType = getDeclaredType(Field);
@@ -2274,7 +2257,7 @@
unsigned FieldNo =
Info->getLLVMFieldFor(FieldOffsetInBits, CurFieldNo, isZeroSizeField);
- SetFieldIndex(Field, FieldNo);
+ SET_LLVM_FIELD_INDEX(Field, FieldNo);
assert((isBitfield(Field) || FieldNo == ~0U ||
FieldOffsetInBits == 8*Info->ElementOffsetInBytes[FieldNo]) &&
Modified: llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/tree.h?rev=90593&r1=90592&r2=90593&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/tree.h (original)
+++ llvm-gcc-4.2/branches/Apple/Zoidberg/gcc/tree.h Fri Dec 4 15:08:49 2009
@@ -2782,6 +2782,9 @@
tree bit_offset;
tree fcontext;
+ /* LLVM LOCAL begin */
+ unsigned llvm_field_index; /* Field index in llvm struct. */
+ /* LLVM LOCAL end */
};
/* A numeric unique identifier for a LABEL_DECL. The UID allocation is
@@ -2864,6 +2867,9 @@
#define SET_DECL_LLVM_INDEX(NODE, INDEX) \
(DECL_WRTL_CHECK(NODE)->decl_with_rtl.llvm = INDEX)
#define GET_DECL_LLVM_INDEX(NODE) (DECL_WRTL_CHECK(NODE)->decl_with_rtl.llvm)
+#define GET_LLVM_FIELD_INDEX(NODE) (FIELD_DECL_CHECK(NODE)->field_decl.llvm_field_index)
+#define SET_LLVM_FIELD_INDEX(NODE, INDEX) \
+ (FIELD_DECL_CHECK(NODE)->field_decl.llvm_field_index = INDEX)
/* Returns nonzero if the DECL_LLVM for NODE has already been set. */
extern bool llvm_set_decl_p(tree);
More information about the llvm-branch-commits
mailing list