[llvm-commits] [gcc-plugin] r81218 - /gcc-plugin/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Tue Sep 8 07:25:14 PDT 2009
Author: baldrick
Date: Tue Sep 8 09:25:14 2009
New Revision: 81218
URL: http://llvm.org/viewvc/llvm-project?rev=81218&view=rev
Log:
Further furious fighting with phi nodes. The incoming ssa name may
be a "default definition", in which case it may not have been output.
Call EmitSSA_NAME which knows how to handle this case. It places any
code it generates at an appropriate point in the entry block.
Modified:
gcc-plugin/trunk/llvm-convert.cpp
Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81218&r1=81217&r2=81218&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep 8 09:25:14 2009
@@ -651,20 +651,18 @@
if (BI == BasicBlocks.end())
continue;
- // Obtain the incoming value. It is important not to add new instructions
- // to the function, which is why this is done by hand.
+ // Obtain the incoming value. Any new instructions added to the function
+ // must be carefully placed, so analyze each case by hand rather than just
+ // calling Emit.
tree def = gimple_phi_arg(P.gcc_phi, i)->def;
Value *Val;
// The incoming value is either an ssa name or a constant.
// FIXME: Not clear what is allowed here exactly.
- if (TREE_CODE(def) == SSA_NAME) {
- DenseMap<tree, Value*>::iterator NI = SSANames.find(def);
- assert(NI != SSANames.end() && "PHI operand never defined!");
- Val = NI->second;
- } else {
+ if (TREE_CODE(def) == SSA_NAME)
+ Val = EmitSSA_NAME(def);
+ else
Val = TreeConstantToLLVM::Convert(def);
- }
P.PHI->addIncoming(Val, BI->second);
}
More information about the llvm-commits
mailing list