mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
Thread LLVMContext through the constant folding APIs, which touches a lot of files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74844 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,18 +22,20 @@ namespace llvm {
|
||||
class TargetData;
|
||||
class Function;
|
||||
class Type;
|
||||
class LLVMContext;
|
||||
|
||||
/// ConstantFoldInstruction - Attempt to constant fold the specified
|
||||
/// instruction. If successful, the constant result is returned, if not, null
|
||||
/// is returned. Note that this function can only fail when attempting to fold
|
||||
/// instructions like loads and stores, which have no constant expression form.
|
||||
///
|
||||
Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
|
||||
Constant *ConstantFoldInstruction(Instruction *I, LLVMContext* Context,
|
||||
const TargetData *TD = 0);
|
||||
|
||||
/// ConstantFoldConstantExpression - Attempt to fold the constant expression
|
||||
/// using the specified TargetData. If successful, the constant result is
|
||||
/// result is returned, if not, null is returned.
|
||||
Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
|
||||
Constant *ConstantFoldConstantExpression(ConstantExpr *CE, LLVMContext* Context,
|
||||
const TargetData *TD = 0);
|
||||
|
||||
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
|
||||
@@ -44,6 +46,7 @@ Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
|
||||
///
|
||||
Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
|
||||
Constant*const * Ops, unsigned NumOps,
|
||||
LLVMContext* Context,
|
||||
const TargetData *TD = 0);
|
||||
|
||||
/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare
|
||||
@@ -52,13 +55,15 @@ Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
|
||||
///
|
||||
Constant *ConstantFoldCompareInstOperands(unsigned Predicate,
|
||||
Constant*const * Ops, unsigned NumOps,
|
||||
LLVMContext* Context,
|
||||
const TargetData *TD = 0);
|
||||
|
||||
|
||||
/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
|
||||
/// getelementptr constantexpr, return the constant value being addressed by the
|
||||
/// constant expression, or null if something is funny and we can't decide.
|
||||
Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE);
|
||||
Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE,
|
||||
LLVMContext* Context);
|
||||
|
||||
/// canConstantFoldCallTo - Return true if its even possible to fold a call to
|
||||
/// the specified function.
|
||||
|
@@ -36,6 +36,7 @@ namespace llvm {
|
||||
class Type;
|
||||
class ScalarEvolution;
|
||||
class TargetData;
|
||||
class LLVMContext;
|
||||
|
||||
/// SCEV - This class represents an analyzed expression in the program. These
|
||||
/// are opaque objects that the client is not allowed to do much with
|
||||
@@ -354,6 +355,8 @@ namespace llvm {
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
ScalarEvolution();
|
||||
|
||||
LLVMContext* getContext() const { return Context; }
|
||||
|
||||
/// isSCEVable - Test if values of the given type are analyzable within
|
||||
/// the SCEV framework. This primarily includes integer types, and it
|
||||
/// can optionally include pointer types if the ScalarEvolution class
|
||||
|
@@ -37,7 +37,7 @@ namespace llvm {
|
||||
friend struct SCEVVisitor<SCEVExpander, Value*>;
|
||||
public:
|
||||
explicit SCEVExpander(ScalarEvolution &se)
|
||||
: SE(se), Builder(TargetFolder(se.TD)) {}
|
||||
: SE(se), Builder(TargetFolder(se.TD, se.getContext())) {}
|
||||
|
||||
/// clear - Erase the contents of the InsertedExpressions map so that users
|
||||
/// trying to expand the same expression into multiple BasicBlocks or
|
||||
|
Reference in New Issue
Block a user