summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-ir-string-hash.h
blob: 94cbf7f702763743edd680ce8d83c806ba8fd7bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// slang-ir-string-hash.h
#pragma once

#include "../core/slang-string-slice-pool.h"
#include "slang-ir.h"

namespace Slang
{

struct IRModule;
class DiagnosticSink;

// Finds the global GlobalHashedStringLiterals instruction for the module if there is one, and then
// adds all of it's strings to ioPool.
void findGlobalHashedStringLiterals(IRModule* module, StringSlicePool& ioPool);

// Given a pool, with > 0 strings adds a GlobalHashedStringLiterals to the module.
void addGlobalHashedStringLiterals(const StringSlicePool& pool, IRModule* module);

// Find all of the IRGetStringHash instructions within the module
void findGetStringHashInsts(IRModule* module, List<IRGetStringHash*>& outInsts);

// Looks at all getStringHash instructions to make sure they access something valid (like a string
// literal) sink is optional and can be passed as nullptr
Result checkGetStringHashInsts(IRModule* module, DiagnosticSink* sink);

} // namespace Slang