2008-02-06 23:27:42 +01:00
|
|
|
//===-- llvm/CodeGen/PseudoSourceValue.h ------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the declaration of the PseudoSourceValue class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
|
|
|
|
#define LLVM_CODEGEN_PSEUDOSOURCEVALUE_H
|
|
|
|
|
|
|
|
#include "llvm/Value.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
2008-07-25 02:02:30 +02:00
|
|
|
class MachineFrameInfo;
|
2008-08-24 20:51:20 +02:00
|
|
|
class raw_ostream;
|
2008-07-25 02:02:30 +02:00
|
|
|
|
2008-02-06 23:27:42 +01:00
|
|
|
/// PseudoSourceValue - Special value supplied for machine level alias
|
|
|
|
/// analysis. It indicates that the a memory access references the functions
|
|
|
|
/// stack frame (e.g., a spill slot), below the stack frame (e.g., argument
|
|
|
|
/// space), or constant pool.
|
|
|
|
class PseudoSourceValue : public Value {
|
2009-09-23 03:33:16 +02:00
|
|
|
private:
|
|
|
|
/// printCustom - Implement printing for PseudoSourceValue. This is called
|
|
|
|
/// from Value::print or Value's operator<<.
|
|
|
|
///
|
|
|
|
virtual void printCustom(raw_ostream &O) const;
|
|
|
|
|
2008-02-06 23:27:42 +01:00
|
|
|
public:
|
2009-11-16 21:40:06 +01:00
|
|
|
explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
|
2008-02-06 23:27:42 +01:00
|
|
|
|
2009-09-27 17:41:19 +02:00
|
|
|
/// isConstant - Test whether the memory pointed to by this
|
|
|
|
/// PseudoSourceValue has a constant value.
|
2008-07-25 02:02:30 +02:00
|
|
|
///
|
|
|
|
virtual bool isConstant(const MachineFrameInfo *) const;
|
|
|
|
|
2009-10-18 20:16:27 +02:00
|
|
|
/// isAliased - Test whether the memory pointed to by this
|
|
|
|
/// PseudoSourceValue may also be pointed to by an LLVM IR Value.
|
2009-10-18 21:58:47 +02:00
|
|
|
virtual bool isAliased(const MachineFrameInfo *) const;
|
2009-10-18 20:16:27 +02:00
|
|
|
|
2009-11-02 00:50:04 +01:00
|
|
|
/// mayAlias - Return true if the memory pointed to by this
|
|
|
|
/// PseudoSourceValue can ever alias a LLVM IR Value.
|
|
|
|
virtual bool mayAlias(const MachineFrameInfo *) const;
|
|
|
|
|
2008-02-06 23:27:42 +01:00
|
|
|
/// classof - Methods for support type inquiry through isa, cast, and
|
|
|
|
/// dyn_cast:
|
|
|
|
///
|
|
|
|
static inline bool classof(const PseudoSourceValue *) { return true; }
|
|
|
|
static inline bool classof(const Value *V) {
|
2009-11-16 21:40:06 +01:00
|
|
|
return V->getValueID() == PseudoSourceValueVal ||
|
|
|
|
V->getValueID() == FixedStackPseudoSourceValueVal;
|
2008-02-06 23:27:42 +01:00
|
|
|
}
|
|
|
|
|
2009-10-17 09:53:04 +02:00
|
|
|
/// A pseudo source value referencing a fixed stack frame entry,
|
|
|
|
/// e.g., a spill slot.
|
|
|
|
static const PseudoSourceValue *getFixedStack(int FI);
|
2008-02-06 23:27:42 +01:00
|
|
|
|
2009-09-23 23:06:36 +02:00
|
|
|
/// A pseudo source value referencing the area below the stack frame of
|
|
|
|
/// a function, e.g., the argument space.
|
2008-02-07 19:41:25 +01:00
|
|
|
static const PseudoSourceValue *getStack();
|
2008-02-06 23:27:42 +01:00
|
|
|
|
2009-09-23 23:06:36 +02:00
|
|
|
/// A pseudo source value referencing the global offset table
|
|
|
|
/// (or something the like).
|
2008-02-07 19:41:25 +01:00
|
|
|
static const PseudoSourceValue *getGOT();
|
2008-02-06 23:27:42 +01:00
|
|
|
|
2009-09-23 23:06:36 +02:00
|
|
|
/// A pseudo source value referencing the constant pool. Since constant
|
|
|
|
/// pools are constant, this doesn't need to identify a specific constant
|
|
|
|
/// pool entry.
|
2008-02-07 19:41:25 +01:00
|
|
|
static const PseudoSourceValue *getConstantPool();
|
2008-02-06 23:27:42 +01:00
|
|
|
|
2009-09-23 23:06:36 +02:00
|
|
|
/// A pseudo source value referencing a jump table. Since jump tables are
|
|
|
|
/// constant, this doesn't need to identify a specific jump table.
|
2008-02-07 19:41:25 +01:00
|
|
|
static const PseudoSourceValue *getJumpTable();
|
2008-02-06 23:27:42 +01:00
|
|
|
};
|
2009-11-12 21:25:07 +01:00
|
|
|
|
|
|
|
/// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
|
|
|
|
/// for holding FixedStack values, which must include a frame
|
|
|
|
/// index.
|
|
|
|
class FixedStackPseudoSourceValue : public PseudoSourceValue {
|
|
|
|
const int FI;
|
|
|
|
public:
|
|
|
|
explicit FixedStackPseudoSourceValue(int fi) :
|
|
|
|
PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
|
|
|
|
|
|
|
|
/// classof - Methods for support type inquiry through isa, cast, and
|
|
|
|
/// dyn_cast:
|
|
|
|
///
|
|
|
|
static inline bool classof(const FixedStackPseudoSourceValue *) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
static inline bool classof(const Value *V) {
|
|
|
|
return V->getValueID() == FixedStackPseudoSourceValueVal;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isConstant(const MachineFrameInfo *MFI) const;
|
|
|
|
|
|
|
|
virtual bool isAliased(const MachineFrameInfo *MFI) const;
|
|
|
|
|
|
|
|
virtual bool mayAlias(const MachineFrameInfo *) const;
|
|
|
|
|
2009-11-12 22:49:55 +01:00
|
|
|
virtual void printCustom(raw_ostream &OS) const;
|
2009-11-12 21:25:07 +01:00
|
|
|
|
2009-11-12 22:49:55 +01:00
|
|
|
int getFrameIndex() const { return FI; }
|
2009-11-12 21:25:07 +01:00
|
|
|
};
|
2008-02-06 23:27:42 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|