Shader_IR: Address Feedback

This commit is contained in:
Fernando Sahmkow 2020-01-04 14:40:57 -04:00
parent b3371ed09e
commit 3dd6b55851
5 changed files with 19 additions and 38 deletions

View file

@ -394,14 +394,14 @@ using Meta =
class AmendNode {
public:
std::optional<u32> GetAmendIndex() const {
std::optional<std::size_t> GetAmendIndex() const {
if (amend_index == amend_null_index) {
return std::nullopt;
}
return {amend_index};
}
void SetAmendIndex(u32 index) {
void SetAmendIndex(std::size_t index) {
amend_index = index;
}
@ -410,8 +410,8 @@ public:
}
private:
static constexpr u32 amend_null_index = 0xFFFFFFFF;
u32 amend_index{amend_null_index};
static constexpr std::size_t amend_null_index = 0xFFFFFFFFFFFFFFFFULL;
std::size_t amend_index{amend_null_index};
};
/// Holds any kind of operation that can be done in the IR
@ -652,7 +652,7 @@ private:
};
/// Commentary, can be dropped
class CommentNode final : public AmendNode {
class CommentNode final {
public:
explicit CommentNode(std::string text) : text{std::move(text)} {}

View file

@ -446,8 +446,8 @@ Node ShaderIR::BitfieldInsert(Node base, Node insert, u32 offset, u32 bits) {
Immediate(bits));
}
u32 ShaderIR::DeclareAmend(Node new_amend) {
const u32 id = static_cast<u32>(amend_code.size());
std::size_t ShaderIR::DeclareAmend(Node new_amend) {
const std::size_t id = amend_code.size();
amend_code.push_back(new_amend);
return id;
}

View file

@ -176,7 +176,7 @@ public:
/// Returns a condition code evaluated from internal flags
Node GetConditionCode(Tegra::Shader::ConditionCode cc) const;
const Node& GetAmendNode(u32 index) const {
const Node& GetAmendNode(std::size_t index) const {
return amend_code[index];
}
@ -396,8 +396,8 @@ private:
Tegra::Shader::Instruction instr,
bool is_write);
/// Amends
u32 DeclareAmend(Node new_amend);
/// Register new amending code and obtain the reference id.
std::size_t DeclareAmend(Node new_amend);
const ProgramCode& program_code;
const u32 main_offset;
@ -413,7 +413,7 @@ private:
std::map<u32, NodeBlock> basic_blocks;
NodeBlock global_code;
ASTManager program_manager{true, true};
NodeBlock amend_code;
std::vector<Node> amend_code;
std::set<u32> used_registers;
std::set<Tegra::Shader::Pred> used_predicates;