[llvm-commits] [dragonegg] r94983 - /dragonegg/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Mon Feb 1 08:44:34 PST 2010
Author: baldrick
Date: Mon Feb 1 10:44:34 2010
New Revision: 94983
URL: http://llvm.org/viewvc/llvm-project?rev=94983&view=rev
Log:
Use a LoadInst rather than a BitCastInst as the placeholder instruction:
BitCastInst doesn't cut the mustard since the register might be a complex
number (i.e. have struct type), which cannot be used with bitcast.
Modified:
dragonegg/trunk/llvm-convert.cpp
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=94983&r1=94982&r2=94983&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Mon Feb 1 10:44:34 2010
@@ -160,14 +160,20 @@
/// output in dominator order). Replaced with the correct value when the SSA
/// name's definition is encountered.
static Value *GetSSAPlaceholder(const Type *Ty) {
- return new BitCastInst(UndefValue::get(Ty), Ty);
+ // Cannot use a constant, since there is no way to distinguish a fake value
+ // from a real value. So use an instruction with no parent. This needs to
+ // be an instruction that can return a struct type, since the SSA name might
+ // be a complex number. It could be a PHINode, except that the GCC phi node
+ // conversion logic also constructs phi nodes with no parent. A SelectInst
+ // would work, but a LoadInst seemed neater.
+ return new LoadInst(UndefValue::get(Ty->getPointerTo()), NULL);
}
/// isSSAPlaceholder - Whether this is a fake value being used as a placeholder
/// for the definition of an SSA name.
static bool isSSAPlaceholder(Value *V) {
- BitCastInst *BC = dyn_cast<BitCastInst>(V);
- return BC && !BC->getParent();
+ LoadInst *LI = dyn_cast<LoadInst>(V);
+ return LI && !LI->getParent();
}
/// NameValue - Try to name the given value after the given GCC tree node. If
More information about the llvm-commits
mailing list