mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 12:02:58 +02:00
Simplify code
llvm-svn: 14424
This commit is contained in:
parent
322e7a8990
commit
850f1967b6
@ -243,26 +243,19 @@ static inline ExprType negate(const ExprType &E, Value *V) {
|
|||||||
//
|
//
|
||||||
ExprType llvm::ClassifyExpr(Value *Expr) {
|
ExprType llvm::ClassifyExpr(Value *Expr) {
|
||||||
assert(Expr != 0 && "Can't classify a null expression!");
|
assert(Expr != 0 && "Can't classify a null expression!");
|
||||||
if (Expr->getType() == Type::FloatTy || Expr->getType() == Type::DoubleTy)
|
if (Expr->getType()->isFloatingPoint())
|
||||||
return Expr; // FIXME: Can't handle FP expressions
|
return Expr; // FIXME: Can't handle FP expressions
|
||||||
|
|
||||||
switch (Expr->getValueType()) {
|
if (Constant *C = dyn_cast<Constant>(Expr)) {
|
||||||
case Value::InstructionVal: break; // Instruction... hmmm... investigate.
|
|
||||||
case Value::TypeVal: case Value::BasicBlockVal:
|
|
||||||
case Value::FunctionVal: default:
|
|
||||||
//assert(0 && "Unexpected expression type to classify!");
|
|
||||||
std::cerr << "Bizarre thing to expr classify: " << Expr << "\n";
|
|
||||||
return Expr;
|
|
||||||
case Value::GlobalVariableVal: // Global Variable & Function argument:
|
|
||||||
case Value::ArgumentVal: // nothing known, return variable itself
|
|
||||||
return Expr;
|
|
||||||
case Value::ConstantVal: // Constant value, just return constant
|
|
||||||
if (ConstantInt *CPI = dyn_cast<ConstantInt>(cast<Constant>(Expr)))
|
if (ConstantInt *CPI = dyn_cast<ConstantInt>(cast<Constant>(Expr)))
|
||||||
// It's an integral constant!
|
// It's an integral constant!
|
||||||
return ExprType(CPI->isNullValue() ? 0 : CPI);
|
return ExprType(CPI->isNullValue() ? 0 : CPI);
|
||||||
return Expr;
|
return Expr;
|
||||||
|
} else if (!isa<Instruction>(Expr)) {
|
||||||
|
return Expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Instruction *I = cast<Instruction>(Expr);
|
Instruction *I = cast<Instruction>(Expr);
|
||||||
const Type *Ty = I->getType();
|
const Type *Ty = I->getType();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user