[llvm-commits] [dragonegg] r90226 - in /dragonegg/trunk: llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Tue Dec 1 02:41:10 PST 2009
Author: baldrick
Date: Tue Dec 1 04:41:10 2009
New Revision: 90226
URL: http://llvm.org/viewvc/llvm-project?rev=90226&view=rev
Log:
A gimple invariant address is always given by ADDR_EXPR. Call
EmitADDR_EXPR directly, rather than going via Emit. Also, change
the parameter name of EmitGimpleInvariantAddress while there, and
tweak an assertion message.
Modified:
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-internal.h
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=90226&r1=90225&r2=90226&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Tue Dec 1 04:41:10 2009
@@ -2196,10 +2196,10 @@
/// EmitGimpleInvariantAddress - The given address is constant in this function.
/// Return the corresponding LLVM value. Only creates code in the entry block.
-Value *TreeToLLVM::EmitGimpleInvariantAddress(tree reg) {
- assert(is_gimple_invariant_address(reg) &&
+Value *TreeToLLVM::EmitGimpleInvariantAddress(tree addr) {
+ assert(is_gimple_invariant_address(addr) &&
"Expected a locally constant address!");
- assert(is_gimple_reg_type(TREE_TYPE(reg)) && "Not of register type!");
+ assert(is_gimple_reg_type(TREE_TYPE(addr)) && "Not of register type!");
// Any generated code goes in the entry block.
BasicBlock *EntryBlock = SSAInsertionPoint->getParent();
@@ -2221,7 +2221,8 @@
Builder.SetInsertPoint(EntryBlock);
// Calculate the address.
- Value *Address = Emit(reg, 0);
+ assert(TREE_CODE(addr) == ADDR_EXPR && "Invariant address not ADDR_EXPR!");
+ Value *Address = EmitADDR_EXPR(addr);
// Restore the entry block terminator.
if (Terminator)
@@ -2231,7 +2232,7 @@
if (SavedInsertBB != EntryBlock)
Builder.SetInsertPoint(SavedInsertBB, SavedInsertPoint);
- assert(Address->getType() == ConvertType(TREE_TYPE(reg)) &&
+ assert(Address->getType() == ConvertType(TREE_TYPE(addr)) &&
"Invariant address has wrong type!");
return Address;
}
@@ -2495,7 +2496,7 @@
Value *TreeToLLVM::EmitADDR_EXPR(tree exp) {
LValue LV = EmitLV(TREE_OPERAND(exp, 0));
assert((!LV.isBitfield() || LV.BitStart == 0) &&
- "It is illegal to take the address of a bitfield");
+ "It is illegal to take the address of a bitfield!");
// Perform a cast here if necessary. For example, GCC sometimes forms an
// ADDR_EXPR where the operand is an array, and the ADDR_EXPR type is a
// pointer to the first element.
Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=90226&r1=90225&r2=90226&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Tue Dec 1 04:41:10 2009
@@ -525,7 +525,7 @@
/// EmitGimpleInvariantAddress - The given address is constant in this
/// function. Return the corresponding LLVM value. Only creates code in
/// the entry block.
- Value *EmitGimpleInvariantAddress(tree_node *reg);
+ Value *EmitGimpleInvariantAddress(tree_node *addr);
/// EmitGimpleConstant - Convert the given global constant of register type to
/// an LLVM constant. Creates no code, only constants.
More information about the llvm-commits
mailing list