[llvm-commits] [llvm-gcc-4.2] r99075 - in /llvm-gcc-4.2/trunk/gcc: c-typeck.c config/arm/arm.c cp/cvt.c cp/typeck.c target-def.h target.h
Anton Korobeynikov
asl at math.spbu.ru
Sat Mar 20 12:21:52 PDT 2010
Author: asl
Date: Sat Mar 20 14:21:52 2010
New Revision: 99075
URL: http://llvm.org/viewvc/llvm-project?rev=99075&view=rev
Log:
HF support in C++ frontend
Modified:
llvm-gcc-4.2/trunk/gcc/c-typeck.c
llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
llvm-gcc-4.2/trunk/gcc/cp/cvt.c
llvm-gcc-4.2/trunk/gcc/cp/typeck.c
llvm-gcc-4.2/trunk/gcc/target-def.h
llvm-gcc-4.2/trunk/gcc/target.h
Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=99075&r1=99074&r2=99075&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Sat Mar 20 14:21:52 2010
@@ -1692,8 +1692,10 @@
tree
default_conversion (tree exp)
{
- tree orig_exp, promoted_exp;
- tree type = TREE_TYPE (exp);
+ /* LLVM LOCAL begin */
+ tree orig_exp;
+ tree type = TREE_TYPE (exp), promoted_type;
+ /* LLVM LOCAL end */
enum tree_code code = TREE_CODE (type);
/* Functions and arrays have been converted during parsing. */
@@ -1721,9 +1723,11 @@
if (TREE_NO_WARNING (orig_exp))
TREE_NO_WARNING (exp) = 1;
- promoted_exp = targetm.perform_target_promotions (exp);
- if (promoted_exp != NULL_TREE)
- return promoted_exp;
+ /* LLVM LOCAL begin */
+ promoted_type = targetm.type_promotes_to (type);
+ if (promoted_type != NULL_TREE)
+ return convert (promoted_type, exp);
+ /* LLVM LOCAL end */
if (INTEGRAL_TYPE_P (type))
return perform_integral_promotions (exp);
Modified: llvm-gcc-4.2/trunk/gcc/config/arm/arm.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/arm/arm.c?rev=99075&r1=99074&r2=99075&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/arm/arm.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/arm/arm.c Sat Mar 20 14:21:52 2010
@@ -143,8 +143,10 @@
static void arm_output_function_prologue (FILE *, HOST_WIDE_INT);
/* APPLE LOCAL v7 support. Merge from mainline */
static void thumb1_output_function_prologue (FILE *, HOST_WIDE_INT);
-static tree arm_perform_target_promotions(tree);
+/* LLVM LOCAL begin */
+static tree arm_type_promotes_to(tree);
static bool arm_is_fp16(tree);
+/* LLVM LOCAL end */
static int arm_comp_type_attributes (tree, tree);
static void arm_set_default_type_attributes (tree);
static int arm_adjust_cost (rtx, rtx, rtx, int);
@@ -516,8 +518,8 @@
/* APPLE LOCAL end 6902792 Q register clobbers in inline asm */
/* LLVM LOCAL begin */
-#undef TARGET_PERFORM_TARGET_PROMOTIONS
-#define TARGET_PERFORM_TARGET_PROMOTIONS arm_perform_target_promotions
+#undef TARGET_TYPE_PROMOTES_TO
+#define TARGET_TYPE_PROMOTES_TO arm_type_promotes_to
/* LLVM LOCAL end */
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -3853,15 +3855,14 @@
tree
-arm_perform_target_promotions (tree exp)
+arm_type_promotes_to (tree ty)
{
/* FIXME: Is NOP_EXPR better here? */
- if (arm_is_fp16 (TREE_TYPE(exp)))
- return build1 (CONVERT_EXPR, float_type_node, exp);
+ if (arm_is_fp16 (ty))
+ return float_type_node;
return NULL_TREE;
}
-
/* LLVM LOCAL end */
/* APPLE LOCAL begin ARM longcall */
Modified: llvm-gcc-4.2/trunk/gcc/cp/cvt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cvt.c?rev=99075&r1=99074&r2=99075&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cvt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cvt.c Sat Mar 20 14:21:52 2010
@@ -1253,11 +1253,21 @@
tree
type_promotes_to (tree type)
{
+ /* LLVM LOCAL */
+ tree promoted_type;
+
if (type == error_mark_node)
return error_mark_node;
type = TYPE_MAIN_VARIANT (type);
+ /* LLVM LOCAL begin */
+ /* Perform target promotions (e.g. HF -> SF on ARM) */
+ promoted_type = targetm.type_promotes_to (type);
+ if (promoted_type != NULL_TREE)
+ return promoted_type;
+ /* LLVM LOCAL end */
+
/* bool always promotes to int (not unsigned), even if it's the same
size. */
if (type == boolean_type_node)
Modified: llvm-gcc-4.2/trunk/gcc/cp/typeck.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/typeck.c?rev=99075&r1=99074&r2=99075&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/typeck.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/typeck.c Sat Mar 20 14:21:52 2010
@@ -1623,6 +1623,13 @@
tree
default_conversion (tree exp)
{
+ /* LLVM LOCAL begin */
+ /* Perform target promotions (e.g. HF -> SF on ARM) */
+ tree promoted_type = targetm.type_promotes_to (TREE_TYPE(exp));
+ if (promoted_type != NULL_TREE)
+ return cp_convert (promoted_type, exp);
+ /* LLVM LOCAL end */
+
/* Perform the integral promotions first so that bitfield
expressions (which may promote to "int", even if the bitfield is
declared "unsigned") are promoted correctly. */
Modified: llvm-gcc-4.2/trunk/gcc/target-def.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/target-def.h?rev=99075&r1=99074&r2=99075&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/target-def.h (original)
+++ llvm-gcc-4.2/trunk/gcc/target-def.h Sat Mar 20 14:21:52 2010
@@ -477,7 +477,7 @@
#define TARGET_INVALID_UNARY_OP hook_constcharptr_int_tree_null
#define TARGET_INVALID_BINARY_OP hook_constcharptr_int_tree_tree_null
/* LLVM LOCAL begin */
-#define TARGET_PERFORM_TARGET_PROMOTIONS hook_tree_tree_null
+#define TARGET_TYPE_PROMOTES_TO hook_tree_tree_null
/* LLVM LOCAL end */
#define TARGET_FIXED_CONDITION_CODE_REGS hook_bool_uintp_uintp_false
@@ -743,7 +743,7 @@
TARGET_INVALID_UNARY_OP, \
TARGET_INVALID_BINARY_OP, \
/* LLVM LOCAL begin */ \
- TARGET_PERFORM_TARGET_PROMOTIONS, \
+ TARGET_TYPE_PROMOTES_TO, \
/* LLVM LOCAL end */ \
TARGET_SECONDARY_RELOAD, \
TARGET_CXX, \
Modified: llvm-gcc-4.2/trunk/gcc/target.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/target.h?rev=99075&r1=99074&r2=99075&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/target.h (original)
+++ llvm-gcc-4.2/trunk/gcc/target.h Sat Mar 20 14:21:52 2010
@@ -771,7 +771,9 @@
const char *(*invalid_binary_op) (int op, tree type1, tree type2);
/* LLVM LOCAL begin */
- tree (*perform_target_promotions) (tree exp);
+ /* Returns whether the type should be promoted to some other type (e.g. HF ->
+ SF conversion on ARM) */
+ tree (*type_promotes_to) (tree ty);
/* LLVM LOCAL end */
/* Return the class for a secondary reload, and fill in extra information. */
More information about the llvm-commits
mailing list