Index: src/IceClFlags.cpp |
diff --git a/src/IceClFlags.cpp b/src/IceClFlags.cpp |
index 7ee52280361d9b6169c00ab426e6f7b06f8d40d7..2286b057d8c72c5a0476512ef3c75b6a342ddcf7 100644 |
--- a/src/IceClFlags.cpp |
+++ b/src/IceClFlags.cpp |
@@ -223,12 +223,29 @@ cl::opt<std::string> VerboseFocusOn( |
cl::desc("Override with -verbose=none except for the specified function"), |
cl::init("")); |
-cl::opt<Ice::FileType> OutFileType( |
- "filetype", cl::desc("Output file type"), cl::init(Ice::FT_Iasm), |
- cl::values(clEnumValN(Ice::FT_Elf, "obj", "Native ELF object ('.o') file"), |
- clEnumValN(Ice::FT_Asm, "asm", "Assembly ('.s') file"), |
- clEnumValN(Ice::FT_Iasm, "iasm", |
+// Allow integrated assembler to use standalone assembler for instructions not |
+// yet implemented in the integrated assembler. |
+cl::opt<bool> |
+ AllowHybridAssembly("hybrid-asm", |
+ cl::desc("Use hybrid of 'asm' and 'iasm' assemblers"), |
+ cl::init(false)); |
+ |
+// Extends enum FileType to incorporate a hybrid integrated assembler. |
+enum ClFileType { |
+ CFT_Elf = Ice::FT_Elf, |
+ CFT_Asm = Ice::FT_Asm, |
+ CFT_Iasm = Ice::FT_Iasm, |
+ CFT_Hasm = 1000 // Intentionally big to not conflict with FT constants. |
+}; |
+ |
+cl::opt<ClFileType> OutFileType( |
+ "filetype", cl::desc("Output file type"), cl::init(CFT_Iasm), |
+ cl::values(clEnumValN(CFT_Elf, "obj", "Native ELF object ('.o') file"), |
+ clEnumValN(CFT_Asm, "asm", "Assembly ('.s') file"), |
+ clEnumValN(CFT_Iasm, "iasm", |
"Low-level integrated assembly ('.s') file"), |
+ clEnumValN(CFT_Hasm, "hasm", |
+ "shortcut for '-filetype=iasm -hybrid-asm'"), |
clEnumValEnd)); |
cl::opt<int> MaxNopsPerInstruction( |
@@ -376,6 +393,7 @@ void ClFlags::resetClFlags(ClFlags &OutFlags) { |
// bool fields |
OutFlags.AllowErrorRecovery = false; |
OutFlags.AllowExternDefinedSymbols = false; |
+ OutFlags.AllowHybridAssembly = false; |
OutFlags.AllowIacaMarks = false; |
OutFlags.AllowUninitializedGlobals = false; |
OutFlags.DataSections = false; |
@@ -439,6 +457,8 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
OutFlags.setAllowErrorRecovery(::AllowErrorRecovery); |
OutFlags.setAllowExternDefinedSymbols(::AllowExternDefinedSymbols || |
::DisableInternal); |
+ OutFlags.setAllowHybridAssembly(::AllowHybridAssembly || |
+ ::OutFileType == CFT_Hasm); |
OutFlags.setAllowIacaMarks(::AllowIacaMarks); |
OutFlags.setAllowUninitializedGlobals(::AllowUninitializedGlobals); |
OutFlags.setDataSections(::DataSections); |
@@ -480,7 +500,10 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) { |
OutFlags.setTranslateOnly(::TranslateOnly); |
OutFlags.setUseSandboxing(::UseSandboxing); |
OutFlags.setVerboseFocusOn(::VerboseFocusOn); |
- OutFlags.setOutFileType(::OutFileType); |
+ OutFlags.setOutFileType( |
+ ::OutFileType == CFT_Hasm |
+ ? FT_Iasm |
+ : static_cast<Ice::FileType>(static_cast<int>(::OutFileType))); |
OutFlags.setMaxNopsPerInstruction(::MaxNopsPerInstruction); |
OutFlags.setNopProbabilityAsPercentage(::NopProbabilityAsPercentage); |
OutFlags.setVerbose(VMask); |