For PR950:

This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-12-23 06:05:41 +00:00
parent add2bd7f59
commit e4d87aa2de
87 changed files with 8093 additions and 6620 deletions

View File

@@ -926,7 +926,6 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
// EUINT64VAL - A positive number within uns. long long range
%token <UInt64Val> EUINT64VAL
%type <SInt64Val> EINT64VAL
%token <SIntVal> SINTVAL // Signed 32 bit ints...
%token <UIntVal> UINTVAL // Unsigned 32 bit ints...
@@ -959,9 +958,8 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) {
%token <TermOpVal> RET BR SWITCH INVOKE UNWIND UNREACHABLE
// Binary Operators
%type <BinaryOpVal> ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories
%type <BinaryOpVal> ArithmeticOps LogicalOps // Binops Subcatagories
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
%token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
%token <OtherOpVal> ICMP FCMP
%type <IPredicate> IPredicates
%type <FPredicate> FPredicates
@@ -995,21 +993,11 @@ INTVAL : UINTVAL {
CHECK_FOR_ERROR
};
EINT64VAL : ESINT64VAL; // These have same type and can't cause problems...
EINT64VAL : EUINT64VAL {
if ($1 > (uint64_t)INT64_MAX) // Outside of my range!
GEN_ERROR("Value too large for type!");
$$ = (int64_t)$1;
CHECK_FOR_ERROR
};
// Operations that are notably excluded from this list include:
// RET, BR, & SWITCH because they end basic blocks and are treated specially.
//
ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM;
LogicalOps : AND | OR | XOR;
SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST |
UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT;
ShiftOps : SHL | LSHR | ASHR;
@@ -1486,7 +1474,13 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
delete $1;
CHECK_FOR_ERROR
}
| SIntType EINT64VAL { // integral constants
| SIntType ESINT64VAL { // integral constants
if (!ConstantInt::isValueValidForType($1, $2))
GEN_ERROR("Constant value doesn't fit in type!");
$$ = ConstantInt::get($1, $2);
CHECK_FOR_ERROR
}
| SIntType EUINT64VAL { // integral constants
if (!ConstantInt::isValueValidForType($1, $2))
GEN_ERROR("Constant value doesn't fit in type!");
$$ = ConstantInt::get($1, $2);
@@ -1498,6 +1492,12 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
$$ = ConstantInt::get($1, $2);
CHECK_FOR_ERROR
}
| UIntType ESINT64VAL {
if (!ConstantInt::isValueValidForType($1, $2))
GEN_ERROR("Constant value doesn't fit in type!");
$$ = ConstantInt::get($1, $2);
CHECK_FOR_ERROR
}
| BOOL TRUETOK { // Boolean constants
$$ = ConstantBool::getTrue();
CHECK_FOR_ERROR
@@ -1572,12 +1572,6 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
$$ = ConstantExpr::get($1, $3, $5);
CHECK_FOR_ERROR
}
| SetCondOps '(' ConstVal ',' ConstVal ')' {
if ($3->getType() != $5->getType())
GEN_ERROR("setcc operand types must match!");
$$ = ConstantExpr::get($1, $3, $5);
CHECK_FOR_ERROR
}
| ICMP IPredicates '(' ConstVal ',' ConstVal ')' {
if ($4->getType() != $6->getType())
GEN_ERROR("icmp operand types must match!");
@@ -2367,20 +2361,6 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
GEN_ERROR("binary operator returned null!");
delete $2;
}
| SetCondOps Types ValueRef ',' ValueRef {
if(isa<PackedType>((*$2).get())) {
GEN_ERROR(
"PackedTypes currently not supported in setcc instructions!");
}
Value* tmpVal1 = getVal(*$2, $3);
CHECK_FOR_ERROR
Value* tmpVal2 = getVal(*$2, $5);
CHECK_FOR_ERROR
$$ = new SetCondInst($1, tmpVal1, tmpVal2);
if ($$ == 0)
GEN_ERROR("binary operator returned null!");
delete $2;
}
| ICMP IPredicates Types ValueRef ',' ValueRef {
if (isa<PackedType>((*$3).get()))
GEN_ERROR("Packed types not supported by icmp instruction");