class AssemblyAnnotationWriter;
class ValueHandleBase;
class LLVMContext;
+class MetadataContext;
//===----------------------------------------------------------------------===//
// Value Class
class Value {
const unsigned char SubclassID; // Subclass identifier (for isa/dyn_cast)
unsigned char HasValueHandle : 1; // Has a ValueHandle pointing to this?
+ unsigned char HasMetadata : 1; // Has a metadata attached to this ?
protected:
/// SubclassOptionalData - This member is similar to SubclassData, however it
/// is for holding information which may be used to aid optimization, but
friend class ValueSymbolTable; // Allow ValueSymbolTable to directly mod Name.
friend class SymbolTable; // Allow SymbolTable to directly poke Name.
friend class ValueHandleBase;
+ friend class MetadataContext;
+ friend class AbstractTypeUser;
ValueName *Name;
void operator=(const Value &); // Do not implement
Value(const Value &); // Do not implement
+protected:
+ /// printCustom - Value subclasses can override this to implement custom
+ /// printing behavior.
+ virtual void printCustom(raw_ostream &O) const;
+
public:
Value(const Type *Ty, unsigned scid);
virtual ~Value();
/// dump - Support for debugging, callable in GDB: V->dump()
//
- virtual void dump() const;
+ void dump() const;
/// print - Implement operator<< on Value.
///
// Only use when in type resolution situations!
void uncheckedReplaceAllUsesWith(Value *V);
- /// clearOptionalData - Clear any optional optimization data from this Value.
- /// Transformation passes must call this method whenever changing the IR
- /// in a way that would affect the values produced by this Value, unless
- /// it takes special care to ensure correctness in some other way.
- void clearOptionalData() { SubclassOptionalData = 0; }
-
//----------------------------------------------------------------------
// Methods for handling the chain of uses of this Value.
//
return SubclassID;
}
+ /// getRawSubclassOptionalData - Return the raw optional flags value
+ /// contained in this value. This should only be used when testing two
+ /// Values for equivalence.
+ unsigned getRawSubclassOptionalData() const {
+ return SubclassOptionalData;
+ }
+
+ /// hasSameSubclassOptionalData - Test whether the optional flags contained
+ /// in this value are equal to the optional flags in the given value.
+ bool hasSameSubclassOptionalData(const Value *V) const {
+ return SubclassOptionalData == V->SubclassOptionalData;
+ }
+
+ /// intersectOptionalDataWith - Clear any optional flags in this value
+ /// that are not also set in the given value.
+ void intersectOptionalDataWith(const Value *V) {
+ SubclassOptionalData &= V->SubclassOptionalData;
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Value *) {
return true; // Values are always values.
const BasicBlock *PredBB) const{
return const_cast<Value*>(this)->DoPHITranslation(CurBB, PredBB);
}
+
+ /// hasMetadata - Return true if metadata is attached with this value.
+ bool hasMetadata() const { return HasMetadata; }
};
inline raw_ostream &operator<<(raw_ostream &OS, const Value &V) {