mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-04 17:58:22 +00:00
Add support for undef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17055 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a79e7cca0d
commit
bd1d382cc4
@ -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!");
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user