mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-15 07:33:18 +00:00
Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
34dceb4757
commit
4fe16d607d
@ -102,13 +102,13 @@ public:
|
||||
static ConstantInt *CI = 0;
|
||||
if (CI) return CI;
|
||||
return CI = new ConstantInt(getType(),
|
||||
Val ^ (getType() == Type::BoolTy ? 1 : -1));
|
||||
Val ^ (getType() == Type::Int1Ty ? 1 : -1));
|
||||
}
|
||||
|
||||
/// @returns the value of this ConstantInt only if it's a boolean type.
|
||||
/// @brief return the boolean value of this constant.
|
||||
inline bool getBoolValue() const {
|
||||
assert(getType() == Type::BoolTy && "Should be a boolean constant!");
|
||||
assert(getType() == Type::Int1Ty && "Should be a boolean constant!");
|
||||
return static_cast<bool>(getZExtValue());
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ public:
|
||||
/// @returns true iff this constant's bits are all set to true.
|
||||
/// @brief Determine if the value is all ones.
|
||||
virtual bool isAllOnesValue() const {
|
||||
if (getType() == Type::BoolTy) return getBoolValue() == true;
|
||||
if (getType() == Type::Int1Ty) return getBoolValue() == true;
|
||||
return getSExtValue() == -1;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public:
|
||||
/// by this type.
|
||||
/// @brief Determine if the value is maximal.
|
||||
virtual bool isMaxValue(bool isSigned) const {
|
||||
if (getType() == Type::BoolTy) return getBoolValue() == true;
|
||||
if (getType() == Type::Int1Ty) return getBoolValue() == true;
|
||||
if (isSigned) {
|
||||
int64_t V = getSExtValue();
|
||||
if (V < 0) return false; // Be careful about wrap-around on 'long's
|
||||
@ -163,7 +163,7 @@ public:
|
||||
/// this type.
|
||||
/// @brief Determine if the value is minimal.
|
||||
virtual bool isMinValue(bool isSigned) const {
|
||||
if (getType() == Type::BoolTy) return getBoolValue() == false;
|
||||
if (getType() == Type::Int1Ty) return getBoolValue() == false;
|
||||
if (isSigned) {
|
||||
int64_t V = getSExtValue();
|
||||
if (V > 0) return false; // Be careful about wrap-around on 'long's
|
||||
|
@ -22,7 +22,7 @@ namespace llvm {
|
||||
typedef uintptr_t PointerTy;
|
||||
|
||||
union GenericValue {
|
||||
bool BoolVal;
|
||||
bool Int1Val;
|
||||
unsigned char Int8Val;
|
||||
unsigned short Int16Val;
|
||||
unsigned int Int32Val;
|
||||
|
@ -64,7 +64,7 @@ class LLVMPackedType<ValueType VT, int numelts, LLVMType elty>
|
||||
}
|
||||
|
||||
def llvm_void_ty : LLVMType<isVoid, "Type::VoidTyID">;
|
||||
def llvm_bool_ty : LLVMType<i1 , "Type::BoolTyID">;
|
||||
def llvm_i1_ty : LLVMType<i1 , "Type::Int1TyID">;
|
||||
def llvm_i8_ty : LLVMType<i8 , "Type::Int8TyID">;
|
||||
def llvm_i16_ty : LLVMType<i16, "Type::Int16TyID">;
|
||||
def llvm_i32_ty : LLVMType<i32, "Type::Int32TyID">;
|
||||
|
@ -342,7 +342,7 @@ public:
|
||||
switch (Ty->getTypeID()) {
|
||||
default: assert(0 && "Unknown type!");
|
||||
case Type::VoidTyID: return MVT::isVoid;
|
||||
case Type::BoolTyID: return MVT::i1;
|
||||
case Type::Int1TyID: return MVT::i1;
|
||||
case Type::Int8TyID: return MVT::i8;
|
||||
case Type::Int16TyID: return MVT::i16;
|
||||
case Type::Int32TyID: return MVT::i32;
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
///
|
||||
enum TypeID {
|
||||
// PrimitiveTypes .. make sure LastPrimitiveTyID stays up to date
|
||||
VoidTyID = 0 , BoolTyID, // 0, 1: Basics...
|
||||
VoidTyID = 0 , Int1TyID, // 0, 1: Basics...
|
||||
Int8TyID, // 2 : 8 bit type...
|
||||
Int16TyID, // 3 : 16 bit type...
|
||||
Int32TyID, // 4 : 32 bit type...
|
||||
@ -165,9 +165,9 @@ public:
|
||||
bool isInteger() const { return ID >= Int8TyID && ID <= Int64TyID; }
|
||||
|
||||
/// isIntegral - Returns true if this is an integral type, which is either
|
||||
/// BoolTy or one of the Integer types.
|
||||
/// Int1Ty or one of the Integer types.
|
||||
///
|
||||
bool isIntegral() const { return isInteger() || this == BoolTy; }
|
||||
bool isIntegral() const { return isInteger() || this == Int1Ty; }
|
||||
|
||||
/// isFloatingPoint - Return true if this is one of the two floating point
|
||||
/// types
|
||||
@ -209,7 +209,7 @@ public:
|
||||
///
|
||||
bool isSized() const {
|
||||
// If it's a primitive, it is always sized.
|
||||
if (ID >= BoolTyID && ID <= DoubleTyID || ID == PointerTyID)
|
||||
if (ID >= Int1TyID && ID <= DoubleTyID || ID == PointerTyID)
|
||||
return true;
|
||||
// If it is not something that can have a size (e.g. a function or label),
|
||||
// it doesn't have a size.
|
||||
@ -248,7 +248,7 @@ public:
|
||||
/// will be promoted to if passed through a variable argument
|
||||
/// function.
|
||||
const Type *getVAArgsPromotedType() const {
|
||||
if (ID == BoolTyID || ID == Int8TyID || ID == Int16TyID)
|
||||
if (ID == Int1TyID || ID == Int8TyID || ID == Int16TyID)
|
||||
return Type::Int32Ty;
|
||||
else if (ID == FloatTyID)
|
||||
return Type::DoubleTy;
|
||||
@ -288,7 +288,7 @@ public:
|
||||
//===--------------------------------------------------------------------===//
|
||||
// These are the builtin types that are always available...
|
||||
//
|
||||
static Type *VoidTy , *BoolTy;
|
||||
static Type *VoidTy , *Int1Ty;
|
||||
static Type *Int8Ty , *Int16Ty,
|
||||
*Int32Ty, *Int64Ty;
|
||||
static Type *FloatTy, *DoubleTy;
|
||||
|
@ -435,7 +435,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size,
|
||||
BasePtr->getType())->getElementType()->isSized()) {
|
||||
for (unsigned i = 0; i != GEPOperands.size(); ++i)
|
||||
if (!isa<ConstantInt>(GEPOperands[i]) ||
|
||||
GEPOperands[i]->getType() == Type::BoolTy)
|
||||
GEPOperands[i]->getType() == Type::Int1Ty)
|
||||
GEPOperands[i] =
|
||||
Constant::getNullValue(GEPOperands[i]->getType());
|
||||
int64_t Offset =
|
||||
@ -610,14 +610,14 @@ BasicAliasAnalysis::CheckGEPInstructions(
|
||||
if (GEP1Ops.size() > MinOperands) {
|
||||
for (unsigned i = FirstConstantOper; i != MaxOperands; ++i)
|
||||
if (isa<ConstantInt>(GEP1Ops[i]) &&
|
||||
GEP1Ops[i]->getType() != Type::BoolTy &&
|
||||
GEP1Ops[i]->getType() != Type::Int1Ty &&
|
||||
!cast<Constant>(GEP1Ops[i])->isNullValue()) {
|
||||
// Yup, there's a constant in the tail. Set all variables to
|
||||
// constants in the GEP instruction to make it suiteable for
|
||||
// TargetData::getIndexedOffset.
|
||||
for (i = 0; i != MaxOperands; ++i)
|
||||
if (!isa<ConstantInt>(GEP1Ops[i]) ||
|
||||
GEP1Ops[i]->getType() == Type::BoolTy)
|
||||
GEP1Ops[i]->getType() == Type::Int1Ty)
|
||||
GEP1Ops[i] = Constant::getNullValue(GEP1Ops[i]->getType());
|
||||
// Okay, now get the offset. This is the relative offset for the full
|
||||
// instruction.
|
||||
@ -670,7 +670,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
|
||||
const Value *Op2 = i < GEP2Ops.size() ? GEP2Ops[i] : 0;
|
||||
// If they are equal, use a zero index...
|
||||
if (Op1 == Op2 && BasePtr1Ty == BasePtr2Ty) {
|
||||
if (!isa<ConstantInt>(Op1) || Op1->getType() == Type::BoolTy)
|
||||
if (!isa<ConstantInt>(Op1) || Op1->getType() == Type::Int1Ty)
|
||||
GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Op1->getType());
|
||||
// Otherwise, just keep the constants we have.
|
||||
} else {
|
||||
|
@ -31,7 +31,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
|
||||
if (Ty == Type::BoolTy)
|
||||
if (Ty == Type::Int1Ty)
|
||||
return ConstantInt::getTrue();
|
||||
if (Ty->isInteger()) {
|
||||
if (isSigned) {
|
||||
@ -48,7 +48,7 @@ static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
|
||||
|
||||
// Static constructor to create the minimum constant for an integral type...
|
||||
static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) {
|
||||
if (Ty == Type::BoolTy)
|
||||
if (Ty == Type::Int1Ty)
|
||||
return ConstantInt::getFalse();
|
||||
if (Ty->isInteger()) {
|
||||
if (isSigned) {
|
||||
@ -63,7 +63,7 @@ static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) {
|
||||
return 0;
|
||||
}
|
||||
static ConstantInt *Next(ConstantInt *CI) {
|
||||
if (CI->getType() == Type::BoolTy)
|
||||
if (CI->getType() == Type::Int1Ty)
|
||||
return ConstantInt::get(!CI->getBoolValue());
|
||||
|
||||
Constant *Result = ConstantExpr::getAdd(CI,
|
||||
@ -205,7 +205,7 @@ ConstantInt *ConstantRange::getSingleElement() const {
|
||||
///
|
||||
uint64_t ConstantRange::getSetSize() const {
|
||||
if (isEmptySet()) return 0;
|
||||
if (getType() == Type::BoolTy) {
|
||||
if (getType() == Type::Int1Ty) {
|
||||
if (Lower != Upper) // One of T or F in the set...
|
||||
return 1;
|
||||
return 2; // Must be full set...
|
||||
|
@ -1930,7 +1930,7 @@ ComputeIterationCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) {
|
||||
dyn_cast_or_null<ConstantInt>(EvaluateExpression(Cond, PHIVal));
|
||||
|
||||
// Couldn't symbolically evaluate.
|
||||
if (!CondVal || CondVal->getType() != Type::BoolTy) return UnknownValue;
|
||||
if (!CondVal || CondVal->getType() != Type::Int1Ty) return UnknownValue;
|
||||
|
||||
if (CondVal->getBoolValue() == ExitWhen) {
|
||||
ConstantEvolutionLoopExitValue[PN] = PHIVal;
|
||||
|
@ -881,7 +881,7 @@ goto find_rule; \
|
||||
#define YY_MORE_ADJ 0
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
char *yytext;
|
||||
#line 1 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
#define INITIAL 0
|
||||
/*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
|
||||
//
|
||||
@ -896,7 +896,7 @@ char *yytext;
|
||||
//
|
||||
//===----------------------------------------------------------------------===*/
|
||||
#define YY_NEVER_INTERACTIVE 1
|
||||
#line 28 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
#include "ParserInternals.h"
|
||||
#include "llvm/Module.h"
|
||||
#include <list>
|
||||
@ -1180,7 +1180,7 @@ YY_DECL
|
||||
register char *yy_cp = NULL, *yy_bp = NULL;
|
||||
register int yy_act;
|
||||
|
||||
#line 186 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 186 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
|
||||
|
||||
#line 1187 "Lexer.cpp"
|
||||
@ -1243,7 +1243,7 @@ yy_match:
|
||||
yy_find_action:
|
||||
yy_current_state = *--yy_state_ptr;
|
||||
yy_lp = yy_accept[yy_current_state];
|
||||
find_rule: /* we branch to this label when backing up */
|
||||
|
||||
for ( ; ; ) /* until we find what rule we matched */
|
||||
{
|
||||
if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
|
||||
@ -1276,627 +1276,627 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
{ /* beginning of action switch */
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 188 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 188 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ /* Ignore comments for now */ }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 190 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 190 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return BEGINTOK; }
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 191 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ENDTOK; }
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 192 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 192 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return TRUETOK; }
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 193 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return FALSETOK; }
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 194 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DECLARE; }
|
||||
YY_BREAK
|
||||
case 7:
|
||||
YY_RULE_SETUP
|
||||
#line 195 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DEFINE; }
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 196 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return GLOBAL; }
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 197 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return CONSTANT; }
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 198 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return INTERNAL; }
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 199 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return LINKONCE; }
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 200 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return WEAK; }
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return APPENDING; }
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 202 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DLLIMPORT; }
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 203 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DLLEXPORT; }
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 204 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return EXTERN_WEAK; }
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 205 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return EXTERNAL; }
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 206 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return IMPLEMENTATION; }
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 207 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ZEROINITIALIZER; }
|
||||
YY_BREAK
|
||||
case 20:
|
||||
YY_RULE_SETUP
|
||||
#line 208 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DOTDOTDOT; }
|
||||
YY_BREAK
|
||||
case 21:
|
||||
YY_RULE_SETUP
|
||||
#line 209 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return UNDEF; }
|
||||
YY_BREAK
|
||||
case 22:
|
||||
YY_RULE_SETUP
|
||||
#line 210 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return NULL_TOK; }
|
||||
YY_BREAK
|
||||
case 23:
|
||||
YY_RULE_SETUP
|
||||
#line 211 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return TO; }
|
||||
YY_BREAK
|
||||
case 24:
|
||||
YY_RULE_SETUP
|
||||
#line 212 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return TAIL; }
|
||||
YY_BREAK
|
||||
case 25:
|
||||
YY_RULE_SETUP
|
||||
#line 213 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return TARGET; }
|
||||
YY_BREAK
|
||||
case 26:
|
||||
YY_RULE_SETUP
|
||||
#line 214 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return TRIPLE; }
|
||||
YY_BREAK
|
||||
case 27:
|
||||
YY_RULE_SETUP
|
||||
#line 215 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DEPLIBS; }
|
||||
YY_BREAK
|
||||
case 28:
|
||||
YY_RULE_SETUP
|
||||
#line 216 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ENDIAN; }
|
||||
YY_BREAK
|
||||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 217 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return POINTERSIZE; }
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 218 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return DATALAYOUT; }
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 219 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return LITTLE; }
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 220 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return BIG; }
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 221 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return VOLATILE; }
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 222 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ALIGN; }
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 223 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return SECTION; }
|
||||
YY_BREAK
|
||||
case 36:
|
||||
YY_RULE_SETUP
|
||||
#line 224 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return MODULE; }
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 225 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ASM_TOK; }
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 226 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 226 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return SIDEEFFECT; }
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 228 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return CC_TOK; }
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 229 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return CCC_TOK; }
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 230 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return CSRETCC_TOK; }
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 231 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return FASTCC_TOK; }
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 232 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 232 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return COLDCC_TOK; }
|
||||
YY_BREAK
|
||||
case 44:
|
||||
YY_RULE_SETUP
|
||||
#line 233 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return X86_STDCALLCC_TOK; }
|
||||
YY_BREAK
|
||||
case 45:
|
||||
YY_RULE_SETUP
|
||||
#line 234 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 234 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return X86_FASTCALLCC_TOK; }
|
||||
YY_BREAK
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 236 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::VoidTy, VOID); }
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 237 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::BoolTy, BOOL); }
|
||||
#line 237 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::Int1Ty, BOOL); }
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 238 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::Int8Ty, INT8); }
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
#line 239 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::Int16Ty, INT16); }
|
||||
YY_BREAK
|
||||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 240 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 240 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::Int32Ty, INT32); }
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 241 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::Int64Ty, INT64); }
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 242 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::FloatTy, FLOAT); }
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 243 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::DoubleTy,DOUBLE);}
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 244 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TY(Type::LabelTy, LABEL); }
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 245 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 245 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return TYPE; }
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 246 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 246 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return OPAQUE; }
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 248 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 248 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Add, ADD); }
|
||||
YY_BREAK
|
||||
case 58:
|
||||
YY_RULE_SETUP
|
||||
#line 249 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 249 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Sub, SUB); }
|
||||
YY_BREAK
|
||||
case 59:
|
||||
YY_RULE_SETUP
|
||||
#line 250 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 250 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Mul, MUL); }
|
||||
YY_BREAK
|
||||
case 60:
|
||||
YY_RULE_SETUP
|
||||
#line 251 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 251 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, UDiv, UDIV); }
|
||||
YY_BREAK
|
||||
case 61:
|
||||
YY_RULE_SETUP
|
||||
#line 252 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SDiv, SDIV); }
|
||||
YY_BREAK
|
||||
case 62:
|
||||
YY_RULE_SETUP
|
||||
#line 253 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, FDiv, FDIV); }
|
||||
YY_BREAK
|
||||
case 63:
|
||||
YY_RULE_SETUP
|
||||
#line 254 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, URem, UREM); }
|
||||
YY_BREAK
|
||||
case 64:
|
||||
YY_RULE_SETUP
|
||||
#line 255 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, SRem, SREM); }
|
||||
YY_BREAK
|
||||
case 65:
|
||||
YY_RULE_SETUP
|
||||
#line 256 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 256 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, FRem, FREM); }
|
||||
YY_BREAK
|
||||
case 66:
|
||||
YY_RULE_SETUP
|
||||
#line 257 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, And, AND); }
|
||||
YY_BREAK
|
||||
case 67:
|
||||
YY_RULE_SETUP
|
||||
#line 258 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Or , OR ); }
|
||||
YY_BREAK
|
||||
case 68:
|
||||
YY_RULE_SETUP
|
||||
#line 259 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(BinaryOpVal, Xor, XOR); }
|
||||
YY_BREAK
|
||||
case 69:
|
||||
YY_RULE_SETUP
|
||||
#line 260 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, ICmp, ICMP); }
|
||||
YY_BREAK
|
||||
case 70:
|
||||
YY_RULE_SETUP
|
||||
#line 261 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, FCmp, FCMP); }
|
||||
YY_BREAK
|
||||
case 71:
|
||||
YY_RULE_SETUP
|
||||
#line 262 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return EQ; }
|
||||
YY_BREAK
|
||||
case 72:
|
||||
YY_RULE_SETUP
|
||||
#line 263 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return NE; }
|
||||
YY_BREAK
|
||||
case 73:
|
||||
YY_RULE_SETUP
|
||||
#line 264 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return SLT; }
|
||||
YY_BREAK
|
||||
case 74:
|
||||
YY_RULE_SETUP
|
||||
#line 265 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return SGT; }
|
||||
YY_BREAK
|
||||
case 75:
|
||||
YY_RULE_SETUP
|
||||
#line 266 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return SLE; }
|
||||
YY_BREAK
|
||||
case 76:
|
||||
YY_RULE_SETUP
|
||||
#line 267 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return SGE; }
|
||||
YY_BREAK
|
||||
case 77:
|
||||
YY_RULE_SETUP
|
||||
#line 268 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ULT; }
|
||||
YY_BREAK
|
||||
case 78:
|
||||
YY_RULE_SETUP
|
||||
#line 269 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 269 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return UGT; }
|
||||
YY_BREAK
|
||||
case 79:
|
||||
YY_RULE_SETUP
|
||||
#line 270 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ULE; }
|
||||
YY_BREAK
|
||||
case 80:
|
||||
YY_RULE_SETUP
|
||||
#line 271 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return UGE; }
|
||||
YY_BREAK
|
||||
case 81:
|
||||
YY_RULE_SETUP
|
||||
#line 272 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return OEQ; }
|
||||
YY_BREAK
|
||||
case 82:
|
||||
YY_RULE_SETUP
|
||||
#line 273 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ONE; }
|
||||
YY_BREAK
|
||||
case 83:
|
||||
YY_RULE_SETUP
|
||||
#line 274 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return OLT; }
|
||||
YY_BREAK
|
||||
case 84:
|
||||
YY_RULE_SETUP
|
||||
#line 275 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return OGT; }
|
||||
YY_BREAK
|
||||
case 85:
|
||||
YY_RULE_SETUP
|
||||
#line 276 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return OLE; }
|
||||
YY_BREAK
|
||||
case 86:
|
||||
YY_RULE_SETUP
|
||||
#line 277 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 277 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return OGE; }
|
||||
YY_BREAK
|
||||
case 87:
|
||||
YY_RULE_SETUP
|
||||
#line 278 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return ORD; }
|
||||
YY_BREAK
|
||||
case 88:
|
||||
YY_RULE_SETUP
|
||||
#line 279 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return UNO; }
|
||||
YY_BREAK
|
||||
case 89:
|
||||
YY_RULE_SETUP
|
||||
#line 280 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return UEQ; }
|
||||
YY_BREAK
|
||||
case 90:
|
||||
YY_RULE_SETUP
|
||||
#line 281 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return UNE; }
|
||||
YY_BREAK
|
||||
case 91:
|
||||
YY_RULE_SETUP
|
||||
#line 283 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, PHI, PHI_TOK); }
|
||||
YY_BREAK
|
||||
case 92:
|
||||
YY_RULE_SETUP
|
||||
#line 284 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Call, CALL); }
|
||||
YY_BREAK
|
||||
case 93:
|
||||
YY_RULE_SETUP
|
||||
#line 285 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, Trunc, TRUNC); }
|
||||
YY_BREAK
|
||||
case 94:
|
||||
YY_RULE_SETUP
|
||||
#line 286 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, ZExt, ZEXT); }
|
||||
YY_BREAK
|
||||
case 95:
|
||||
YY_RULE_SETUP
|
||||
#line 287 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, SExt, SEXT); }
|
||||
YY_BREAK
|
||||
case 96:
|
||||
YY_RULE_SETUP
|
||||
#line 288 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, FPTrunc, FPTRUNC); }
|
||||
YY_BREAK
|
||||
case 97:
|
||||
YY_RULE_SETUP
|
||||
#line 289 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, FPExt, FPEXT); }
|
||||
YY_BREAK
|
||||
case 98:
|
||||
YY_RULE_SETUP
|
||||
#line 290 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 290 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, UIToFP, UITOFP); }
|
||||
YY_BREAK
|
||||
case 99:
|
||||
YY_RULE_SETUP
|
||||
#line 291 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 291 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, SIToFP, SITOFP); }
|
||||
YY_BREAK
|
||||
case 100:
|
||||
YY_RULE_SETUP
|
||||
#line 292 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, FPToUI, FPTOUI); }
|
||||
YY_BREAK
|
||||
case 101:
|
||||
YY_RULE_SETUP
|
||||
#line 293 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 293 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, FPToSI, FPTOSI); }
|
||||
YY_BREAK
|
||||
case 102:
|
||||
YY_RULE_SETUP
|
||||
#line 294 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, IntToPtr, INTTOPTR); }
|
||||
YY_BREAK
|
||||
case 103:
|
||||
YY_RULE_SETUP
|
||||
#line 295 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, PtrToInt, PTRTOINT); }
|
||||
YY_BREAK
|
||||
case 104:
|
||||
YY_RULE_SETUP
|
||||
#line 296 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(CastOpVal, BitCast, BITCAST); }
|
||||
YY_BREAK
|
||||
case 105:
|
||||
YY_RULE_SETUP
|
||||
#line 297 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Select, SELECT); }
|
||||
YY_BREAK
|
||||
case 106:
|
||||
YY_RULE_SETUP
|
||||
#line 298 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, Shl, SHL); }
|
||||
YY_BREAK
|
||||
case 107:
|
||||
YY_RULE_SETUP
|
||||
#line 299 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, LShr, LSHR); }
|
||||
YY_BREAK
|
||||
case 108:
|
||||
YY_RULE_SETUP
|
||||
#line 300 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 300 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, AShr, ASHR); }
|
||||
YY_BREAK
|
||||
case 109:
|
||||
YY_RULE_SETUP
|
||||
#line 301 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, VAArg , VAARG); }
|
||||
YY_BREAK
|
||||
case 110:
|
||||
YY_RULE_SETUP
|
||||
#line 302 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Ret, RET); }
|
||||
YY_BREAK
|
||||
case 111:
|
||||
YY_RULE_SETUP
|
||||
#line 303 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Br, BR); }
|
||||
YY_BREAK
|
||||
case 112:
|
||||
YY_RULE_SETUP
|
||||
#line 304 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 304 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Switch, SWITCH); }
|
||||
YY_BREAK
|
||||
case 113:
|
||||
YY_RULE_SETUP
|
||||
#line 305 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 305 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Invoke, INVOKE); }
|
||||
YY_BREAK
|
||||
case 114:
|
||||
YY_RULE_SETUP
|
||||
#line 306 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
|
||||
YY_BREAK
|
||||
case 115:
|
||||
YY_RULE_SETUP
|
||||
#line 307 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 307 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); }
|
||||
YY_BREAK
|
||||
case 116:
|
||||
YY_RULE_SETUP
|
||||
#line 309 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 309 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Malloc, MALLOC); }
|
||||
YY_BREAK
|
||||
case 117:
|
||||
YY_RULE_SETUP
|
||||
#line 310 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 310 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Alloca, ALLOCA); }
|
||||
YY_BREAK
|
||||
case 118:
|
||||
YY_RULE_SETUP
|
||||
#line 311 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Free, FREE); }
|
||||
YY_BREAK
|
||||
case 119:
|
||||
YY_RULE_SETUP
|
||||
#line 312 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 312 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Load, LOAD); }
|
||||
YY_BREAK
|
||||
case 120:
|
||||
YY_RULE_SETUP
|
||||
#line 313 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 313 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, Store, STORE); }
|
||||
YY_BREAK
|
||||
case 121:
|
||||
YY_RULE_SETUP
|
||||
#line 314 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 314 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
|
||||
YY_BREAK
|
||||
case 122:
|
||||
YY_RULE_SETUP
|
||||
#line 316 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 316 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
|
||||
YY_BREAK
|
||||
case 123:
|
||||
YY_RULE_SETUP
|
||||
#line 317 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 317 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
|
||||
YY_BREAK
|
||||
case 124:
|
||||
YY_RULE_SETUP
|
||||
#line 318 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 318 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
|
||||
YY_BREAK
|
||||
case 125:
|
||||
YY_RULE_SETUP
|
||||
#line 321 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 321 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
UnEscapeLexed(yytext+1);
|
||||
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
|
||||
@ -1905,7 +1905,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 126:
|
||||
YY_RULE_SETUP
|
||||
#line 326 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 326 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
yytext[strlen(yytext)-1] = 0; // nuke colon
|
||||
UnEscapeLexed(yytext);
|
||||
@ -1915,7 +1915,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 127:
|
||||
YY_RULE_SETUP
|
||||
#line 332 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 332 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
|
||||
UnEscapeLexed(yytext+1);
|
||||
@ -1925,7 +1925,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 128:
|
||||
YY_RULE_SETUP
|
||||
#line 339 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 339 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ // Note that we cannot unescape a string constant here! The
|
||||
// string constant might contain a \00 which would not be
|
||||
// understood by the string stuff. It is valid to make a
|
||||
@ -1938,12 +1938,12 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 129:
|
||||
YY_RULE_SETUP
|
||||
#line 350 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 350 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
|
||||
YY_BREAK
|
||||
case 130:
|
||||
YY_RULE_SETUP
|
||||
#line 351 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 351 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
// +1: we have bigger negative range
|
||||
@ -1955,7 +1955,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 131:
|
||||
YY_RULE_SETUP
|
||||
#line 359 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 359 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
|
||||
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
|
||||
@ -1963,7 +1963,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 132:
|
||||
YY_RULE_SETUP
|
||||
#line 364 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 364 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+1);
|
||||
if ((unsigned)Val != Val)
|
||||
@ -1974,7 +1974,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 133:
|
||||
YY_RULE_SETUP
|
||||
#line 371 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 371 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
uint64_t Val = atoull(yytext+2);
|
||||
// +1: we have bigger negative range
|
||||
@ -1986,16 +1986,16 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 134:
|
||||
YY_RULE_SETUP
|
||||
#line 380 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 380 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
|
||||
YY_BREAK
|
||||
case 135:
|
||||
YY_RULE_SETUP
|
||||
#line 381 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 381 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
#line 383 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 383 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{
|
||||
/* Make sure to free the internal buffers for flex when we are
|
||||
* done reading our input!
|
||||
@ -2006,17 +2006,17 @@ case YY_STATE_EOF(INITIAL):
|
||||
YY_BREAK
|
||||
case 136:
|
||||
YY_RULE_SETUP
|
||||
#line 391 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 391 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ /* Ignore whitespace */ }
|
||||
YY_BREAK
|
||||
case 137:
|
||||
YY_RULE_SETUP
|
||||
#line 392 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 392 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
{ return yytext[0]; }
|
||||
YY_BREAK
|
||||
case 138:
|
||||
YY_RULE_SETUP
|
||||
#line 394 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 394 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
YY_FATAL_ERROR( "flex scanner jammed" );
|
||||
YY_BREAK
|
||||
#line 2023 "Lexer.cpp"
|
||||
@ -2897,5 +2897,5 @@ int main()
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 394 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
|
||||
#line 394 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
|
||||
|
||||
|
@ -234,7 +234,7 @@ x86_stdcallcc { return X86_STDCALLCC_TOK; }
|
||||
x86_fastcallcc { return X86_FASTCALLCC_TOK; }
|
||||
|
||||
void { RET_TY(Type::VoidTy, VOID); }
|
||||
bool { RET_TY(Type::BoolTy, BOOL); }
|
||||
bool { RET_TY(Type::Int1Ty, BOOL); }
|
||||
i8 { RET_TY(Type::Int8Ty, INT8); }
|
||||
i16 { RET_TY(Type::Int16Ty, INT16); }
|
||||
i32 { RET_TY(Type::Int32Ty, INT32); }
|
||||
|
@ -234,7 +234,7 @@ x86_stdcallcc { return X86_STDCALLCC_TOK; }
|
||||
x86_fastcallcc { return X86_FASTCALLCC_TOK; }
|
||||
|
||||
void { RET_TY(Type::VoidTy, VOID); }
|
||||
bool { RET_TY(Type::BoolTy, BOOL); }
|
||||
bool { RET_TY(Type::Int1Ty, BOOL); }
|
||||
i8 { RET_TY(Type::Int8Ty, INT8); }
|
||||
i16 { RET_TY(Type::Int16Ty, INT16); }
|
||||
i32 { RET_TY(Type::Int32Ty, INT32); }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -303,7 +303,7 @@
|
||||
|
||||
|
||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
||||
#line 876 "/developer/zsth/llvm-gcc-dev/HEAD/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
|
||||
#line 876 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y"
|
||||
typedef union YYSTYPE {
|
||||
llvm::Module *ModuleVal;
|
||||
llvm::Function *FunctionVal;
|
||||
|
@ -1721,7 +1721,7 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' {
|
||||
if ($3->getType() != Type::BoolTy)
|
||||
if ($3->getType() != Type::Int1Ty)
|
||||
GEN_ERROR("Select condition must be of boolean type!");
|
||||
if ($5->getType() != $7->getType())
|
||||
GEN_ERROR("Select operand types must match!");
|
||||
@ -2347,7 +2347,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
CHECK_FOR_ERROR
|
||||
BasicBlock* tmpBBB = getBBVal($9);
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal = getVal(Type::BoolTy, $3);
|
||||
Value* tmpVal = getVal(Type::Int1Ty, $3);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = new BranchInst(tmpBBA, tmpBBB, tmpVal);
|
||||
}
|
||||
@ -2647,7 +2647,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
delete $4;
|
||||
}
|
||||
| SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
|
||||
if ($2->getType() != Type::BoolTy)
|
||||
if ($2->getType() != Type::Int1Ty)
|
||||
GEN_ERROR("select condition must be boolean!");
|
||||
if ($4->getType() != $6->getType())
|
||||
GEN_ERROR("select value types should match!");
|
||||
|
@ -1721,7 +1721,7 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
|
||||
CHECK_FOR_ERROR
|
||||
}
|
||||
| SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' {
|
||||
if ($3->getType() != Type::BoolTy)
|
||||
if ($3->getType() != Type::Int1Ty)
|
||||
GEN_ERROR("Select condition must be of boolean type!");
|
||||
if ($5->getType() != $7->getType())
|
||||
GEN_ERROR("Select operand types must match!");
|
||||
@ -2347,7 +2347,7 @@ BBTerminatorInst : RET ResolvedVal { // Return with a result...
|
||||
CHECK_FOR_ERROR
|
||||
BasicBlock* tmpBBB = getBBVal($9);
|
||||
CHECK_FOR_ERROR
|
||||
Value* tmpVal = getVal(Type::BoolTy, $3);
|
||||
Value* tmpVal = getVal(Type::Int1Ty, $3);
|
||||
CHECK_FOR_ERROR
|
||||
$$ = new BranchInst(tmpBBA, tmpBBB, tmpVal);
|
||||
}
|
||||
@ -2647,7 +2647,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
|
||||
delete $4;
|
||||
}
|
||||
| SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
|
||||
if ($2->getType() != Type::BoolTy)
|
||||
if ($2->getType() != Type::Int1Ty)
|
||||
GEN_ERROR("select condition must be boolean!");
|
||||
if ($4->getType() != $6->getType())
|
||||
GEN_ERROR("select value types should match!");
|
||||
|
@ -684,7 +684,7 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
|
||||
case Instruction::Select:
|
||||
if (Oprnds.size() != 3)
|
||||
error("Invalid Select instruction!");
|
||||
Result = new SelectInst(getValue(Type::BoolTyID, Oprnds[0]),
|
||||
Result = new SelectInst(getValue(Type::Int1TyID, Oprnds[0]),
|
||||
getValue(iType, Oprnds[1]),
|
||||
getValue(iType, Oprnds[2]));
|
||||
break;
|
||||
@ -730,7 +730,7 @@ void BytecodeReader::ParseInstruction(std::vector<unsigned> &Oprnds,
|
||||
Result = new BranchInst(getBasicBlock(Oprnds[0]));
|
||||
else if (Oprnds.size() == 3)
|
||||
Result = new BranchInst(getBasicBlock(Oprnds[0]),
|
||||
getBasicBlock(Oprnds[1]), getValue(Type::BoolTyID , Oprnds[2]));
|
||||
getBasicBlock(Oprnds[1]), getValue(Type::Int1TyID , Oprnds[2]));
|
||||
else
|
||||
error("Invalid number of operands for a 'br' instruction!");
|
||||
break;
|
||||
@ -1399,7 +1399,7 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
|
||||
const Type *Ty = getType(TypeID);
|
||||
Constant *Result = 0;
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID: {
|
||||
case Type::Int1TyID: {
|
||||
unsigned Val = read_vbr_uint();
|
||||
if (Val != 0 && Val != 1)
|
||||
error("Invalid boolean value read.");
|
||||
|
@ -321,7 +321,7 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
|
||||
}
|
||||
|
||||
switch (CPV->getType()->getTypeID()) {
|
||||
case Type::BoolTyID: // Boolean Types
|
||||
case Type::Int1TyID: // Boolean Types
|
||||
if (cast<ConstantInt>(CPV)->getBoolValue())
|
||||
output_vbr(1U);
|
||||
else
|
||||
|
@ -389,7 +389,7 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
|
||||
if (CV->isNullValue() || isa<UndefValue>(CV))
|
||||
O << "0";
|
||||
else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
|
||||
if (CI->getType() == Type::BoolTy) {
|
||||
if (CI->getType() == Type::Int1Ty) {
|
||||
assert(CI->getBoolValue());
|
||||
O << "1";
|
||||
} else O << CI->getSExtValue();
|
||||
@ -917,7 +917,7 @@ void AsmPrinter::printSetLabel(unsigned uid, unsigned uid2,
|
||||
void AsmPrinter::printDataDirective(const Type *type) {
|
||||
const TargetData *TD = TM.getTargetData();
|
||||
switch (type->getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID:
|
||||
O << TAI->getData8bitsDirective();
|
||||
break;
|
||||
|
@ -729,7 +729,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
|
||||
uint64_t val;
|
||||
|
||||
switch (PC->getType()->getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID:
|
||||
ptr[0] = cast<ConstantInt>(PC)->getZExtValue();
|
||||
break;
|
||||
|
@ -363,7 +363,7 @@ public:
|
||||
Fields.push_back(Type::Int64Ty);
|
||||
}
|
||||
virtual void Apply(bool &Field) {
|
||||
Fields.push_back(Type::BoolTy);
|
||||
Fields.push_back(Type::Int1Ty);
|
||||
}
|
||||
virtual void Apply(std::string &Field) {
|
||||
Fields.push_back(SR.getStrPtrType());
|
||||
@ -426,7 +426,7 @@ public:
|
||||
}
|
||||
virtual void Apply(bool &Field) {
|
||||
Constant *C = CI->getOperand(I++);
|
||||
IsValid = IsValid && isa<ConstantInt>(C) && C->getType() == Type::BoolTy;
|
||||
IsValid = IsValid && isa<ConstantInt>(C) && C->getType() == Type::Int1Ty;
|
||||
}
|
||||
virtual void Apply(std::string &Field) {
|
||||
Constant *C = CI->getOperand(I++);
|
||||
|
@ -351,7 +351,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
Constant *Op = CE->getOperand(0);
|
||||
GenericValue GV = getConstantValue(Op);
|
||||
switch (Op->getType()->getTypeID()) {
|
||||
case Type::BoolTyID: return PTOGV((void*)(uintptr_t)GV.BoolVal);
|
||||
case Type::Int1TyID: return PTOGV((void*)(uintptr_t)GV.Int1Val);
|
||||
case Type::Int8TyID: return PTOGV((void*)(uintptr_t)GV.Int8Val);
|
||||
case Type::Int16TyID: return PTOGV((void*)(uintptr_t)GV.Int16Val);
|
||||
case Type::Int32TyID: return PTOGV((void*)(uintptr_t)GV.Int32Val);
|
||||
@ -399,7 +399,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
|
||||
switch (C->getType()->getTypeID()) {
|
||||
#define GET_CONST_VAL(TY, CTY, CLASS, GETMETH) \
|
||||
case Type::TY##TyID: Result.TY##Val = (CTY)cast<CLASS>(C)->GETMETH(); break
|
||||
GET_CONST_VAL(Bool , bool , ConstantInt, getBoolValue);
|
||||
GET_CONST_VAL(Int1 , bool , ConstantInt, getBoolValue);
|
||||
GET_CONST_VAL(Int8 , unsigned char , ConstantInt, getZExtValue);
|
||||
GET_CONST_VAL(Int16 , unsigned short, ConstantInt, getZExtValue);
|
||||
GET_CONST_VAL(Int32 , unsigned int , ConstantInt, getZExtValue);
|
||||
@ -433,7 +433,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
|
||||
const Type *Ty) {
|
||||
if (getTargetData()->isLittleEndian()) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID: Ptr->Untyped[0] = Val.Int8Val; break;
|
||||
case Type::Int16TyID: Ptr->Untyped[0] = Val.Int16Val & 255;
|
||||
Ptr->Untyped[1] = (Val.Int16Val >> 8) & 255;
|
||||
@ -463,7 +463,7 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr,
|
||||
}
|
||||
} else {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID: Ptr->Untyped[0] = Val.Int8Val; break;
|
||||
case Type::Int16TyID: Ptr->Untyped[1] = Val.Int16Val & 255;
|
||||
Ptr->Untyped[0] = (Val.Int16Val >> 8) & 255;
|
||||
@ -501,7 +501,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
|
||||
GenericValue Result;
|
||||
if (getTargetData()->isLittleEndian()) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID: Result.Int8Val = Ptr->Untyped[0]; break;
|
||||
case Type::Int16TyID: Result.Int16Val = (unsigned)Ptr->Untyped[0] |
|
||||
((unsigned)Ptr->Untyped[1] << 8);
|
||||
@ -531,7 +531,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
|
||||
}
|
||||
} else {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID: Result.Int8Val = Ptr->Untyped[0]; break;
|
||||
case Type::Int16TyID: Result.Int16Val = (unsigned)Ptr->Untyped[1] |
|
||||
((unsigned)Ptr->Untyped[0] << 8);
|
||||
|
@ -339,7 +339,7 @@ static GenericValue executeAndInst(GenericValue Src1, GenericValue Src2,
|
||||
const Type *Ty) {
|
||||
GenericValue Dest;
|
||||
switch (Ty->getTypeID()) {
|
||||
IMPLEMENT_BINARY_OPERATOR(&, Bool);
|
||||
IMPLEMENT_BINARY_OPERATOR(&, Int1);
|
||||
IMPLEMENT_BINARY_OPERATOR(&, Int8);
|
||||
IMPLEMENT_BINARY_OPERATOR(&, Int16);
|
||||
IMPLEMENT_BINARY_OPERATOR(&, Int32);
|
||||
@ -355,7 +355,7 @@ static GenericValue executeOrInst(GenericValue Src1, GenericValue Src2,
|
||||
const Type *Ty) {
|
||||
GenericValue Dest;
|
||||
switch (Ty->getTypeID()) {
|
||||
IMPLEMENT_BINARY_OPERATOR(|, Bool);
|
||||
IMPLEMENT_BINARY_OPERATOR(|, Int1);
|
||||
IMPLEMENT_BINARY_OPERATOR(|, Int8);
|
||||
IMPLEMENT_BINARY_OPERATOR(|, Int16);
|
||||
IMPLEMENT_BINARY_OPERATOR(|, Int32);
|
||||
@ -371,7 +371,7 @@ static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2,
|
||||
const Type *Ty) {
|
||||
GenericValue Dest;
|
||||
switch (Ty->getTypeID()) {
|
||||
IMPLEMENT_BINARY_OPERATOR(^, Bool);
|
||||
IMPLEMENT_BINARY_OPERATOR(^, Int1);
|
||||
IMPLEMENT_BINARY_OPERATOR(^, Int8);
|
||||
IMPLEMENT_BINARY_OPERATOR(^, Int16);
|
||||
IMPLEMENT_BINARY_OPERATOR(^, Int32);
|
||||
@ -384,7 +384,7 @@ static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2,
|
||||
}
|
||||
|
||||
#define IMPLEMENT_ICMP(OP, TY, CAST) \
|
||||
case Type::TY##TyID: Dest.BoolVal = \
|
||||
case Type::TY##TyID: Dest.Int1Val = \
|
||||
((CAST)Src1.TY##Val) OP ((CAST)Src2.TY##Val); break
|
||||
|
||||
// Handle pointers specially because they must be compared with only as much
|
||||
@ -393,7 +393,7 @@ static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2,
|
||||
// comparisons if they contain garbage.
|
||||
#define IMPLEMENT_POINTERCMP(OP) \
|
||||
case Type::PointerTyID: \
|
||||
Dest.BoolVal = (void*)(intptr_t)Src1.PointerVal OP \
|
||||
Dest.Int1Val = (void*)(intptr_t)Src1.PointerVal OP \
|
||||
(void*)(intptr_t)Src2.PointerVal; break
|
||||
|
||||
static GenericValue executeICMP_EQ(GenericValue Src1, GenericValue Src2,
|
||||
@ -583,7 +583,7 @@ void Interpreter::visitICmpInst(ICmpInst &I) {
|
||||
}
|
||||
|
||||
#define IMPLEMENT_FCMP(OP, TY) \
|
||||
case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break
|
||||
case Type::TY##TyID: Dest.Int1Val = Src1.TY##Val OP Src2.TY##Val; break
|
||||
|
||||
static GenericValue executeFCMP_EQ(GenericValue Src1, GenericValue Src2,
|
||||
const Type *Ty) {
|
||||
@ -672,7 +672,7 @@ void Interpreter::visitFCmpInst(FCmpInst &I) {
|
||||
GenericValue R; // Result
|
||||
|
||||
switch (I.getPredicate()) {
|
||||
case FCmpInst::FCMP_FALSE: R.BoolVal = false;
|
||||
case FCmpInst::FCMP_FALSE: R.Int1Val = false;
|
||||
case FCmpInst::FCMP_ORD: R = executeFCMP_EQ(Src1, Src2, Ty); break; ///???
|
||||
case FCmpInst::FCMP_UNO: R = executeFCMP_NE(Src1, Src2, Ty); break; ///???
|
||||
case FCmpInst::FCMP_OEQ:
|
||||
@ -687,7 +687,7 @@ void Interpreter::visitFCmpInst(FCmpInst &I) {
|
||||
case FCmpInst::FCMP_ULE: R = executeFCMP_LE(Src1, Src2, Ty); break;
|
||||
case FCmpInst::FCMP_OGE:
|
||||
case FCmpInst::FCMP_UGE: R = executeFCMP_GE(Src1, Src2, Ty); break;
|
||||
case FCmpInst::FCMP_TRUE: R.BoolVal = true;
|
||||
case FCmpInst::FCMP_TRUE: R.Int1Val = true;
|
||||
default:
|
||||
cerr << "Don't know how to handle this FCmp predicate!\n-->" << I;
|
||||
abort();
|
||||
@ -726,12 +726,12 @@ static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1,
|
||||
case FCmpInst::FCMP_UGE: return executeFCMP_GE(Src1, Src2, Ty); break;
|
||||
case FCmpInst::FCMP_FALSE: {
|
||||
GenericValue Result;
|
||||
Result.BoolVal = false;
|
||||
Result.Int1Val = false;
|
||||
return Result;
|
||||
}
|
||||
case FCmpInst::FCMP_TRUE: {
|
||||
GenericValue Result;
|
||||
Result.BoolVal = true;
|
||||
Result.Int1Val = true;
|
||||
return Result;
|
||||
}
|
||||
default:
|
||||
@ -770,7 +770,7 @@ void Interpreter::visitBinaryOperator(BinaryOperator &I) {
|
||||
|
||||
static GenericValue executeSelectInst(GenericValue Src1, GenericValue Src2,
|
||||
GenericValue Src3) {
|
||||
return Src1.BoolVal ? Src2 : Src3;
|
||||
return Src1.Int1Val ? Src2 : Src3;
|
||||
}
|
||||
|
||||
void Interpreter::visitSelectInst(SelectInst &I) {
|
||||
@ -873,7 +873,7 @@ void Interpreter::visitBranchInst(BranchInst &I) {
|
||||
Dest = I.getSuccessor(0); // Uncond branches have a fixed dest...
|
||||
if (!I.isUnconditional()) {
|
||||
Value *Cond = I.getCondition();
|
||||
if (getOperandValue(Cond, SF).BoolVal == 0) // If false cond...
|
||||
if (getOperandValue(Cond, SF).Int1Val == 0) // If false cond...
|
||||
Dest = I.getSuccessor(1);
|
||||
}
|
||||
SwitchToNewBasicBlock(Dest, SF);
|
||||
@ -888,7 +888,7 @@ void Interpreter::visitSwitchInst(SwitchInst &I) {
|
||||
BasicBlock *Dest = 0;
|
||||
for (unsigned i = 2, e = I.getNumOperands(); i != e; i += 2)
|
||||
if (executeICMP_EQ(CondVal,
|
||||
getOperandValue(I.getOperand(i), SF), ElTy).BoolVal) {
|
||||
getOperandValue(I.getOperand(i), SF), ElTy).Int1Val) {
|
||||
Dest = cast<BasicBlock>(I.getOperand(i+1));
|
||||
break;
|
||||
}
|
||||
@ -1089,8 +1089,8 @@ void Interpreter::visitCallSite(CallSite CS) {
|
||||
ArgVals.back().Int32Val = ArgVals.back().Int16Val;
|
||||
else if (Ty == Type::Int8Ty)
|
||||
ArgVals.back().Int32Val = ArgVals.back().Int8Val;
|
||||
else if (Ty == Type::BoolTy)
|
||||
ArgVals.back().Int32Val = ArgVals.back().BoolVal;
|
||||
else if (Ty == Type::Int1Ty)
|
||||
ArgVals.back().Int32Val = ArgVals.back().Int1Val;
|
||||
else
|
||||
assert(0 && "Unknown type!");
|
||||
}
|
||||
@ -1192,7 +1192,7 @@ void Interpreter::visitAShr(ShiftInst &I) {
|
||||
#define IMPLEMENT_CAST_CASE(DTY, CAST) \
|
||||
case Type::DTY##TyID: \
|
||||
switch (SrcTy->getTypeID()) { \
|
||||
IMPLEMENT_CAST(Bool, DTY, CAST); \
|
||||
IMPLEMENT_CAST(Int1, DTY, CAST); \
|
||||
IMPLEMENT_CAST(Int8, DTY, CAST); \
|
||||
IMPLEMENT_CAST(Int16, DTY, CAST); \
|
||||
IMPLEMENT_CAST(Int32, DTY, CAST); \
|
||||
@ -1220,10 +1220,10 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
|
||||
const Type *SrcTy = SrcVal->getType();
|
||||
GenericValue Dest, Src = getOperandValue(SrcVal, SF);
|
||||
|
||||
if (opcode == Instruction::Trunc && DstTy->getTypeID() == Type::BoolTyID) {
|
||||
if (opcode == Instruction::Trunc && DstTy->getTypeID() == Type::Int1TyID) {
|
||||
// For truncations to bool, we must clear the high order bits of the source
|
||||
switch (SrcTy->getTypeID()) {
|
||||
case Type::BoolTyID: Src.BoolVal &= 1; break;
|
||||
case Type::Int1TyID: Src.Int1Val &= 1; break;
|
||||
case Type::Int8TyID: Src.Int8Val &= 1; break;
|
||||
case Type::Int16TyID: Src.Int16Val &= 1; break;
|
||||
case Type::Int32TyID: Src.Int32Val &= 1; break;
|
||||
@ -1233,16 +1233,16 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
|
||||
break;
|
||||
}
|
||||
} else if (opcode == Instruction::SExt &&
|
||||
SrcTy->getTypeID() == Type::BoolTyID) {
|
||||
SrcTy->getTypeID() == Type::Int1TyID) {
|
||||
// For sign extension from bool, we must extend the source bits.
|
||||
SrcTy = Type::Int64Ty;
|
||||
Src.Int64Val = 0 - Src.BoolVal;
|
||||
Src.Int64Val = 0 - Src.Int1Val;
|
||||
}
|
||||
|
||||
switch (opcode) {
|
||||
case Instruction::Trunc: // src integer, dest integral (can't be long)
|
||||
IMPLEMENT_CAST_START
|
||||
IMPLEMENT_CAST_CASE(Bool , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int1 , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int8 , (uint8_t));
|
||||
IMPLEMENT_CAST_CASE(Int16, (uint16_t));
|
||||
IMPLEMENT_CAST_CASE(Int32, (uint32_t));
|
||||
@ -1289,7 +1289,7 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
|
||||
break;
|
||||
case Instruction::FPToUI: // src floating, dest integral
|
||||
IMPLEMENT_CAST_START
|
||||
IMPLEMENT_CAST_CASE(Bool , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int1 , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int8 , (uint8_t));
|
||||
IMPLEMENT_CAST_CASE(Int16, (uint16_t));
|
||||
IMPLEMENT_CAST_CASE(Int32, (uint32_t ));
|
||||
@ -1298,7 +1298,7 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
|
||||
break;
|
||||
case Instruction::FPToSI: // src floating, dest integral
|
||||
IMPLEMENT_CAST_START
|
||||
IMPLEMENT_CAST_CASE(Bool , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int1 , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int8 , (uint8_t) (int8_t));
|
||||
IMPLEMENT_CAST_CASE(Int16, (uint16_t)(int16_t));
|
||||
IMPLEMENT_CAST_CASE(Int32, (uint32_t)(int32_t));
|
||||
@ -1307,7 +1307,7 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
|
||||
break;
|
||||
case Instruction::PtrToInt: // src pointer, dest integral
|
||||
IMPLEMENT_CAST_START
|
||||
IMPLEMENT_CAST_CASE(Bool , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int1 , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int8 , (uint8_t));
|
||||
IMPLEMENT_CAST_CASE(Int16, (uint16_t));
|
||||
IMPLEMENT_CAST_CASE(Int32, (uint32_t));
|
||||
@ -1321,7 +1321,7 @@ GenericValue Interpreter::executeCastOperation(Instruction::CastOps opcode,
|
||||
break;
|
||||
case Instruction::BitCast: // src any, dest any (same size)
|
||||
IMPLEMENT_CAST_START
|
||||
IMPLEMENT_CAST_CASE(Bool , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int1 , (bool));
|
||||
IMPLEMENT_CAST_CASE(Int8 , (uint8_t));
|
||||
IMPLEMENT_CAST_CASE(Int16 , (uint16_t));
|
||||
IMPLEMENT_CAST_CASE(Int32 , (uint32_t));
|
||||
@ -1365,7 +1365,7 @@ void Interpreter::visitVAArgInst(VAArgInst &I) {
|
||||
IMPLEMENT_VAARG(Pointer);
|
||||
IMPLEMENT_VAARG(Float);
|
||||
IMPLEMENT_VAARG(Double);
|
||||
IMPLEMENT_VAARG(Bool);
|
||||
IMPLEMENT_VAARG(Int1);
|
||||
default:
|
||||
cerr << "Unhandled dest type for vaarg instruction: " << *Ty << "\n";
|
||||
abort();
|
||||
|
@ -41,7 +41,7 @@ static Interpreter *TheInterpreter;
|
||||
static char getTypeID(const Type *Ty) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: return 'V';
|
||||
case Type::BoolTyID: return 'o';
|
||||
case Type::Int1TyID: return 'o';
|
||||
case Type::Int8TyID: return 'B';
|
||||
case Type::Int16TyID: return 'S';
|
||||
case Type::Int32TyID: return 'I';
|
||||
|
@ -142,8 +142,8 @@ GenericValue JIT::runFunction(Function *F,
|
||||
GenericValue rv;
|
||||
switch (RetTy->getTypeID()) {
|
||||
default: assert(0 && "Unknown return type for function call!");
|
||||
case Type::BoolTyID:
|
||||
rv.BoolVal = ((bool(*)())(intptr_t)FPtr)();
|
||||
case Type::Int1TyID:
|
||||
rv.Int1Val = ((bool(*)())(intptr_t)FPtr)();
|
||||
return rv;
|
||||
case Type::Int8TyID:
|
||||
rv.Int8Val = ((char(*)())(intptr_t)FPtr)();
|
||||
@ -191,7 +191,7 @@ GenericValue JIT::runFunction(Function *F,
|
||||
const GenericValue &AV = ArgValues[i];
|
||||
switch (ArgTy->getTypeID()) {
|
||||
default: assert(0 && "Unknown argument type for function call!");
|
||||
case Type::BoolTyID: C = ConstantInt::get(AV.BoolVal); break;
|
||||
case Type::Int1TyID: C = ConstantInt::get(AV.Int1Val); break;
|
||||
case Type::Int8TyID: C = ConstantInt::get(ArgTy, AV.Int8Val); break;
|
||||
case Type::Int16TyID: C = ConstantInt::get(ArgTy, AV.Int16Val); break;
|
||||
case Type::Int32TyID: C = ConstantInt::get(ArgTy, AV.Int32Val); break;
|
||||
|
@ -31,7 +31,7 @@
|
||||
using namespace llvm;
|
||||
|
||||
static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
|
||||
if (Ty == Type::BoolTy)
|
||||
if (Ty == Type::Int1Ty)
|
||||
return ConstantInt::getTrue();
|
||||
if (Ty->isInteger()) {
|
||||
if (isSigned) {
|
||||
@ -48,7 +48,7 @@ static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) {
|
||||
|
||||
// Static constructor to create the minimum constant for an integral type...
|
||||
static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) {
|
||||
if (Ty == Type::BoolTy)
|
||||
if (Ty == Type::Int1Ty)
|
||||
return ConstantInt::getFalse();
|
||||
if (Ty->isInteger()) {
|
||||
if (isSigned) {
|
||||
@ -63,7 +63,7 @@ static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) {
|
||||
return 0;
|
||||
}
|
||||
static ConstantInt *Next(ConstantInt *CI) {
|
||||
if (CI->getType() == Type::BoolTy)
|
||||
if (CI->getType() == Type::Int1Ty)
|
||||
return ConstantInt::get(!CI->getBoolValue());
|
||||
|
||||
Constant *Result = ConstantExpr::getAdd(CI,
|
||||
@ -205,7 +205,7 @@ ConstantInt *ConstantRange::getSingleElement() const {
|
||||
///
|
||||
uint64_t ConstantRange::getSetSize() const {
|
||||
if (isEmptySet()) return 0;
|
||||
if (getType() == Type::BoolTy) {
|
||||
if (getType() == Type::Int1Ty) {
|
||||
if (Lower != Upper) // One of T or F in the set...
|
||||
return 1;
|
||||
return 2; // Must be full set...
|
||||
|
@ -369,7 +369,7 @@ CWriter::printPrimitiveType(std::ostream &Out, const Type *Ty, bool isSigned,
|
||||
assert(Ty->isPrimitiveType() && "Invalid type for printPrimitiveType");
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
||||
case Type::BoolTyID: return Out << "bool " << NameSoFar;
|
||||
case Type::Int1TyID: return Out << "bool " << NameSoFar;
|
||||
case Type::Int8TyID:
|
||||
return Out << (isSigned?"signed":"unsigned") << " char " << NameSoFar;
|
||||
case Type::Int16TyID:
|
||||
@ -688,12 +688,12 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
Out << "(";
|
||||
printCast(CE->getOpcode(), CE->getOperand(0)->getType(), CE->getType());
|
||||
if (CE->getOpcode() == Instruction::SExt &&
|
||||
CE->getOperand(0)->getType() == Type::BoolTy) {
|
||||
CE->getOperand(0)->getType() == Type::Int1Ty) {
|
||||
// Make sure we really sext from bool here by subtracting from 0
|
||||
Out << "0-";
|
||||
}
|
||||
printConstant(CE->getOperand(0));
|
||||
if (CE->getType() == Type::BoolTy &&
|
||||
if (CE->getType() == Type::Int1Ty &&
|
||||
(CE->getOpcode() == Instruction::Trunc ||
|
||||
CE->getOpcode() == Instruction::FPToUI ||
|
||||
CE->getOpcode() == Instruction::FPToSI ||
|
||||
@ -828,7 +828,7 @@ void CWriter::printConstant(Constant *CPV) {
|
||||
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(CPV)) {
|
||||
const Type* Ty = CI->getType();
|
||||
if (Ty == Type::BoolTy)
|
||||
if (Ty == Type::Int1Ty)
|
||||
Out << (CI->getBoolValue() ? '1' : '0') ;
|
||||
else {
|
||||
Out << "((";
|
||||
@ -2256,12 +2256,12 @@ void CWriter::visitCastInst(CastInst &I) {
|
||||
<< getFloatBitCastField(I.getType());
|
||||
} else {
|
||||
printCast(I.getOpcode(), SrcTy, DstTy);
|
||||
if (I.getOpcode() == Instruction::SExt && SrcTy == Type::BoolTy) {
|
||||
if (I.getOpcode() == Instruction::SExt && SrcTy == Type::Int1Ty) {
|
||||
// Make sure we really get a sext from bool by subtracing the bool from 0
|
||||
Out << "0-";
|
||||
}
|
||||
writeOperand(I.getOperand(0));
|
||||
if (DstTy == Type::BoolTy &&
|
||||
if (DstTy == Type::Int1Ty &&
|
||||
(I.getOpcode() == Instruction::Trunc ||
|
||||
I.getOpcode() == Instruction::FPToUI ||
|
||||
I.getOpcode() == Instruction::FPToSI ||
|
||||
|
@ -241,7 +241,7 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
|
||||
uint64_t &Size, unsigned char &Alignment) {
|
||||
assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID: Size = 1; Alignment = TD->getBoolAlignment(); return;
|
||||
case Type::Int1TyID: Size = 1; Alignment = TD->getBoolAlignment(); return;
|
||||
case Type::VoidTyID:
|
||||
case Type::Int8TyID: Size = 1; Alignment = TD->getByteAlignment(); return;
|
||||
case Type::Int16TyID: Size = 2; Alignment = TD->getShortAlignment(); return;
|
||||
|
@ -710,7 +710,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
|
||||
// If there is a comparison against null, we will insert a global bool to
|
||||
// keep track of whether the global was initialized yet or not.
|
||||
GlobalVariable *InitBool =
|
||||
new GlobalVariable(Type::BoolTy, false, GlobalValue::InternalLinkage,
|
||||
new GlobalVariable(Type::Int1Ty, false, GlobalValue::InternalLinkage,
|
||||
ConstantInt::getFalse(), GV->getName()+".init");
|
||||
bool InitBoolUsed = false;
|
||||
|
||||
@ -1139,13 +1139,13 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
|
||||
/// values ever stored into GV are its initializer and OtherVal.
|
||||
static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
|
||||
// Create the new global, initializing it to false.
|
||||
GlobalVariable *NewGV = new GlobalVariable(Type::BoolTy, false,
|
||||
GlobalVariable *NewGV = new GlobalVariable(Type::Int1Ty, false,
|
||||
GlobalValue::InternalLinkage, ConstantInt::getFalse(),
|
||||
GV->getName()+".b");
|
||||
GV->getParent()->getGlobalList().insert(GV, NewGV);
|
||||
|
||||
Constant *InitVal = GV->getInitializer();
|
||||
assert(InitVal->getType() != Type::BoolTy && "No reason to shrink to bool!");
|
||||
assert(InitVal->getType() != Type::Int1Ty && "No reason to shrink to bool!");
|
||||
|
||||
// If initialized to zero and storing one into the global, we can use a cast
|
||||
// instead of a select to synthesize the desired value.
|
||||
@ -1341,7 +1341,7 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
|
||||
// Otherwise, if the global was not a boolean, we can shrink it to be a
|
||||
// boolean.
|
||||
if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue))
|
||||
if (GV->getType()->getElementType() != Type::BoolTy &&
|
||||
if (GV->getType()->getElementType() != Type::Int1Ty &&
|
||||
!GV->getType()->getElementType()->isFloatingPoint() &&
|
||||
!GS.HasPHIUser) {
|
||||
DOUT << " *** SHRINKING TO BOOL: " << *GV;
|
||||
@ -1801,7 +1801,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
|
||||
dyn_cast<ConstantInt>(getVal(Values, BI->getCondition()));
|
||||
|
||||
// Cannot determine.
|
||||
if (!Cond || Cond->getType() != Type::BoolTy)
|
||||
if (!Cond || Cond->getType() != Type::Int1Ty)
|
||||
return false;
|
||||
NewBB = BI->getSuccessor(!Cond->getBoolValue());
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ bool LowerSetJmp::doInitialization(Module& M)
|
||||
|
||||
// bool __llvm_sjljeh_is_longjmp_exception()
|
||||
IsLJException = M.getOrInsertFunction("__llvm_sjljeh_is_longjmp_exception",
|
||||
Type::BoolTy, (Type *)0);
|
||||
Type::Int1Ty, (Type *)0);
|
||||
|
||||
// int __llvm_sjljeh_get_longjmp_value()
|
||||
GetLJValue = M.getOrInsertFunction("__llvm_sjljeh_get_longjmp_value",
|
||||
|
@ -940,7 +940,7 @@ static bool IsOnlyUsedInEqualsZeroComparison(Instruction *I) {
|
||||
cast<Constant>(IC->getOperand(1))->isNullValue())
|
||||
continue;
|
||||
} else if (CastInst *CI = dyn_cast<CastInst>(User))
|
||||
if (CI->getType() == Type::BoolTy)
|
||||
if (CI->getType() == Type::Int1Ty)
|
||||
continue;
|
||||
// Unknown instruction.
|
||||
return false;
|
||||
|
@ -134,7 +134,7 @@ void CondProp::SimplifyPredecessors(BranchInst *BI) {
|
||||
// possible, and to avoid invalidating "i".
|
||||
for (unsigned i = PN->getNumIncomingValues(); i != 0; --i)
|
||||
if (ConstantInt *CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i-1))) {
|
||||
if (CB->getType() != Type::BoolTy) continue;
|
||||
if (CB->getType() != Type::Int1Ty) continue;
|
||||
// If we have a constant, forward the edge from its current to its
|
||||
// ultimate destination.
|
||||
bool PHIGone = PN->getNumIncomingValues() == 2;
|
||||
|
@ -833,7 +833,7 @@ void CEE::PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI) {
|
||||
// it's a constant, then see if the other one is one of a setcc instruction,
|
||||
// an AND, OR, or XOR instruction.
|
||||
//
|
||||
if (Op1->getType() == Type::BoolTy)
|
||||
if (Op1->getType() == Type::Int1Ty)
|
||||
if (ConstantInt *CB = dyn_cast<ConstantInt>(Op1)) {
|
||||
|
||||
if (Instruction *Inst = dyn_cast<Instruction>(Op0)) {
|
||||
|
@ -1626,7 +1626,7 @@ static Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI,
|
||||
|
||||
if (isa<Constant>(TV) || isa<Constant>(FV)) {
|
||||
// Bool selects with constant operands can be folded to logical ops.
|
||||
if (SI->getType() == Type::BoolTy) return 0;
|
||||
if (SI->getType() == Type::Int1Ty) return 0;
|
||||
|
||||
Value *SelectTrueVal = FoldOperationIntoSelectOperand(Op, TV, IC);
|
||||
Value *SelectFalseVal = FoldOperationIntoSelectOperand(Op, FV, IC);
|
||||
@ -2203,11 +2203,11 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
|
||||
// formed.
|
||||
CastInst *BoolCast = 0;
|
||||
if (ZExtInst *CI = dyn_cast<ZExtInst>(I.getOperand(0)))
|
||||
if (CI->getOperand(0)->getType() == Type::BoolTy)
|
||||
if (CI->getOperand(0)->getType() == Type::Int1Ty)
|
||||
BoolCast = CI;
|
||||
if (!BoolCast)
|
||||
if (ZExtInst *CI = dyn_cast<ZExtInst>(I.getOperand(1)))
|
||||
if (CI->getOperand(0)->getType() == Type::BoolTy)
|
||||
if (CI->getOperand(0)->getType() == Type::Int1Ty)
|
||||
BoolCast = CI;
|
||||
if (BoolCast) {
|
||||
if (ICmpInst *SCI = dyn_cast<ICmpInst>(BoolCast->getOperand(0))) {
|
||||
@ -4284,7 +4284,7 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
||||
return ReplaceInstUsesWith(I, ConstantInt::get(isTrueWhenEqual(I)));
|
||||
|
||||
if (isa<UndefValue>(Op1)) // fcmp pred X, undef -> undef
|
||||
return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy));
|
||||
return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty));
|
||||
|
||||
// Handle fcmp with constant RHS
|
||||
if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
|
||||
@ -4336,7 +4336,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
return ReplaceInstUsesWith(I, ConstantInt::get(isTrueWhenEqual(I)));
|
||||
|
||||
if (isa<UndefValue>(Op1)) // X icmp undef -> undef
|
||||
return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy));
|
||||
return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty));
|
||||
|
||||
// icmp of GlobalValues can never equal each other as long as they aren't
|
||||
// external weak linkage type.
|
||||
@ -4354,7 +4354,7 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
|
||||
return ReplaceInstUsesWith(I, ConstantInt::get(!isTrueWhenEqual(I)));
|
||||
|
||||
// icmp's with boolean values can always be turned into bitwise operations
|
||||
if (Ty == Type::BoolTy) {
|
||||
if (Ty == Type::Int1Ty) {
|
||||
switch (I.getPredicate()) {
|
||||
default: assert(0 && "Invalid icmp instruction!");
|
||||
case ICmpInst::ICMP_EQ: { // icmp eq bool %A, %B -> ~(A^B)
|
||||
@ -5282,7 +5282,7 @@ Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) {
|
||||
//
|
||||
// However, it is OK if SrcTy is bool (See cast-set.ll testcase)
|
||||
// OR operation is EQ/NE.
|
||||
if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || ICI.isEquality())
|
||||
if (isSignedExt == isSignedCmp || SrcTy == Type::Int1Ty || ICI.isEquality())
|
||||
return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1);
|
||||
else
|
||||
return 0;
|
||||
@ -6250,7 +6250,7 @@ Instruction *InstCombiner::visitTrunc(CastInst &CI) {
|
||||
// Turn 'trunc (lshr X, Y) to bool' into '(X & (1 << Y)) != 0'. This is
|
||||
// more LLVM instructions, but allows '1 << Y' to be hoisted if
|
||||
// loop-invariant and CSE'd.
|
||||
if (CI.getType() == Type::BoolTy && SrcI->hasOneUse()) {
|
||||
if (CI.getType() == Type::Int1Ty && SrcI->hasOneUse()) {
|
||||
Value *One = ConstantInt::get(SrcI->getType(), 1);
|
||||
|
||||
Value *V = InsertNewInstBefore(new ShiftInst(Instruction::Shl, One,
|
||||
@ -6570,10 +6570,10 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
return ReplaceInstUsesWith(SI, FalseVal);
|
||||
}
|
||||
|
||||
if (SI.getType() == Type::BoolTy) {
|
||||
if (SI.getType() == Type::Int1Ty) {
|
||||
ConstantInt *C;
|
||||
if ((C = dyn_cast<ConstantInt>(TrueVal)) &&
|
||||
C->getType() == Type::BoolTy) {
|
||||
C->getType() == Type::Int1Ty) {
|
||||
if (C->getBoolValue()) {
|
||||
// Change: A = select B, true, C --> A = or B, C
|
||||
return BinaryOperator::createOr(CondVal, FalseVal);
|
||||
@ -6585,7 +6585,7 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
|
||||
return BinaryOperator::createAnd(NotCond, FalseVal);
|
||||
}
|
||||
} else if ((C = dyn_cast<ConstantInt>(FalseVal)) &&
|
||||
C->getType() == Type::BoolTy) {
|
||||
C->getType() == Type::Int1Ty) {
|
||||
if (C->getBoolValue() == false) {
|
||||
// Change: A = select B, C, false --> A = and B, C
|
||||
return BinaryOperator::createAnd(CondVal, TrueVal);
|
||||
@ -7132,7 +7132,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
||||
// If the call and callee calling conventions don't match, this call must
|
||||
// be unreachable, as the call is undefined.
|
||||
new StoreInst(ConstantInt::getTrue(),
|
||||
UndefValue::get(PointerType::get(Type::BoolTy)), OldCall);
|
||||
UndefValue::get(PointerType::get(Type::Int1Ty)), OldCall);
|
||||
if (!OldCall->use_empty())
|
||||
OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType()));
|
||||
if (isa<CallInst>(OldCall)) // Not worth removing an invoke here.
|
||||
@ -7145,7 +7145,7 @@ Instruction *InstCombiner::visitCallSite(CallSite CS) {
|
||||
// undef so that we know that this code is not reachable, despite the fact
|
||||
// that we can't modify the CFG here.
|
||||
new StoreInst(ConstantInt::getTrue(),
|
||||
UndefValue::get(PointerType::get(Type::BoolTy)),
|
||||
UndefValue::get(PointerType::get(Type::Int1Ty)),
|
||||
CS.getInstruction());
|
||||
|
||||
if (!CS.getInstruction()->use_empty())
|
||||
@ -7937,7 +7937,7 @@ Instruction *InstCombiner::visitFreeInst(FreeInst &FI) {
|
||||
if (isa<UndefValue>(Op)) {
|
||||
// Insert a new store to null because we cannot modify the CFG here.
|
||||
new StoreInst(ConstantInt::getTrue(),
|
||||
UndefValue::get(PointerType::get(Type::BoolTy)), &FI);
|
||||
UndefValue::get(PointerType::get(Type::Int1Ty)), &FI);
|
||||
return EraseInstFromFunction(FI);
|
||||
}
|
||||
|
||||
@ -9048,7 +9048,7 @@ static void AddReachableCodeToWorklist(BasicBlock *BB,
|
||||
TerminatorInst *TI = BB->getTerminator();
|
||||
if (BranchInst *BI = dyn_cast<BranchInst>(TI)) {
|
||||
if (BI->isConditional() && isa<ConstantInt>(BI->getCondition()) &&
|
||||
BI->getCondition()->getType() == Type::BoolTy) {
|
||||
BI->getCondition()->getType() == Type::Int1Ty) {
|
||||
bool CondVal = cast<ConstantInt>(BI->getCondition())->getBoolValue();
|
||||
AddReachableCodeToWorklist(BI->getSuccessor(!CondVal), Visited, WorkList,
|
||||
TD);
|
||||
|
@ -486,7 +486,7 @@ static void EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val,
|
||||
// Insert a conditional branch on LIC to the two preheaders. The original
|
||||
// code is the true version and the new code is the false version.
|
||||
Value *BranchVal = LIC;
|
||||
if (Val->getType() != Type::BoolTy)
|
||||
if (Val->getType() != Type::Int1Ty)
|
||||
BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt);
|
||||
else if (Val != ConstantInt::getTrue())
|
||||
// We want to enter the new loop when the condition is true.
|
||||
@ -919,7 +919,7 @@ void LoopUnswitch::RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,
|
||||
|
||||
// If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC
|
||||
// in the loop with the appropriate one directly.
|
||||
if (IsEqual || (isa<ConstantInt>(Val) && Val->getType() == Type::BoolTy)) {
|
||||
if (IsEqual || (isa<ConstantInt>(Val) && Val->getType() == Type::Int1Ty)) {
|
||||
Value *Replacement;
|
||||
if (IsEqual)
|
||||
Replacement = Val;
|
||||
@ -1032,10 +1032,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) {
|
||||
break;
|
||||
case Instruction::And:
|
||||
if (isa<ConstantInt>(I->getOperand(0)) &&
|
||||
I->getOperand(0)->getType() == Type::BoolTy) // constant -> RHS
|
||||
I->getOperand(0)->getType() == Type::Int1Ty) // constant -> RHS
|
||||
cast<BinaryOperator>(I)->swapOperands();
|
||||
if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
|
||||
if (CB->getType() == Type::BoolTy) {
|
||||
if (CB->getType() == Type::Int1Ty) {
|
||||
if (CB->getBoolValue()) // X & 1 -> X
|
||||
ReplaceUsesOfWith(I, I->getOperand(0), Worklist);
|
||||
else // X & 0 -> 0
|
||||
@ -1045,10 +1045,10 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) {
|
||||
break;
|
||||
case Instruction::Or:
|
||||
if (isa<ConstantInt>(I->getOperand(0)) &&
|
||||
I->getOperand(0)->getType() == Type::BoolTy) // constant -> RHS
|
||||
I->getOperand(0)->getType() == Type::Int1Ty) // constant -> RHS
|
||||
cast<BinaryOperator>(I)->swapOperands();
|
||||
if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
|
||||
if (CB->getType() == Type::BoolTy) {
|
||||
if (CB->getType() == Type::Int1Ty) {
|
||||
if (CB->getBoolValue()) // X | 1 -> 1
|
||||
ReplaceUsesOfWith(I, I->getOperand(1), Worklist);
|
||||
else // X | 0 -> X
|
||||
|
@ -1129,9 +1129,9 @@ namespace {
|
||||
|
||||
ConstantInt *CB, *A;
|
||||
if ((CB = dyn_cast<ConstantInt>(Canonical)) &&
|
||||
CB->getType() == Type::BoolTy) {
|
||||
CB->getType() == Type::Int1Ty) {
|
||||
if ((A = dyn_cast<ConstantInt>(LHS)) &&
|
||||
A->getType() == Type::BoolTy)
|
||||
A->getType() == Type::Int1Ty)
|
||||
add(RHS, ConstantInt::get(A->getBoolValue() ^
|
||||
CB->getBoolValue()),
|
||||
ICmpInst::ICMP_EQ, NewContext);
|
||||
@ -1249,7 +1249,7 @@ namespace {
|
||||
if (isa<ConstantInt>(Unknown))
|
||||
One = ConstantInt::get(Ty, 1);
|
||||
else if (isa<ConstantInt>(Unknown) &&
|
||||
Unknown->getType() == Type::BoolTy)
|
||||
Unknown->getType() == Type::Int1Ty)
|
||||
One = ConstantInt::getTrue();
|
||||
|
||||
if (One) add(Unknown, One, ICmpInst::ICMP_EQ, NewContext);
|
||||
|
@ -417,7 +417,7 @@ void SCCPSolver::getFeasibleSuccessors(TerminatorInst &TI,
|
||||
LatticeVal &BCValue = getValueState(BI->getCondition());
|
||||
if (BCValue.isOverdefined() ||
|
||||
(BCValue.isConstant() &&
|
||||
BCValue.getConstant()->getType() != Type::BoolTy)) {
|
||||
BCValue.getConstant()->getType() != Type::Int1Ty)) {
|
||||
// Overdefined condition variables, and branches on unfoldable constant
|
||||
// conditions, mean the branch could go either way.
|
||||
Succs[0] = Succs[1] = true;
|
||||
@ -477,7 +477,7 @@ bool SCCPSolver::isEdgeFeasible(BasicBlock *From, BasicBlock *To) {
|
||||
return true;
|
||||
} else if (BCValue.isConstant()) {
|
||||
// Not branching on an evaluatable constant?
|
||||
if (BCValue.getConstant()->getType() != Type::BoolTy) return true;
|
||||
if (BCValue.getConstant()->getType() != Type::Int1Ty) return true;
|
||||
|
||||
// Constant condition variables mean the branch can only go a single way
|
||||
return BI->getSuccessor(BCValue.getConstant() ==
|
||||
@ -648,7 +648,7 @@ void SCCPSolver::visitSelectInst(SelectInst &I) {
|
||||
if (CondValue.isUndefined())
|
||||
return;
|
||||
if (CondValue.isConstant() &&
|
||||
CondValue.getConstant()->getType() == Type::BoolTy) {
|
||||
CondValue.getConstant()->getType() == Type::Int1Ty) {
|
||||
if (ConstantInt *CondCB = dyn_cast<ConstantInt>(CondValue.getConstant())){
|
||||
mergeInValue(&I, getValueState(CondCB->getBoolValue() ? I.getTrueValue()
|
||||
: I.getFalseValue()));
|
||||
|
@ -251,7 +251,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs,
|
||||
switch (NumExitBlocks) {
|
||||
case 0:
|
||||
case 1: RetTy = Type::VoidTy; break;
|
||||
case 2: RetTy = Type::BoolTy; break;
|
||||
case 2: RetTy = Type::Int1Ty; break;
|
||||
default: RetTy = Type::Int16Ty; break;
|
||||
}
|
||||
|
||||
|
@ -971,7 +971,7 @@ static bool FoldCondBranchOnPHI(BranchInst *BI) {
|
||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
|
||||
ConstantInt *CB;
|
||||
if ((CB = dyn_cast<ConstantInt>(PN->getIncomingValue(i))) &&
|
||||
CB->getType() == Type::BoolTy) {
|
||||
CB->getType() == Type::Int1Ty) {
|
||||
// Okay, we now know that all edges from PredBB should be revectored to
|
||||
// branch to RealDest.
|
||||
BasicBlock *PredBB = PN->getIncomingBlock(i);
|
||||
@ -1516,7 +1516,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
|
||||
// Otherwise, if there are multiple predecessors, insert a PHI that
|
||||
// merges in the constant and simplify the block result.
|
||||
if (BlockIsSimpleEnoughToThreadThrough(BB)) {
|
||||
PHINode *NewPN = new PHINode(Type::BoolTy,
|
||||
PHINode *NewPN = new PHINode(Type::Int1Ty,
|
||||
BI->getCondition()->getName()+".pr",
|
||||
BB->begin());
|
||||
for (PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
|
||||
|
@ -439,7 +439,7 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
|
||||
const int IndentSize = 4;
|
||||
static std::string Indent = "\n";
|
||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
|
||||
if (CI->getType() == Type::BoolTy)
|
||||
if (CI->getType() == Type::Int1Ty)
|
||||
Out << (CI->getBoolValue() ? "true" : "false");
|
||||
else Out << CI->getSExtValue();
|
||||
} else if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV)) {
|
||||
|
@ -317,7 +317,7 @@ Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond,
|
||||
const Constant *V1,
|
||||
const Constant *V2) {
|
||||
if (const ConstantInt *CB = dyn_cast<ConstantInt>(Cond))
|
||||
if (CB->getType() == Type::BoolTy)
|
||||
if (CB->getType() == Type::Int1Ty)
|
||||
return const_cast<Constant*>(CB->getBoolValue() ? V1 : V2);
|
||||
|
||||
if (isa<UndefValue>(V1)) return const_cast<Constant*>(V2);
|
||||
@ -555,7 +555,7 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
|
||||
// so look at directly computing the value.
|
||||
if (const ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) {
|
||||
if (const ConstantInt *CI2 = dyn_cast<ConstantInt>(C2)) {
|
||||
if (CI1->getType() == Type::BoolTy && CI2->getType() == Type::BoolTy) {
|
||||
if (CI1->getType() == Type::Int1Ty && CI2->getType() == Type::Int1Ty) {
|
||||
switch (Opcode) {
|
||||
default:
|
||||
break;
|
||||
@ -1037,7 +1037,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
|
||||
// Handle some degenerate cases first
|
||||
if (isa<UndefValue>(C1) || isa<UndefValue>(C2))
|
||||
return UndefValue::get(Type::BoolTy);
|
||||
return UndefValue::get(Type::Int1Ty);
|
||||
|
||||
// icmp eq/ne(null,GV) -> false/true
|
||||
if (C1->isNullValue()) {
|
||||
@ -1058,7 +1058,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
|
||||
}
|
||||
|
||||
if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2) &&
|
||||
C1->getType() == Type::BoolTy && C2->getType() == Type::BoolTy) {
|
||||
C1->getType() == Type::Int1Ty && C2->getType() == Type::Int1Ty) {
|
||||
bool C1Val = cast<ConstantInt>(C1)->getBoolValue();
|
||||
bool C2Val = cast<ConstantInt>(C2)->getBoolValue();
|
||||
switch (pred) {
|
||||
|
@ -92,7 +92,7 @@ bool Constant::canTrap() const {
|
||||
// Static constructor to create a '0' constant of arbitrary type...
|
||||
Constant *Constant::getNullValue(const Type *Ty) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID: {
|
||||
case Type::Int1TyID: {
|
||||
static Constant *NullBool = ConstantInt::get(false);
|
||||
return NullBool;
|
||||
}
|
||||
@ -137,7 +137,7 @@ Constant *Constant::getNullValue(const Type *Ty) {
|
||||
// Static constructor to create an integral constant with all bits set
|
||||
ConstantInt *ConstantInt::getAllOnesValue(const Type *Ty) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::BoolTyID: return ConstantInt::getTrue();
|
||||
case Type::Int1TyID: return ConstantInt::getTrue();
|
||||
case Type::Int8TyID:
|
||||
case Type::Int16TyID:
|
||||
case Type::Int32TyID:
|
||||
@ -166,11 +166,11 @@ ConstantPacked *ConstantPacked::getAllOnesValue(const PackedType *Ty) {
|
||||
// Normal Constructors
|
||||
|
||||
ConstantInt::ConstantInt(bool V)
|
||||
: Constant(Type::BoolTy, ConstantIntVal, 0, 0), Val(uint64_t(V)) {
|
||||
: Constant(Type::Int1Ty, ConstantIntVal, 0, 0), Val(uint64_t(V)) {
|
||||
}
|
||||
|
||||
ConstantInt::ConstantInt(const Type *Ty, uint64_t V)
|
||||
: Constant(Ty, ConstantIntVal, 0, 0), Val(Ty == Type::BoolTy ? bool(V) : V) {
|
||||
: Constant(Ty, ConstantIntVal, 0, 0), Val(Ty == Type::Int1Ty ? bool(V) : V) {
|
||||
}
|
||||
|
||||
ConstantFP::ConstantFP(const Type *Ty, double V)
|
||||
@ -349,7 +349,7 @@ struct VISIBILITY_HIDDEN CompareConstantExpr : public ConstantExpr {
|
||||
Use Ops[2];
|
||||
CompareConstantExpr(Instruction::OtherOps opc, unsigned short pred,
|
||||
Constant* LHS, Constant* RHS)
|
||||
: ConstantExpr(Type::BoolTy, opc, Ops, 2), predicate(pred) {
|
||||
: ConstantExpr(Type::Int1Ty, opc, Ops, 2), predicate(pred) {
|
||||
OperandList[0].init(LHS, this);
|
||||
OperandList[1].init(RHS, this);
|
||||
}
|
||||
@ -551,7 +551,7 @@ getWithOperands(const std::vector<Constant*> &Ops) const {
|
||||
bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) {
|
||||
switch (Ty->getTypeID()) {
|
||||
default: return false; // These can't be represented as integers!
|
||||
case Type::BoolTyID: return Val == 0 || Val == 1;
|
||||
case Type::Int1TyID: return Val == 0 || Val == 1;
|
||||
case Type::Int8TyID: return Val <= UINT8_MAX;
|
||||
case Type::Int16TyID: return Val <= UINT16_MAX;
|
||||
case Type::Int32TyID: return Val <= UINT32_MAX;
|
||||
@ -562,7 +562,7 @@ bool ConstantInt::isValueValidForType(const Type *Ty, uint64_t Val) {
|
||||
bool ConstantInt::isValueValidForType(const Type *Ty, int64_t Val) {
|
||||
switch (Ty->getTypeID()) {
|
||||
default: return false; // These can't be represented as integers!
|
||||
case Type::BoolTyID: return (Val == 0 || Val == 1);
|
||||
case Type::Int1TyID: return (Val == 0 || Val == 1);
|
||||
case Type::Int8TyID: return (Val >= INT8_MIN && Val <= INT8_MAX);
|
||||
case Type::Int16TyID: return (Val >= INT16_MIN && Val <= UINT16_MAX);
|
||||
case Type::Int32TyID: return (Val >= INT32_MIN && Val <= UINT32_MAX);
|
||||
@ -838,7 +838,7 @@ static ManagedStatic<ValueMap<uint64_t, Type, ConstantInt> > IntConstants;
|
||||
// just return the stored value while getSExtValue has to convert back to sign
|
||||
// extended. getZExtValue is more common in LLVM than getSExtValue().
|
||||
ConstantInt *ConstantInt::get(const Type *Ty, int64_t V) {
|
||||
if (Ty == Type::BoolTy) return ConstantInt::get(V&1);
|
||||
if (Ty == Type::Int1Ty) return ConstantInt::get(V&1);
|
||||
return IntConstants->getOrCreate(Ty, V & Ty->getIntegralTypeMask());
|
||||
}
|
||||
|
||||
@ -1589,7 +1589,7 @@ Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode,
|
||||
assert(C1->getType() == C2->getType() &&
|
||||
"Operand types in binary constant expression should match");
|
||||
|
||||
if (ReqTy == C1->getType() || ReqTy == Type::BoolTy)
|
||||
if (ReqTy == C1->getType() || ReqTy == Type::Int1Ty)
|
||||
if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2))
|
||||
return FC; // Fold a few common cases...
|
||||
|
||||
@ -1684,7 +1684,7 @@ Constant *ConstantExpr::getCompare(unsigned short pred,
|
||||
|
||||
Constant *ConstantExpr::getSelectTy(const Type *ReqTy, Constant *C,
|
||||
Constant *V1, Constant *V2) {
|
||||
assert(C->getType() == Type::BoolTy && "Select condition must be bool!");
|
||||
assert(C->getType() == Type::Int1Ty && "Select condition must be bool!");
|
||||
assert(V1->getType() == V2->getType() && "Select value types must match!");
|
||||
assert(V1->getType()->isFirstClassType() && "Cannot select aggregate type!");
|
||||
|
||||
@ -1774,7 +1774,7 @@ ConstantExpr::getICmp(unsigned short pred, Constant* LHS, Constant* RHS) {
|
||||
ArgVec.push_back(RHS);
|
||||
// Get the key type with both the opcode and predicate
|
||||
const ExprMapKeyType Key(Instruction::ICmp, ArgVec, pred);
|
||||
return ExprConstants->getOrCreate(Type::BoolTy, Key);
|
||||
return ExprConstants->getOrCreate(Type::Int1Ty, Key);
|
||||
}
|
||||
|
||||
Constant *
|
||||
@ -1791,7 +1791,7 @@ ConstantExpr::getFCmp(unsigned short pred, Constant* LHS, Constant* RHS) {
|
||||
ArgVec.push_back(RHS);
|
||||
// Get the key type with both the opcode and predicate
|
||||
const ExprMapKeyType Key(Instruction::FCmp, ArgVec, pred);
|
||||
return ExprConstants->getOrCreate(Type::BoolTy, Key);
|
||||
return ExprConstants->getOrCreate(Type::Int1Ty, Key);
|
||||
}
|
||||
|
||||
Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
|
||||
|
@ -482,7 +482,7 @@ BasicBlock *UnreachableInst::getSuccessorV(unsigned idx) const {
|
||||
|
||||
void BranchInst::AssertOK() {
|
||||
if (isConditional())
|
||||
assert(getCondition()->getType() == Type::BoolTy &&
|
||||
assert(getCondition()->getType() == Type::Int1Ty &&
|
||||
"May only branch on boolean predicates!");
|
||||
}
|
||||
|
||||
@ -1900,7 +1900,7 @@ BitCastInst::BitCastInst(
|
||||
|
||||
CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
|
||||
const std::string &Name, Instruction *InsertBefore)
|
||||
: Instruction(Type::BoolTy, op, Ops, 2, Name, InsertBefore) {
|
||||
: Instruction(Type::Int1Ty, op, Ops, 2, Name, InsertBefore) {
|
||||
Ops[0].init(LHS, this);
|
||||
Ops[1].init(RHS, this);
|
||||
SubclassData = predicate;
|
||||
@ -1934,7 +1934,7 @@ CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
|
||||
|
||||
CmpInst::CmpInst(OtherOps op, unsigned short predicate, Value *LHS, Value *RHS,
|
||||
const std::string &Name, BasicBlock *InsertAtEnd)
|
||||
: Instruction(Type::BoolTy, op, Ops, 2, Name, InsertAtEnd) {
|
||||
: Instruction(Type::Int1Ty, op, Ops, 2, Name, InsertAtEnd) {
|
||||
Ops[0].init(LHS, this);
|
||||
Ops[1].init(RHS, this);
|
||||
SubclassData = predicate;
|
||||
|
@ -73,7 +73,7 @@ Type::Type(const char *Name, TypeID id)
|
||||
const Type *Type::getPrimitiveType(TypeID IDNumber) {
|
||||
switch (IDNumber) {
|
||||
case VoidTyID : return VoidTy;
|
||||
case BoolTyID : return BoolTy;
|
||||
case Int1TyID : return Int1Ty;
|
||||
case Int8TyID : return Int8Ty;
|
||||
case Int16TyID : return Int16Ty;
|
||||
case Int32TyID : return Int32Ty;
|
||||
@ -127,7 +127,7 @@ bool Type::canLosslesslyBitCastTo(const Type *Ty) const {
|
||||
//
|
||||
unsigned Type::getPrimitiveSize() const {
|
||||
switch (getTypeID()) {
|
||||
case Type::BoolTyID:
|
||||
case Type::Int1TyID:
|
||||
case Type::Int8TyID: return 1;
|
||||
case Type::Int16TyID: return 2;
|
||||
case Type::FloatTyID:
|
||||
@ -140,7 +140,7 @@ unsigned Type::getPrimitiveSize() const {
|
||||
|
||||
unsigned Type::getPrimitiveSizeInBits() const {
|
||||
switch (getTypeID()) {
|
||||
case Type::BoolTyID: return 1;
|
||||
case Type::Int1TyID: return 1;
|
||||
case Type::Int8TyID: return 8;
|
||||
case Type::Int16TyID: return 16;
|
||||
case Type::FloatTyID:
|
||||
@ -368,7 +368,7 @@ const Type *StructType::getTypeAtIndex(const Value *V) const {
|
||||
Type *Type::TY##Ty = &*The##TY##Ty
|
||||
|
||||
DeclarePrimType(Void, "void");
|
||||
DeclarePrimType(Bool, "bool");
|
||||
DeclarePrimType(Int1, "bool");
|
||||
DeclarePrimType(Int8, "i8");
|
||||
DeclarePrimType(Int16, "i16");
|
||||
DeclarePrimType(Int32, "i32");
|
||||
|
@ -87,7 +87,7 @@ const Type *MVT::getTypeForValueType(MVT::ValueType VT) {
|
||||
switch (VT) {
|
||||
default: assert(0 && "ValueType does not correspond to LLVM type!");
|
||||
case MVT::isVoid:return Type::VoidTy;
|
||||
case MVT::i1: return Type::BoolTy;
|
||||
case MVT::i1: return Type::Int1Ty;
|
||||
case MVT::i8: return Type::Int8Ty;
|
||||
case MVT::i16: return Type::Int16Ty;
|
||||
case MVT::i32: return Type::Int32Ty;
|
||||
|
@ -474,7 +474,7 @@ void Verifier::visitSwitchInst(SwitchInst &SI) {
|
||||
}
|
||||
|
||||
void Verifier::visitSelectInst(SelectInst &SI) {
|
||||
Assert1(SI.getCondition()->getType() == Type::BoolTy,
|
||||
Assert1(SI.getCondition()->getType() == Type::Int1Ty,
|
||||
"Select condition type must be bool!", &SI);
|
||||
Assert1(SI.getTrueValue()->getType() == SI.getFalseValue()->getType(),
|
||||
"Select values must have identical types!", &SI);
|
||||
|
@ -166,7 +166,7 @@ getTypePrefix(const Type* Ty ) {
|
||||
const char* prefix;
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: prefix = "void_"; break;
|
||||
case Type::BoolTyID: prefix = "bool_"; break;
|
||||
case Type::Int1TyID: prefix = "bool_"; break;
|
||||
case Type::Int8TyID: prefix = "int8_"; break;
|
||||
case Type::Int16TyID: prefix = "int16_"; break;
|
||||
case Type::Int32TyID: prefix = "int32_"; break;
|
||||
@ -316,7 +316,7 @@ CppWriter::getCppName(const Type* Ty)
|
||||
if (Ty->isPrimitiveType()) {
|
||||
switch (Ty->getTypeID()) {
|
||||
case Type::VoidTyID: return "Type::VoidTy";
|
||||
case Type::BoolTyID: return "Type::BoolTy";
|
||||
case Type::Int1TyID: return "Type::Int1Ty";
|
||||
case Type::Int8TyID: return "Type::Int8Ty";
|
||||
case Type::Int16TyID: return "Type::Int16Ty";
|
||||
case Type::Int32TyID: return "Type::Int32Ty";
|
||||
@ -669,7 +669,7 @@ void CppWriter::printConstant(const Constant *CV) {
|
||||
return;
|
||||
}
|
||||
if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
|
||||
if (CI->getType() == Type::BoolTy)
|
||||
if (CI->getType() == Type::Int1Ty)
|
||||
Out << "ConstantInt* " << constName << " = ConstantInt::get("
|
||||
<< (CI->getBoolValue() ? "true" : "false") << ");";
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user