diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-10-16 18:19:26 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-10-16 18:19:26 +0000 |
| commit | 61753bf84796694f1165e333c3190cc02ea03ba1 (patch) | |
| tree | 098546dcacfabbdee05ac793216998c7df7f8d8a /llvm/lib | |
| parent | 770709befe9000505daf38f116e7bfb46e3db228 (diff) | |
| download | bcm5719-llvm-61753bf84796694f1165e333c3190cc02ea03ba1.tar.gz bcm5719-llvm-61753bf84796694f1165e333c3190cc02ea03ba1.zip | |
Add support for undef
llvm-svn: 17055
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/DataStructure/Local.cpp | 3 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/DataStructure/Local.cpp b/llvm/lib/Analysis/DataStructure/Local.cpp index b497c3849c9..473fb630dc4 100644 --- a/llvm/lib/Analysis/DataStructure/Local.cpp +++ b/llvm/lib/Analysis/DataStructure/Local.cpp @@ -246,6 +246,9 @@ DSNodeHandle GraphBuilder::getValueDest(Value &Val) { } else if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(C)) { // Random constants are unknown mem return NH = createNode()->setUnknownNodeMarker(); + } else if (isa<UndefValue>(C)) { + ScalarMap.erase(V); + return 0; } else { assert(0 && "Unknown constant type!"); } diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index 11565dff0b3..eb57cced13e 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -55,7 +55,7 @@ void AsmPrinter::emitZeros(unsigned NumZeros) const { // Print out the specified constant, without a storage class. Only the // constants valid in constant expressions can occur here. void AsmPrinter::emitConstantValueOnly(const Constant *CV) { - if (CV->isNullValue()) + if (CV->isNullValue() || isa<UndefValue>(CV)) O << "0"; else if (const ConstantBool *CB = dyn_cast<ConstantBool>(CV)) { assert(CB == ConstantBool::True); @@ -171,7 +171,7 @@ static void printAsCString(std::ostream &O, const ConstantArray *CVA) { void AsmPrinter::emitGlobalConstant(const Constant *CV) { const TargetData &TD = TM.getTargetData(); - if (CV->isNullValue()) { + if (CV->isNullValue() || isa<UndefValue>(CV)) { emitZeros(TD.getTypeSize(CV->getType())); return; } else if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV)) { diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index b239cc2a53e..208f8e2e834 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -440,7 +440,9 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr, // specified memory location... // void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { - if (Init->getType()->isFirstClassType()) { + if (isa<UndefValue>(Init)) { + return; + } else if (Init->getType()->isFirstClassType()) { GenericValue Val = getConstantValue(Init); StoreValueToMemory(Val, (GenericValue*)Addr, Init->getType()); return; |

