jak-project/goalc/compiler/CompilerSettings.h
water111 2d11e44eaf
Compiler Cleanup and Documentation (#54)
* start cleanup

* fix typos

* fix syntax highlighting in doc

* lots of documentation updates

* clean and add tests

* more documentation and more error messages

* more document and try building kernel differently
2020-09-24 17:19:23 -04:00

35 lines
780 B
C++

#pragma once
#ifndef JAK_COMPILERSETTINGS_H
#define JAK_COMPILERSETTINGS_H
#include <unordered_map>
#include <string>
#include "common/goos/Object.h"
class CompilerSettings {
public:
CompilerSettings();
bool debug_print_ir = false;
bool debug_print_regalloc = false;
bool disable_math_const_prop = false;
bool emit_move_after_return = true;
bool print_timing = false;
void set(const std::string& name, const goos::Object& value);
private:
void link(bool& val, const std::string& name);
enum class SettingKind { BOOL, INVALID };
struct SettingsEntry {
SettingKind kind = SettingKind::INVALID;
goos::Object value;
bool* boolp = nullptr;
};
std::unordered_map<std::string, SettingsEntry> m_settings;
};
#endif // JAK_COMPILERSETTINGS_H