mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-21 19:20:07 +00:00
parent
456cc598af
commit
0c4feb643b
2
DEPS
2
DEPS
@ -5,7 +5,7 @@ vars = {
|
||||
|
||||
'effcee_revision': 'b83b58d177b797edd1f94c5f10837f2cc2863f0a',
|
||||
'googletest_revision': '2f42d769ad1b08742f7ccb5ad4dd357fc5ff248c',
|
||||
're2_revision': '848dfb7e1d7ba641d598cb66f81590f3999a555a',
|
||||
're2_revision': 'e356bd3f80e0c15c1050323bb5a2d0f8ea4845f4',
|
||||
'spirv_headers_revision': 'de99d4d834aeb51dd9f099baa285bd44fd04bb3d',
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ class NullConstant : public Constant {
|
||||
std::unique_ptr<Constant> Copy() const override {
|
||||
return std::unique_ptr<Constant>(CopyNullConstant().release());
|
||||
}
|
||||
bool IsZero() const override { return true; };
|
||||
bool IsZero() const override { return true; }
|
||||
};
|
||||
|
||||
// Hash function for Constant instances. Use the structure of the constant as
|
||||
|
@ -181,19 +181,21 @@ class Constraint {
|
||||
|
||||
bool operator!=(const Constraint& other) const;
|
||||
|
||||
// clang-format off
|
||||
#define DeclareCastMethod(target) \
|
||||
virtual target* As##target() { return nullptr; } \
|
||||
virtual const target* As##target() const { return nullptr; }
|
||||
DeclareCastMethod(DependenceLine);
|
||||
DeclareCastMethod(DependenceDistance);
|
||||
DeclareCastMethod(DependencePoint);
|
||||
DeclareCastMethod(DependenceNone);
|
||||
DeclareCastMethod(DependenceEmpty);
|
||||
DeclareCastMethod(DependenceLine)
|
||||
DeclareCastMethod(DependenceDistance)
|
||||
DeclareCastMethod(DependencePoint)
|
||||
DeclareCastMethod(DependenceNone)
|
||||
DeclareCastMethod(DependenceEmpty)
|
||||
#undef DeclareCastMethod
|
||||
|
||||
protected:
|
||||
const Loop* loop_;
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
class DependenceLine : public Constraint {
|
||||
public:
|
||||
|
@ -171,16 +171,17 @@ class SENode {
|
||||
bool IsCantCompute() const { return GetType() == CanNotCompute; }
|
||||
|
||||
// Implements a casting method for each type.
|
||||
// clang-format off
|
||||
#define DeclareCastMethod(target) \
|
||||
virtual target* As##target() { return nullptr; } \
|
||||
virtual const target* As##target() const { return nullptr; }
|
||||
DeclareCastMethod(SEConstantNode);
|
||||
DeclareCastMethod(SERecurrentNode);
|
||||
DeclareCastMethod(SEAddNode);
|
||||
DeclareCastMethod(SEMultiplyNode);
|
||||
DeclareCastMethod(SENegative);
|
||||
DeclareCastMethod(SEValueUnknown);
|
||||
DeclareCastMethod(SECantCompute);
|
||||
DeclareCastMethod(SEConstantNode)
|
||||
DeclareCastMethod(SERecurrentNode)
|
||||
DeclareCastMethod(SEAddNode)
|
||||
DeclareCastMethod(SEMultiplyNode)
|
||||
DeclareCastMethod(SENegative)
|
||||
DeclareCastMethod(SEValueUnknown)
|
||||
DeclareCastMethod(SECantCompute)
|
||||
#undef DeclareCastMethod
|
||||
|
||||
// Get the analysis which has this node in its cache.
|
||||
@ -200,6 +201,7 @@ class SENode {
|
||||
// The number of nodes created.
|
||||
static uint32_t NumberOfNodes;
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// Function object to handle the hashing of SENodes. Hashing algorithm hashes
|
||||
// the type (as a string), the literal value of any constants, and the child
|
||||
|
@ -102,7 +102,7 @@ std::unique_ptr<Type> Type::Clone() const {
|
||||
#define DeclareKindCase(kind) \
|
||||
case k##kind: \
|
||||
type = MakeUnique<kind>(*this->As##kind()); \
|
||||
break;
|
||||
break
|
||||
DeclareKindCase(Void);
|
||||
DeclareKindCase(Bool);
|
||||
DeclareKindCase(Integer);
|
||||
@ -146,7 +146,7 @@ bool Type::operator==(const Type& other) const {
|
||||
switch (kind_) {
|
||||
#define DeclareKindCase(kind) \
|
||||
case k##kind: \
|
||||
return As##kind()->IsSame(&other);
|
||||
return As##kind()->IsSame(&other)
|
||||
DeclareKindCase(Void);
|
||||
DeclareKindCase(Bool);
|
||||
DeclareKindCase(Integer);
|
||||
@ -195,7 +195,7 @@ void Type::GetHashWords(std::vector<uint32_t>* words,
|
||||
#define DeclareKindCase(type) \
|
||||
case k##type: \
|
||||
As##type()->GetExtraHashWords(words, seen); \
|
||||
break;
|
||||
break
|
||||
DeclareKindCase(Void);
|
||||
DeclareKindCase(Bool);
|
||||
DeclareKindCase(Integer);
|
||||
|
@ -145,37 +145,6 @@ class Type {
|
||||
// TODO(alanbaker): Update this if variable pointers become a core feature.
|
||||
bool IsUniqueType(bool allowVariablePointers = false) const;
|
||||
|
||||
// A bunch of methods for casting this type to a given type. Returns this if the
|
||||
// cast can be done, nullptr otherwise.
|
||||
#define DeclareCastMethod(target) \
|
||||
virtual target* As##target() { return nullptr; } \
|
||||
virtual const target* As##target() const { return nullptr; }
|
||||
DeclareCastMethod(Void);
|
||||
DeclareCastMethod(Bool);
|
||||
DeclareCastMethod(Integer);
|
||||
DeclareCastMethod(Float);
|
||||
DeclareCastMethod(Vector);
|
||||
DeclareCastMethod(Matrix);
|
||||
DeclareCastMethod(Image);
|
||||
DeclareCastMethod(Sampler);
|
||||
DeclareCastMethod(SampledImage);
|
||||
DeclareCastMethod(Array);
|
||||
DeclareCastMethod(RuntimeArray);
|
||||
DeclareCastMethod(Struct);
|
||||
DeclareCastMethod(Opaque);
|
||||
DeclareCastMethod(Pointer);
|
||||
DeclareCastMethod(Function);
|
||||
DeclareCastMethod(Event);
|
||||
DeclareCastMethod(DeviceEvent);
|
||||
DeclareCastMethod(ReserveId);
|
||||
DeclareCastMethod(Queue);
|
||||
DeclareCastMethod(Pipe);
|
||||
DeclareCastMethod(ForwardPointer);
|
||||
DeclareCastMethod(PipeStorage);
|
||||
DeclareCastMethod(NamedBarrier);
|
||||
DeclareCastMethod(AccelerationStructureNV);
|
||||
#undef DeclareCastMethod
|
||||
|
||||
bool operator==(const Type& other) const;
|
||||
|
||||
// Returns the hash value of this type.
|
||||
@ -197,6 +166,38 @@ class Type {
|
||||
std::vector<uint32_t>* words,
|
||||
std::unordered_set<const Type*>* pSet) const = 0;
|
||||
|
||||
// A bunch of methods for casting this type to a given type. Returns this if the
|
||||
// cast can be done, nullptr otherwise.
|
||||
// clang-format off
|
||||
#define DeclareCastMethod(target) \
|
||||
virtual target* As##target() { return nullptr; } \
|
||||
virtual const target* As##target() const { return nullptr; }
|
||||
DeclareCastMethod(Void)
|
||||
DeclareCastMethod(Bool)
|
||||
DeclareCastMethod(Integer)
|
||||
DeclareCastMethod(Float)
|
||||
DeclareCastMethod(Vector)
|
||||
DeclareCastMethod(Matrix)
|
||||
DeclareCastMethod(Image)
|
||||
DeclareCastMethod(Sampler)
|
||||
DeclareCastMethod(SampledImage)
|
||||
DeclareCastMethod(Array)
|
||||
DeclareCastMethod(RuntimeArray)
|
||||
DeclareCastMethod(Struct)
|
||||
DeclareCastMethod(Opaque)
|
||||
DeclareCastMethod(Pointer)
|
||||
DeclareCastMethod(Function)
|
||||
DeclareCastMethod(Event)
|
||||
DeclareCastMethod(DeviceEvent)
|
||||
DeclareCastMethod(ReserveId)
|
||||
DeclareCastMethod(Queue)
|
||||
DeclareCastMethod(Pipe)
|
||||
DeclareCastMethod(ForwardPointer)
|
||||
DeclareCastMethod(PipeStorage)
|
||||
DeclareCastMethod(NamedBarrier)
|
||||
DeclareCastMethod(AccelerationStructureNV)
|
||||
#undef DeclareCastMethod
|
||||
|
||||
protected:
|
||||
// Decorations attached to this type. Each decoration is encoded as a vector
|
||||
// of uint32_t numbers. The first uint32_t number is the decoration value,
|
||||
@ -210,6 +211,7 @@ class Type {
|
||||
|
||||
Kind kind_;
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
class Integer : public Type {
|
||||
public:
|
||||
|
@ -38,7 +38,7 @@ class BlindlyRemoveGlobalValuesReductionOpportunityFinder
|
||||
~BlindlyRemoveGlobalValuesReductionOpportunityFinder() override = default;
|
||||
|
||||
// The name of this pass.
|
||||
std::string GetName() const final { return "BlindlyRemoveGlobalValuesPass"; };
|
||||
std::string GetName() const final { return "BlindlyRemoveGlobalValuesPass"; }
|
||||
|
||||
// Finds opportunities to remove all global values. Assuming they are all
|
||||
// referenced (directly or indirectly) from elsewhere in the module, each such
|
||||
@ -99,7 +99,7 @@ class OpVariableDuplicatorReductionOpportunityFinder
|
||||
|
||||
std::string GetName() const final {
|
||||
return "LocalVariableAdderReductionOpportunityFinder";
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<ReductionOpportunity>> GetAvailableOpportunities(
|
||||
IRContext* context) const final {
|
||||
|
@ -97,7 +97,7 @@ class MockCumulativeTimer : public CumulativeTimer {
|
||||
long PageFault() const override { return count_stop_ * 3600L; }
|
||||
|
||||
// Calling Stop() does nothing but just increases |count_stop_| by 1.
|
||||
void Stop() override { ++count_stop_; };
|
||||
void Stop() override { ++count_stop_; }
|
||||
|
||||
private:
|
||||
unsigned int count_stop_;
|
||||
|
Loading…
Reference in New Issue
Block a user