Skip to content

Commit

Permalink
Update DxcOptToggles.h
Browse files Browse the repository at this point in the history
Switch to constexpr
  • Loading branch information
chrdavis authored Dec 13, 2024
1 parent 21de6b0 commit 269fed6
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions include/dxc/Support/DxcOptToggles.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,30 @@ namespace hlsl {
namespace options {

struct Toggle {
const char *Name;
llvm::StringRef Name;
bool Default = false;
Toggle(const char *Name, bool Default) : Name(Name), Default(Default) {}
constexpr Toggle(llvm::StringRef Name, bool Default) : Name(Name), Default(Default) {}
};

enum {
DEFAULT_ON = 1,
DEFAULT_OFF = 0,
};

static const Toggle TOGGLE_GVN = {"gvn", DEFAULT_ON};
static const Toggle TOGGLE_LICM = {"licm", DEFAULT_ON};
static const Toggle TOGGLE_SINK = {"sink", DEFAULT_ON};
static const Toggle TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION = {
static constexpr Toggle TOGGLE_GVN = {"gvn", DEFAULT_ON};
static constexpr Toggle TOGGLE_LICM = {"licm", DEFAULT_ON};
static constexpr Toggle TOGGLE_SINK = {"sink", DEFAULT_ON};
static constexpr Toggle TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION = {
"aggressive-reassociation", DEFAULT_ON};
static const Toggle TOGGLE_LIFETIME_MARKERS = {"lifetime-markers", DEFAULT_ON};
static const Toggle TOGGLE_PARTIAL_LIFETIME_MARKERS = {
static constexpr Toggle TOGGLE_LIFETIME_MARKERS = {"lifetime-markers",
DEFAULT_ON};
static constexpr Toggle TOGGLE_PARTIAL_LIFETIME_MARKERS = {
"partial-lifetime-markers", DEFAULT_OFF};
static const Toggle TOGGLE_STRUCTURIZE_LOOP_EXITS_FOR_UNROLL = {
static constexpr Toggle TOGGLE_STRUCTURIZE_LOOP_EXITS_FOR_UNROLL = {
"structurize-loop-exits-for-unroll", DEFAULT_ON};
static const Toggle TOGGLE_DEBUG_NOPS = {"debug-nops", DEFAULT_ON};
static const Toggle TOGGLE_STRUCTURIZE_RETURNS = {"structurize-returns",
DEFAULT_OFF};
static constexpr Toggle TOGGLE_DEBUG_NOPS = {"debug-nops", DEFAULT_ON};
static constexpr Toggle TOGGLE_STRUCTURIZE_RETURNS = {"structurize-returns",
DEFAULT_OFF};

struct OptimizationToggles {
// Optimization pass enables, disables and selects
Expand Down

0 comments on commit 269fed6

Please sign in to comment.