[llvm-commits] [llvm-gcc-4.2] r41221 - in /llvm-gcc-4.2/trunk/gcc: ada/utils.c llvm-types.cpp llvm.h
Duncan Sands
baldrick at free.fr
Tue Aug 21 07:06:55 PDT 2007
Author: baldrick
Date: Tue Aug 21 09:06:55 2007
New Revision: 41221
URL: http://llvm.org/viewvc/llvm-project?rev=41221&view=rev
Log:
Unlike the C front-end, the Ada f-e handles pointer
resolution itself. Fortunately, the method used
maps directly to LLVM's abstract type resolution.
This patch implements the mapping.
Modified:
llvm-gcc-4.2/trunk/gcc/ada/utils.c
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
llvm-gcc-4.2/trunk/gcc/llvm.h
Modified: llvm-gcc-4.2/trunk/gcc/ada/utils.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ada/utils.c?rev=41221&r1=41220&r2=41221&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/ada/utils.c (original)
+++ llvm-gcc-4.2/trunk/gcc/ada/utils.c Tue Aug 21 09:06:55 2007
@@ -2562,7 +2562,13 @@
: TREE_TYPE (TYPE_FIELDS (TREE_TYPE (thin_fat_ptr_type))));
return build_unc_object_type (template_type, object_type, name);
}
-
+
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
+#include "llvm.h"
+#endif
+/* LLVM LOCAL end */
+
/* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE. In
the normal case this is just two adjustments, but we have more to do
if NEW is an UNCONSTRAINED_ARRAY_TYPE. */
@@ -2704,6 +2710,12 @@
DECL_SIZE_UNIT (TREE_CHAIN (TYPE_FIELDS (new_obj_rec))));
rest_of_type_compilation (ptr, global_bindings_p ());
}
+
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
+ refine_type_to (old_type, new_type);
+#endif
+/* LLVM LOCAL end */
}
/* Convert a pointer to a constrained array into a pointer to a fat
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=41221&r1=41220&r2=41221&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Aug 21 09:06:55 2007
@@ -325,6 +325,17 @@
return size_binop (PLUS_EXPR, length, size_one_node);
}
+/// refine_type_to - Cause all users of the opaque type old_type to switch
+/// to the more concrete type new_type.
+void refine_type_to(tree old_type, tree new_type)
+{
+ const OpaqueType *OldTy = cast_or_null<OpaqueType>(GET_TYPE_LLVM(old_type));
+ if (OldTy) {
+ const Type *NewTy = ConvertType (new_type);
+ const_cast<OpaqueType*>(OldTy)->refineAbstractTypeTo(NewTy);
+ }
+}
+
//===----------------------------------------------------------------------===//
// Abstract Type Refinement Helpers
Modified: llvm-gcc-4.2/trunk/gcc/llvm.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm.h?rev=41221&r1=41220&r2=41221&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm.h Tue Aug 21 09:06:55 2007
@@ -101,6 +101,11 @@
/* llvm_asm_file_end - Finish the .s file. */
void llvm_asm_file_end(void);
+/* refine_type_to - Cause all users of the opaque type old_type to switch
+ * to the more concrete type new_type.
+ */
+void refine_type_to (union tree_node*, union tree_node*);
+
#endif /* ENABLE_LLVM */
#endif
More information about the llvm-commits
mailing list