[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y ParserInternals.h
Chris Lattner
lattner at cs.uiuc.edu
Wed Dec 21 09:53:14 PST 2005
Changes in directory llvm/lib/AsmParser:
llvmAsmParser.y updated: 1.239 -> 1.240
ParserInternals.h updated: 1.41 -> 1.42
---
Log message:
Implement Regression/Assembler/2005-12-21-ZeroInitVector.ll
---
Diffs of the changes: (+13 -1)
ParserInternals.h | 8 +++++++-
llvmAsmParser.y | 6 ++++++
2 files changed, 13 insertions(+), 1 deletion(-)
Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.239 llvm/lib/AsmParser/llvmAsmParser.y:1.240
--- llvm/lib/AsmParser/llvmAsmParser.y:1.239 Sat Nov 12 12:21:21 2005
+++ llvm/lib/AsmParser/llvmAsmParser.y Wed Dec 21 11:53:02 2005
@@ -303,6 +303,9 @@
case ValID::ConstUndefVal: // Is it an undef value?
return UndefValue::get(Ty);
+ case ValID::ConstZeroVal: // Is it a zero value?
+ return Constant::getNullValue(Ty);
+
case ValID::ConstantVal: // Fully resolved constant?
if (D.ConstantValue->getType() != Ty)
ThrowException("Constant expression type different from required type!");
@@ -1816,6 +1819,9 @@
| UNDEF {
$$ = ValID::createUndef();
}
+ | ZEROINITIALIZER { // A vector zero constant.
+ $$ = ValID::createZeroInit();
+ }
| '<' ConstVector '>' { // Nonempty unsized packed vector
const Type *ETy = (*$2)[0]->getType();
int NumElements = $2->size();
Index: llvm/lib/AsmParser/ParserInternals.h
diff -u llvm/lib/AsmParser/ParserInternals.h:1.41 llvm/lib/AsmParser/ParserInternals.h:1.42
--- llvm/lib/AsmParser/ParserInternals.h:1.41 Thu May 19 22:25:47 2005
+++ llvm/lib/AsmParser/ParserInternals.h Wed Dec 21 11:53:02 2005
@@ -82,7 +82,7 @@
struct ValID {
enum {
NumberVal, NameVal, ConstSIntVal, ConstUIntVal, ConstFPVal, ConstNullVal,
- ConstUndefVal, ConstantVal,
+ ConstUndefVal, ConstZeroVal, ConstantVal,
} Type;
union {
@@ -122,6 +122,10 @@
ValID D; D.Type = ConstUndefVal; return D;
}
+ static ValID createZeroInit() {
+ ValID D; D.Type = ConstZeroVal; return D;
+ }
+
static ValID create(Constant *Val) {
ValID D; D.Type = ConstantVal; D.ConstantValue = Val; return D;
}
@@ -145,6 +149,7 @@
case ConstFPVal : return ftostr(ConstPoolFP);
case ConstNullVal : return "null";
case ConstUndefVal : return "undef";
+ case ConstZeroVal : return "zeroinitializer";
case ConstUIntVal :
case ConstSIntVal : return std::string("%") + itostr(ConstPool64);
case ConstantVal:
@@ -168,6 +173,7 @@
case ConstFPVal: return ConstPoolFP < V.ConstPoolFP;
case ConstNullVal: return false;
case ConstUndefVal: return false;
+ case ConstZeroVal: return false;
case ConstantVal: return ConstantValue < V.ConstantValue;
default: assert(0 && "Unknown value type!"); return false;
}
More information about the llvm-commits
mailing list