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 | bd1d382cc47dfc43ee758714bc22ab5a750bad15 (patch) | |
tree | 580ba057e515d5a2c1176d6e1fc3c6fcab8d5ad5 /lib | |
parent | a79e7cca0dff44092b0b1a17a26a7af4bebc9d5d (diff) | |
download | external_llvm-bd1d382cc47dfc43ee758714bc22ab5a750bad15.zip external_llvm-bd1d382cc47dfc43ee758714bc22ab5a750bad15.tar.gz external_llvm-bd1d382cc47dfc43ee758714bc22ab5a750bad15.tar.bz2 |
Add support for undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17055 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/DataStructure/Local.cpp | 3 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 4 | ||||
-rw-r--r-- | lib/ExecutionEngine/ExecutionEngine.cpp | 4 |
3 files changed, 8 insertions, 3 deletions
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp index b497c38..473fb63 100644 --- a/lib/Analysis/DataStructure/Local.cpp +++ b/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/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 11565df..eb57cce 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/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/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index b239cc2..208f8e2 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/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; |