[llvm-commits] [dragonegg] r129359 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Constants.cpp src/Convert.cpp
Duncan Sands
baldrick at free.fr
Tue Apr 12 04:54:40 PDT 2011
Author: baldrick
Date: Tue Apr 12 06:54:40 2011
New Revision: 129359
URL: http://llvm.org/viewvc/llvm-project?rev=129359&view=rev
Log:
Add support for MISALIGNED_INDIRECT_REF in the hope of fixing PR9663.
Modified:
dragonegg/trunk/include/dragonegg/Internals.h
dragonegg/trunk/src/Constants.cpp
dragonegg/trunk/src/Convert.cpp
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=129359&r1=129358&r2=129359&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Tue Apr 12 06:54:40 2011
@@ -789,6 +789,7 @@
LValue EmitLV_COMPONENT_REF(tree_node *exp);
LValue EmitLV_DECL(tree_node *exp);
LValue EmitLV_INDIRECT_REF(tree_node *exp);
+ LValue EmitLV_MISALIGNED_INDIRECT_REF(tree_node *exp);
LValue EmitLV_VIEW_CONVERT_EXPR(tree_node *exp);
LValue EmitLV_WITH_SIZE_EXPR(tree_node *exp);
LValue EmitLV_XXXXPART_EXPR(tree_node *exp, unsigned Idx);
Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=129359&r1=129358&r2=129359&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Tue Apr 12 06:54:40 2011
@@ -1335,6 +1335,7 @@
Addr = AddressOfDecl(exp);
break;
case INDIRECT_REF:
+ case MISALIGNED_INDIRECT_REF:
Addr = AddressOfINDIRECT_REF(exp);
break;
case LABEL_DECL:
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=129359&r1=129358&r2=129359&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Tue Apr 12 06:54:40 2011
@@ -1298,6 +1298,9 @@
case INDIRECT_REF:
LV = EmitLV_INDIRECT_REF(exp);
break;
+ case MISALIGNED_INDIRECT_REF:
+ LV = EmitLV_MISALIGNED_INDIRECT_REF(exp);
+ break;
}
// Check that the type of the lvalue is indeed that of a pointer to the tree
@@ -5736,6 +5739,19 @@
return LV;
}
+LValue TreeToLLVM::EmitLV_MISALIGNED_INDIRECT_REF(tree exp) {
+ // The lvalue is just the address. The alignment is given by operand 1.
+ unsigned Alignment = tree_low_cst(TREE_OPERAND(exp, 1), true);
+ if (!Alignment) Alignment = 8;
+ assert(!(Alignment & 7) && "Alignment not in octets!");
+ LValue LV = LValue(EmitRegister(TREE_OPERAND(exp, 0)), Alignment / 8);
+ // May need a useless type conversion (useless_type_conversion_p), for example
+ // when INDIRECT_REF is applied to a void*, resulting in a non-void type.
+ LV.Ptr = UselesslyTypeConvert(LV.Ptr,
+ ConvertType(TREE_TYPE(exp))->getPointerTo());
+ return LV;
+}
+
LValue TreeToLLVM::EmitLV_VIEW_CONVERT_EXPR(tree exp) {
// The address is the address of the operand.
LValue LV = EmitLV(TREE_OPERAND(exp, 0));
@@ -7873,6 +7889,7 @@
case COMPONENT_REF:
case IMAGPART_EXPR:
case INDIRECT_REF:
+ case MISALIGNED_INDIRECT_REF:
case REALPART_EXPR:
case TARGET_MEM_REF:
case VIEW_CONVERT_EXPR:
More information about the llvm-commits
mailing list