Index: src/IceClFlags.cpp |
diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp |
index ed5a71df47ddf0ec3ed8886d5e20a5c4e330d256..6db34540331179457747bfb0f22d8108c975d4bc 100644 |
--- a/src/IceClFlags.cpp |
+++ b/src/IceClFlags.cpp |
@@ -287,6 +287,17 @@ cl::opt<int> NopProbabilityAsPercentage( |
"nop-insertion-percentage", |
cl::desc("Nop insertion probability as percentage"), cl::init(10)); |
+/// Restricts registers in corresponding register classes to specified list. |
+cl::list<std::string> UseRestrictedRegisters( |
+ "reg-use", cl::CommaSeparated, |
+ cl::desc( |
+ "Only use specified registers for corresponding register classes")); |
+ |
+/// List of excluded registers. |
+cl::list<std::string> |
+ ExcludedRegisters("reg-exclude", cl::CommaSeparated, |
+ cl::desc("Don't use specified registers")); |
+ |
/// Verbose options (can be comma-separated). |
cl::list<Ice::VerboseItem> VerboseList( |
"verbose", cl::CommaSeparated, |
@@ -309,6 +320,8 @@ cl::list<Ice::VerboseItem> VerboseList( |
clEnumValN(Ice::IceV_Loop, "loop", "Loop nest depth analysis"), |
clEnumValN(Ice::IceV_Status, "status", |
"Print the name of the function being translated"), |
+ clEnumValN(Ice::IceV_AvailableRegs, "registers", |
+ "Show available registers for register allocation"), |
clEnumValN(Ice::IceV_All, "all", "Use all verbose options"), |
clEnumValN(Ice::IceV_Most, "most", |
"Use all verbose options except 'regalloc'"), |
@@ -481,6 +494,9 @@ void ClFlags::resetClFlags(ClFlags &OutFlags) { |
// size_t and 64-bit fields. |
OutFlags.NumTranslationThreads = 0; |
OutFlags.RandomSeed = 0; |
+ // Sets. |
Jim Stichnoth
2016/01/13 16:24:54
Maybe "unordered_set fields"?
Karl
2016/01/14 18:27:19
Done.
|
+ OutFlags.clearExcludedRegisters(); |
+ OutFlags.clearUseRestrictedRegisters(); |
} |
void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
@@ -507,6 +523,8 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
OutFlags.setDisableTranslation(::DisableTranslation); |
OutFlags.setDumpStats(::DumpStats); |
OutFlags.setEnableBlockProfile(::EnableBlockProfile); |
+ for (const std::string &Name : ::ExcludedRegisters) |
Jim Stichnoth
2016/01/13 16:24:54
I think it would be more natural and regular if yo
Karl
2016/01/14 18:27:19
The main reason for not doing this is that we woul
John
2016/01/14 21:12:48
I agree with Jim here. Exposing cl::list<> to the
Karl
2016/01/14 22:00:52
I agree that it will work, and the current code wo
Jim Stichnoth
2016/01/14 22:04:19
I ended up retracting my comment after discussion
Karl
2016/01/14 23:54:51
Changed type of register sets to: std::vector<IceS
|
+ OutFlags.insertExcludedRegister(Name); |
OutFlags.setForceMemIntrinOpt(::ForceMemIntrinOpt); |
OutFlags.setFunctionSections(::FunctionSections); |
OutFlags.setNumTranslationThreads(::NumThreads); |
@@ -536,6 +554,8 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
OutFlags.setTimingFocusOn(::TimingFocusOn); |
OutFlags.setTranslateOnly(::TranslateOnly); |
OutFlags.setUseNonsfi(::UseNonsfi); |
+ for (const std::string &Name : ::UseRestrictedRegisters) |
Jim Stichnoth
2016/01/13 16:24:54
same comment as above
Karl
2016/01/14 18:27:19
Same response.
John
2016/01/14 21:12:48
same suggestion.
|
+ OutFlags.insertUseRestrictedRegister(Name); |
OutFlags.setUseSandboxing(::UseSandboxing); |
OutFlags.setVerboseFocusOn(::VerboseFocusOn); |
OutFlags.setOutFileType(::OutFileType); |