From bf78299f04f0a99a72a4a2977777ee67877784cb Mon Sep 17 00:00:00 2001 From: Andrew Bardsley Date: Fri, 9 May 2014 18:58:47 -0400 Subject: cpu: Add flag name printing to StaticInst This patch adds a the member function StaticInst::printFlags to allow all of an instruction's flags to be printed without using the individual is... member functions or resorting to exposing the 'flags' vector It also replaces the enum definition StaticInst::Flags with a Python-generated enumeration and adds to the enum generation mechanism in src/python/m5/params.py to allow Enums to be placed in namespaces other than Enums or, alternatively, in wrapper structs allowing them to be inherited by other classes (so populating that class's name-space with the enumeration element names). --- src/cpu/static_inst.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/cpu/static_inst.cc') diff --git a/src/cpu/static_inst.cc b/src/cpu/static_inst.cc index 2a7b584eb..387cf0575 100644 --- a/src/cpu/static_inst.cc +++ b/src/cpu/static_inst.cc @@ -92,3 +92,20 @@ StaticInst::disassemble(Addr pc, const SymbolTable *symtab) const return *cachedDisassembly; } + +void +StaticInst::printFlags(std::ostream &outs, + const std::string &separator) const +{ + bool printed_a_flag = false; + + for (unsigned int flag = IsNop; flag < Num_Flags; flag++) { + if (flags[flag]) { + if (printed_a_flag) + outs << separator; + + outs << FlagsStrings[flag]; + printed_a_flag = true; + } + } +} -- cgit v1.2.3