mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
Implement Regression/Assembler/2005-12-21-ZeroInitVector.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24903 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -82,7 +82,7 @@ static inline void ThrowException(const std::string &message,
|
|||||||
struct ValID {
|
struct ValID {
|
||||||
enum {
|
enum {
|
||||||
NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal,
|
NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal,
|
||||||
ConstUndefVal, ConstantVal,
|
ConstUndefVal, ConstZeroVal, ConstantVal,
|
||||||
} Type;
|
} Type;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
@@ -122,6 +122,10 @@ struct ValID {
|
|||||||
ValID D; D.Type = ConstUndefVal; return D;
|
ValID D; D.Type = ConstUndefVal; return D;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ValID createZeroInit() {
|
||||||
|
ValID D; D.Type = ConstZeroVal; return D;
|
||||||
|
}
|
||||||
|
|
||||||
static ValID create(Constant *Val) {
|
static ValID create(Constant *Val) {
|
||||||
ValID D; D.Type = ConstantVal; D.ConstantValue = Val; return D;
|
ValID D; D.Type = ConstantVal; D.ConstantValue = Val; return D;
|
||||||
}
|
}
|
||||||
@@ -145,6 +149,7 @@ struct ValID {
|
|||||||
case ConstFPVal : return ftostr(ConstPoolFP);
|
case ConstFPVal : return ftostr(ConstPoolFP);
|
||||||
case ConstNullVal : return "null";
|
case ConstNullVal : return "null";
|
||||||
case ConstUndefVal : return "undef";
|
case ConstUndefVal : return "undef";
|
||||||
|
case ConstZeroVal : return "zeroinitializer";
|
||||||
case ConstUIntVal :
|
case ConstUIntVal :
|
||||||
case ConstSIntVal : return std::string("%") + itostr(ConstPool64);
|
case ConstSIntVal : return std::string("%") + itostr(ConstPool64);
|
||||||
case ConstantVal:
|
case ConstantVal:
|
||||||
@@ -168,6 +173,7 @@ struct ValID {
|
|||||||
case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
|
case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
|
||||||
case ConstNullVal: return false;
|
case ConstNullVal: return false;
|
||||||
case ConstUndefVal: return false;
|
case ConstUndefVal: return false;
|
||||||
|
case ConstZeroVal: return false;
|
||||||
case ConstantVal: return ConstantValue < V.ConstantValue;
|
case ConstantVal: return ConstantValue < V.ConstantValue;
|
||||||
default: assert(0 && "Unknown value type!"); return false;
|
default: assert(0 && "Unknown value type!"); return false;
|
||||||
}
|
}
|
||||||
|
@@ -303,6 +303,9 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) {
|
|||||||
case ValID::ConstUndefVal: // Is it an undef value?
|
case ValID::ConstUndefVal: // Is it an undef value?
|
||||||
return UndefValue::get(Ty);
|
return UndefValue::get(Ty);
|
||||||
|
|
||||||
|
case ValID::ConstZeroVal: // Is it a zero value?
|
||||||
|
return Constant::getNullValue(Ty);
|
||||||
|
|
||||||
case ValID::ConstantVal: // Fully resolved constant?
|
case ValID::ConstantVal: // Fully resolved constant?
|
||||||
if (D.ConstantValue->getType() != Ty)
|
if (D.ConstantValue->getType() != Ty)
|
||||||
ThrowException("Constant expression type different from required type!");
|
ThrowException("Constant expression type different from required type!");
|
||||||
@@ -1816,6 +1819,9 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant
|
|||||||
| UNDEF {
|
| UNDEF {
|
||||||
$$ = ValID::createUndef();
|
$$ = ValID::createUndef();
|
||||||
}
|
}
|
||||||
|
| ZEROINITIALIZER { // A vector zero constant.
|
||||||
|
$$ = ValID::createZeroInit();
|
||||||
|
}
|
||||||
| '<' ConstVector '>' { // Nonempty unsized packed vector
|
| '<' ConstVector '>' { // Nonempty unsized packed vector
|
||||||
const Type *ETy = (*$2)[0]->getType();
|
const Type *ETy = (*$2)[0]->getType();
|
||||||
int NumElements = $2->size();
|
int NumElements = $2->size();
|
||||||
|
Reference in New Issue
Block a user