[llvm-commits] [123568] Complete support for the GCC address-of-label extension (most was
clattner at apple.com
clattner at apple.com
Wed Feb 7 20:34:01 PST 2007
Revision: 123568
Author: clattner
Date: 2007-02-07 20:34:00 -0800 (Wed, 07 Feb 2007)
Log Message:
-----------
Complete support for the GCC address-of-label extension (most was
already implemented) and do some other minor cleanup. This implements
PR947 and test/CFrontend/2007-02-07-AddrLabel.c
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-convert.cpp
apple-local/branches/llvm/gcc/llvm-internal.h
Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-08 02:16:06 UTC (rev 123567)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-02-08 04:34:00 UTC (rev 123568)
@@ -689,18 +689,24 @@
case FUNCTION_DECL:
case CONST_DECL:
case RESULT_DECL: return EmitLV_DECL(exp);
- case STRING_CST: return LValue(TreeConstantToLLVM::EmitLV_STRING_CST(exp));
- case INDIRECT_REF: return EmitLV_INDIRECT_REF(exp);
case ARRAY_RANGE_REF:
case ARRAY_REF: return EmitLV_ARRAY_REF(exp);
case COMPONENT_REF: return EmitLV_COMPONENT_REF(exp);
case BIT_FIELD_REF: return EmitLV_BIT_FIELD_REF(exp);
case REALPART_EXPR: return EmitLV_XXXXPART_EXPR(exp, 0);
case IMAGPART_EXPR: return EmitLV_XXXXPART_EXPR(exp, 1);
+ // Constants.
+ case LABEL_DECL: return TreeConstantToLLVM::EmitLV_LABEL_DECL(exp);
+ case STRING_CST: return LValue(TreeConstantToLLVM::EmitLV_STRING_CST(exp));
+
+ // Trivial Cases.
case VIEW_CONVERT_EXPR:
case WITH_SIZE_EXPR:
// The address of a these is the address of their operand.
return EmitLV(TREE_OPERAND(exp, 0));
+ case INDIRECT_REF:
+ // The lvalue is just the address.
+ return Emit(TREE_OPERAND(exp, 0), 0);
}
}
@@ -4093,11 +4099,6 @@
return CastToType(Instruction::BitCast, Decl, PTy);
}
-LValue TreeToLLVM::EmitLV_INDIRECT_REF(tree exp) {
- // The lvalue is just the address.
- return Emit(TREE_OPERAND(exp, 0), 0);
-}
-
LValue TreeToLLVM::EmitLV_ARRAY_REF(tree exp) {
tree Array = TREE_OPERAND(exp, 0);
tree Index = TREE_OPERAND(exp, 1);
@@ -5095,9 +5096,11 @@
case COMPONENT_REF: return EmitLV_COMPONENT_REF(exp);
case ARRAY_RANGE_REF:
case ARRAY_REF: return EmitLV_ARRAY_REF(exp);
- case INDIRECT_REF: return EmitLV_INDIRECT_REF(exp);
+ case INDIRECT_REF:
+ // The lvalue is just the address.
+ return Convert(TREE_OPERAND(exp, 0));
case COMPOUND_LITERAL_EXPR:
- return EmitLV_COMPOUND_LITERAL_EXPR(exp);
+ return EmitLV(COMPOUND_LITERAL_EXPR_DECL(exp));
}
}
@@ -5278,15 +5281,5 @@
return FieldPtr;
}
-Constant* TreeConstantToLLVM::EmitLV_INDIRECT_REF(tree exp) {
- // The lvalue is just the address.
- return Convert(TREE_OPERAND(exp, 0));
-}
-
-Constant *TreeConstantToLLVM::EmitLV_COMPOUND_LITERAL_EXPR(tree exp) {
- tree Decl = COMPOUND_LITERAL_EXPR_DECL(exp);
- return EmitLV(Decl);
-}
-
/* APPLE LOCAL end LLVM (ENTIRE FILE!) */
Modified: apple-local/branches/llvm/gcc/llvm-internal.h
===================================================================
--- apple-local/branches/llvm/gcc/llvm-internal.h 2007-02-08 02:16:06 UTC (rev 123567)
+++ apple-local/branches/llvm/gcc/llvm-internal.h 2007-02-08 04:34:00 UTC (rev 123568)
@@ -463,7 +463,6 @@
Value *EmitComplexBinOp(tree_node *exp, Value *DestLoc);
// L-Value Expressions.
- LValue EmitLV_INDIRECT_REF(tree_node *exp);
LValue EmitLV_DECL(tree_node *exp);
LValue EmitLV_ARRAY_REF(tree_node *exp);
LValue EmitLV_COMPONENT_REF(tree_node *exp);
@@ -515,8 +514,6 @@
static Constant *EmitLV_STRING_CST(tree_node *exp);
static Constant *EmitLV_COMPONENT_REF(tree_node *exp);
static Constant *EmitLV_ARRAY_REF(tree_node *exp);
- static Constant *EmitLV_INDIRECT_REF(tree_node *exp);
- static Constant *EmitLV_COMPOUND_LITERAL_EXPR(tree_node *exp);
};
#endif
More information about the llvm-commits
mailing list