jak-project/goalc/compiler/CompilerSettings.cpp
water111 f763eb6bf0
[jak2] support for multiple out/ directories (#1585)
* [jak2] support for multiple out/ directories

* windows
2022-06-30 21:11:58 -04:00

29 lines
961 B
C++

#include "CompilerSettings.h"
CompilerSettings::CompilerSettings() {
m_settings["print-ir"].kind = SettingKind::BOOL;
m_settings["print-ir"].boolp = &debug_print_ir;
m_settings["print-regalloc"].kind = SettingKind::BOOL;
m_settings["print-regalloc"].boolp = &debug_print_regalloc;
m_settings["disable-math-const-prop"].kind = SettingKind::BOOL;
m_settings["disable-math-const-prop"].boolp = &disable_math_const_prop;
}
void CompilerSettings::set(const std::string& name, const goos::Object& value) {
auto kv = m_settings.find(name);
if (kv == m_settings.end()) {
throw std::runtime_error("Compiler setting \"" + name + "\" was not recognized");
}
kv->second.value = value;
if (kv->second.boolp) {
*kv->second.boolp = !(value.is_symbol() && value.as_symbol()->name == "#f");
}
}
void CompilerSettings::link(bool& val, const std::string& name) {
m_settings[name].kind = SettingKind::BOOL;
m_settings[name].boolp = &val;
}