mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 07:24:25 +00:00
Change constant folding APIs to take an optional TargetData, and change
ConstantFoldInstOperands/ConstantFoldCall to take a pointer to an array of operands + size, instead of an std::vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33669 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -20,17 +20,11 @@ namespace llvm {
|
|||||||
|
|
||||||
/// canConstantFoldCallTo - Return true if its even possible to fold a call to
|
/// canConstantFoldCallTo - Return true if its even possible to fold a call to
|
||||||
/// the specified function.
|
/// the specified function.
|
||||||
extern
|
|
||||||
bool canConstantFoldCallTo(Function *F);
|
bool canConstantFoldCallTo(Function *F);
|
||||||
|
|
||||||
/// ConstantFoldFP - Given a function that evaluates the constant, return an
|
|
||||||
/// LLVM Constant that represents the evaluated constant
|
|
||||||
extern Constant *
|
|
||||||
ConstantFoldFP(double (*NativeFP)(double), double V, const Type *Ty);
|
|
||||||
|
|
||||||
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
|
/// ConstantFoldCall - Attempt to constant fold a call to the specified function
|
||||||
/// with the specified arguments, returning null if unsuccessful.
|
/// with the specified arguments, returning null if unsuccessful.
|
||||||
extern Constant *
|
Constant *
|
||||||
ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands);
|
ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ class Pass;
|
|||||||
class PHINode;
|
class PHINode;
|
||||||
class AllocaInst;
|
class AllocaInst;
|
||||||
class ConstantExpr;
|
class ConstantExpr;
|
||||||
|
class TargetData;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Local constant propagation...
|
// Local constant propagation...
|
||||||
@ -32,7 +33,7 @@ class ConstantExpr;
|
|||||||
/// doConstantPropagation - Constant prop a specific instruction. Returns true
|
/// doConstantPropagation - Constant prop a specific instruction. Returns true
|
||||||
/// and potentially moves the iterator if constant propagation was performed.
|
/// and potentially moves the iterator if constant propagation was performed.
|
||||||
///
|
///
|
||||||
bool doConstantPropagation(BasicBlock::iterator &I);
|
bool doConstantPropagation(BasicBlock::iterator &I, const TargetData *TD = 0);
|
||||||
|
|
||||||
/// ConstantFoldTerminator - If a terminator instruction is predicated on a
|
/// ConstantFoldTerminator - If a terminator instruction is predicated on a
|
||||||
/// constant value, convert it into an unconditional branch to the constant
|
/// constant value, convert it into an unconditional branch to the constant
|
||||||
@ -46,7 +47,7 @@ bool ConstantFoldTerminator(BasicBlock *BB);
|
|||||||
/// is returned. Note that this function can only fail when attempting to fold
|
/// is returned. Note that this function can only fail when attempting to fold
|
||||||
/// instructions like loads and stores, which have no constant expression form.
|
/// instructions like loads and stores, which have no constant expression form.
|
||||||
///
|
///
|
||||||
Constant *ConstantFoldInstruction(Instruction *I);
|
Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
|
||||||
|
|
||||||
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
|
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
|
||||||
/// specified operands. If successful, the constant result is returned, if not,
|
/// specified operands. If successful, the constant result is returned, if not,
|
||||||
@ -56,7 +57,9 @@ Constant *ConstantFoldInstruction(Instruction *I);
|
|||||||
///
|
///
|
||||||
Constant *ConstantFoldInstOperands(
|
Constant *ConstantFoldInstOperands(
|
||||||
const Instruction *I, ///< The model instruction
|
const Instruction *I, ///< The model instruction
|
||||||
const std::vector<Constant*> &Ops ///< The constant operands to use.
|
Constant** Ops, ///< The array of constant operands to use.
|
||||||
|
unsigned NumOps, ///< The number of operands provided.
|
||||||
|
const TargetData *TD = 0 ///< Optional target information.
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user