mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
constify the cost API
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169172 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -40,7 +40,7 @@ namespace {
|
|||||||
/// Returns -1 if the cost is unknown.
|
/// Returns -1 if the cost is unknown.
|
||||||
/// Note, this method does not cache the cost calculation and it
|
/// Note, this method does not cache the cost calculation and it
|
||||||
/// can be expensive in some cases.
|
/// can be expensive in some cases.
|
||||||
unsigned getInstructionCost(Instruction *I) const;
|
unsigned getInstructionCost(const Instruction *I) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
|
||||||
@@ -82,7 +82,7 @@ CostModelAnalysis::runOnFunction(Function &F) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned CostModelAnalysis::getInstructionCost(Instruction *I) const {
|
unsigned CostModelAnalysis::getInstructionCost(const Instruction *I) const {
|
||||||
if (!VTTI)
|
if (!VTTI)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ unsigned CostModelAnalysis::getInstructionCost(Instruction *I) const {
|
|||||||
return VTTI->getArithmeticInstrCost(I->getOpcode(), I->getType());
|
return VTTI->getArithmeticInstrCost(I->getOpcode(), I->getType());
|
||||||
}
|
}
|
||||||
case Instruction::Select: {
|
case Instruction::Select: {
|
||||||
SelectInst *SI = cast<SelectInst>(I);
|
const SelectInst *SI = cast<SelectInst>(I);
|
||||||
Type *CondTy = SI->getCondition()->getType();
|
Type *CondTy = SI->getCondition()->getType();
|
||||||
return VTTI->getCmpSelInstrCost(I->getOpcode(), I->getType(), CondTy);
|
return VTTI->getCmpSelInstrCost(I->getOpcode(), I->getType(), CondTy);
|
||||||
}
|
}
|
||||||
@@ -123,14 +123,14 @@ unsigned CostModelAnalysis::getInstructionCost(Instruction *I) const {
|
|||||||
return VTTI->getCmpSelInstrCost(I->getOpcode(), ValTy);
|
return VTTI->getCmpSelInstrCost(I->getOpcode(), ValTy);
|
||||||
}
|
}
|
||||||
case Instruction::Store: {
|
case Instruction::Store: {
|
||||||
StoreInst *SI = cast<StoreInst>(I);
|
const StoreInst *SI = cast<StoreInst>(I);
|
||||||
Type *ValTy = SI->getValueOperand()->getType();
|
Type *ValTy = SI->getValueOperand()->getType();
|
||||||
return VTTI->getMemoryOpCost(I->getOpcode(), ValTy,
|
return VTTI->getMemoryOpCost(I->getOpcode(), ValTy,
|
||||||
SI->getAlignment(),
|
SI->getAlignment(),
|
||||||
SI->getPointerAddressSpace());
|
SI->getPointerAddressSpace());
|
||||||
}
|
}
|
||||||
case Instruction::Load: {
|
case Instruction::Load: {
|
||||||
LoadInst *LI = cast<LoadInst>(I);
|
const LoadInst *LI = cast<LoadInst>(I);
|
||||||
return VTTI->getMemoryOpCost(I->getOpcode(), I->getType(),
|
return VTTI->getMemoryOpCost(I->getOpcode(), I->getType(),
|
||||||
LI->getAlignment(),
|
LI->getAlignment(),
|
||||||
LI->getPointerAddressSpace());
|
LI->getPointerAddressSpace());
|
||||||
@@ -151,7 +151,7 @@ unsigned CostModelAnalysis::getInstructionCost(Instruction *I) const {
|
|||||||
return VTTI->getCastInstrCost(I->getOpcode(), I->getType(), SrcTy);
|
return VTTI->getCastInstrCost(I->getOpcode(), I->getType(), SrcTy);
|
||||||
}
|
}
|
||||||
case Instruction::ExtractElement: {
|
case Instruction::ExtractElement: {
|
||||||
ExtractElementInst * EEI = cast<ExtractElementInst>(I);
|
const ExtractElementInst * EEI = cast<ExtractElementInst>(I);
|
||||||
ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1));
|
ConstantInt *CI = dyn_cast<ConstantInt>(I->getOperand(1));
|
||||||
unsigned Idx = -1;
|
unsigned Idx = -1;
|
||||||
if (CI)
|
if (CI)
|
||||||
@@ -160,7 +160,7 @@ unsigned CostModelAnalysis::getInstructionCost(Instruction *I) const {
|
|||||||
EEI->getOperand(0)->getType(), Idx);
|
EEI->getOperand(0)->getType(), Idx);
|
||||||
}
|
}
|
||||||
case Instruction::InsertElement: {
|
case Instruction::InsertElement: {
|
||||||
InsertElementInst * IE = cast<InsertElementInst>(I);
|
const InsertElementInst * IE = cast<InsertElementInst>(I);
|
||||||
ConstantInt *CI = dyn_cast<ConstantInt>(IE->getOperand(2));
|
ConstantInt *CI = dyn_cast<ConstantInt>(IE->getOperand(2));
|
||||||
unsigned Idx = -1;
|
unsigned Idx = -1;
|
||||||
if (CI)
|
if (CI)
|
||||||
|
Reference in New Issue
Block a user