mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Use constantexprs for casts. Eliminate use of the ConstantHandling interfaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10779 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -22,11 +22,12 @@
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/ConstantHandling.h"
|
#include "llvm/Constants.h"
|
||||||
#include "llvm/Function.h"
|
#include "llvm/Function.h"
|
||||||
#include "llvm/GlobalVariable.h"
|
#include "llvm/GlobalVariable.h"
|
||||||
#include "llvm/Instructions.h"
|
#include "llvm/Instructions.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
|
#include "llvm/Type.h"
|
||||||
#include "llvm/Support/InstVisitor.h"
|
#include "llvm/Support/InstVisitor.h"
|
||||||
#include "Support/Debug.h"
|
#include "Support/Debug.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
@ -558,17 +559,10 @@ void SCCP::visitTerminatorInst(TerminatorInst &TI) {
|
|||||||
void SCCP::visitCastInst(CastInst &I) {
|
void SCCP::visitCastInst(CastInst &I) {
|
||||||
Value *V = I.getOperand(0);
|
Value *V = I.getOperand(0);
|
||||||
InstVal &VState = getValueState(V);
|
InstVal &VState = getValueState(V);
|
||||||
if (VState.isOverdefined()) { // Inherit overdefinedness of operand
|
if (VState.isOverdefined()) // Inherit overdefinedness of operand
|
||||||
markOverdefined(&I);
|
markOverdefined(&I);
|
||||||
} else if (VState.isConstant()) { // Propagate constant value
|
else if (VState.isConstant()) // Propagate constant value
|
||||||
Constant *Result =
|
markConstant(&I, ConstantExpr::getCast(VState.getConstant(), I.getType()));
|
||||||
ConstantFoldCastInstruction(VState.getConstant(), I.getType());
|
|
||||||
|
|
||||||
if (Result) // If this instruction constant folds!
|
|
||||||
markConstant(&I, Result);
|
|
||||||
else
|
|
||||||
markOverdefined(&I); // Don't know how to fold this instruction. :(
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle BinaryOperators and Shift Instructions...
|
// Handle BinaryOperators and Shift Instructions...
|
||||||
|
Reference in New Issue
Block a user