Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/46327 )
Change subject: arch: Adopt the gem5 namespace in the ISA files
......................................................................
arch: Adopt the gem5 namespace in the ISA files
Make the necessary modifications to support the gem5
namespace in the ISA files.
The .isa files currently limited to a single namespace.
This limitation should be later removed to make it
easier to accomodate a better API.
Change-Id: Ibd2c5ba936b7fcc4b97e7db7b161c0755b6b9872
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/arch/amdgpu/gcn3/ast_interpreter.py
M src/arch/arm/isa/includes.isa
M src/arch/isa_parser/isa_parser.py
M src/arch/mips/isa/includes.isa
M src/arch/power/isa/includes.isa
M src/arch/riscv/isa/includes.isa
M src/arch/sparc/isa/includes.isa
M src/arch/x86/isa/includes.isa
8 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/src/arch/amdgpu/gcn3/ast_interpreter.py
b/src/arch/amdgpu/gcn3/ast_interpreter.py
index 6bd035c..8a7bfc7 100644
--- a/src/arch/amdgpu/gcn3/ast_interpreter.py
+++ b/src/arch/amdgpu/gcn3/ast_interpreter.py
@@ -1479,6 +1479,9 @@
cg.cg_include('gpu-internal/arch/vi/gpu_types.hh')
cg.cg_newline()
+ cg.cg_namespace('gem5')
+ cg.cg_newline()
+
cg.cg_code('class GPUStaticInst;')
cg.cg_newline()
@@ -1559,6 +1562,7 @@
cg.cg_end('union InstFormat') # cg_union
cg.cg_end('namespace ViISA') # cg_namespace
+ cg.cg_end('namespace gem5') # cg_namespace
cg.cg_newline()
cg.cg_code('#endif // __GPU_INTERNAL_ARCH_VI_DECODER_HH__')
@@ -1577,6 +1581,7 @@
cg.cg_include('gpu-internal/arch/vi/instructions.hh')
cg.cg_newline()
+ cg.cg_namespace('gem5')
cg.cg_namespace('ViISA')
cg.cg_method(None, 'Decoder', 'Decoder', [], [])
@@ -1652,6 +1657,7 @@
cg.cg_newline()
cg.cg_end('namespace ViISA') # cg_namespace
+ cg.cg_end('namespace gem5') # cg_namespace
cg.generate()
@@ -1669,6 +1675,7 @@
cg.cg_include('gpu-internal/arch/vi/op_encodings.hh')
cg.cg_newline()
+ cg.cg_namespace('gem5')
cg.cg_namespace('ViISA')
for info in self.refined_op_info:
@@ -1902,6 +1909,7 @@
cg.cg_end(op_inst) # cg_class
cg.cg_end('namespace ViISA') # cg_namespace
+ cg.cg_end('namespace gem5') # cg_namespace
cg.cg_code('#endif // __GPU_INTERNAL_ARCH_VI_INSTRUCTIONS_HH__')
cg.generate()
@@ -2746,6 +2754,7 @@
cg.cg_include('gpu-internal/arch/vi/inst_util.hh')
cg.cg_newline()
+ cg.cg_namespace('gem5')
cg.cg_namespace('ViISA')
instruction_index = 0
@@ -2884,6 +2893,7 @@
cg.cg_end('isValid') # cg_method
cg.cg_end('namespace ViISA') # cg_namespace
+ cg.cg_end('namespace gem5') # cg_namespace
cg.generate()
diff --git a/src/arch/arm/isa/includes.isa b/src/arch/arm/isa/includes.isa
index a09655b..3ec3e65 100644
--- a/src/arch/arm/isa/includes.isa
+++ b/src/arch/arm/isa/includes.isa
@@ -70,10 +70,13 @@
#include "mem/packet.hh"
#include "sim/faults.hh"
+namespace gem5
+{
namespace ArmISAInst
{
using namespace ArmISA;
-}
+} // namespace ArmISAInst
+} // namespace gem5
}};
@@ -91,6 +94,7 @@
#include "base/loader/symtab.hh"
#include "cpu/thread_context.hh"
+using namespace gem5;
using namespace ArmISA;
}};
@@ -116,6 +120,7 @@
#include "sim/pseudo_inst.hh"
#include "sim/sim_exit.hh"
+using namespace gem5;
using namespace ArmISA;
}};
diff --git a/src/arch/isa_parser/isa_parser.py
b/src/arch/isa_parser/isa_parser.py
index bfe9c91..9cfd5ba 100755
--- a/src/arch/isa_parser/isa_parser.py
+++ b/src/arch/isa_parser/isa_parser.py
@@ -606,8 +606,10 @@
fn = 'decoder-ns.hh.inc'
assert(fn in self.files)
- f.write('namespace %s {\n#include "%s"\n}\n'
- % (self.namespace, fn))
+ f.write('namespace gem5\n{\n')
+ f.write('namespace %s {\n#include "%s"\n} // namespace %s\n'
+ % (self.namespace, fn, self.namespace))
+ f.write('} // namespace gem5')
f.write('\n#endif // __ARCH_%s_GENERATED_DECODER_HH__\n' %
self.isa_name.upper())
@@ -648,11 +650,13 @@
fn = 'decoder-ns.cc.inc'
assert(fn in self.files)
+ print('namespace gem5\n{\n', file=f)
print('namespace %s {' % self.namespace, file=f)
if splits > 1:
print('#define __SPLIT %u' % i, file=f)
print('#include "%s"' % fn, file=f)
- print('}', file=f)
+ print('} // namespace %s' % self.namespace, file=f)
+ print('} // namespace gem5', file=f)
# instruction execution
splits = self.splits[self.get_file('exec')]
@@ -669,11 +673,13 @@
fn = 'exec-ns.cc.inc'
assert(fn in self.files)
+ print('namespace gem5\n{\n', file=f)
print('namespace %s {' % self.namespace, file=f)
if splits > 1:
print('#define __SPLIT %u' % i, file=f)
print('#include "%s"' % fn, file=f)
- print('}', file=f)
+ print('} // namespace %s' % self.namespace, file=f)
+ print('} // namespace gem5', file=f)
scaremonger_template ='''// DO NOT EDIT
// This file was automatically generated from an ISA description:
@@ -1152,6 +1158,7 @@
'top_level_decode_block : decode_block'
codeObj = t[1]
codeObj.wrap_decode_block('''
+using namespace gem5;
StaticInstPtr
%(isa_name)s::Decoder::decodeInst(%(isa_name)s::ExtMachInst machInst)
{
diff --git a/src/arch/mips/isa/includes.isa b/src/arch/mips/isa/includes.isa
index 8ee2877..6802810 100644
--- a/src/arch/mips/isa/includes.isa
+++ b/src/arch/mips/isa/includes.isa
@@ -64,6 +64,7 @@
#include "mem/packet.hh"
#include "sim/full_system.hh"
+using namespace gem5;
using namespace MipsISA;
}};
@@ -95,6 +96,7 @@
#include "sim/sim_events.hh"
#include "sim/sim_exit.hh"
+using namespace gem5;
using namespace MipsISA;
}};
diff --git a/src/arch/power/isa/includes.isa
b/src/arch/power/isa/includes.isa
index b50f15d..e9b950b 100644
--- a/src/arch/power/isa/includes.isa
+++ b/src/arch/power/isa/includes.isa
@@ -46,6 +46,7 @@
#include "cpu/static_inst.hh"
#include "mem/packet.hh"
+using namespace gem5;
using namespace PowerISA;
}};
@@ -59,6 +60,7 @@
#include "base/cprintf.hh"
#include "cpu/thread_context.hh"
+using namespace gem5;
using namespace PowerISA;
}};
@@ -76,6 +78,7 @@
#include "mem/packet_access.hh"
#include "sim/sim_exit.hh"
+using namespace gem5;
using namespace PowerISA;
}};
diff --git a/src/arch/riscv/isa/includes.isa
b/src/arch/riscv/isa/includes.isa
index 2f97f15..6ffa277 100644
--- a/src/arch/riscv/isa/includes.isa
+++ b/src/arch/riscv/isa/includes.isa
@@ -74,6 +74,7 @@
#include "mem/request.hh"
#include "sim/full_system.hh"
+using namespace gem5;
using namespace RiscvISA;
}};
@@ -105,5 +106,6 @@
#include "sim/sim_exit.hh"
#include "sim/system.hh"
+using namespace gem5;
using namespace RiscvISA;
}};
diff --git a/src/arch/sparc/isa/includes.isa
b/src/arch/sparc/isa/includes.isa
index 1dade27..c561056 100644
--- a/src/arch/sparc/isa/includes.isa
+++ b/src/arch/sparc/isa/includes.isa
@@ -66,6 +66,7 @@
#include "cpu/thread_context.hh" // for Jump::branchTarget()
#include "mem/packet.hh"
+using namespace gem5;
using namespace SparcISA;
}};
@@ -86,6 +87,7 @@
#include "sim/pseudo_inst.hh"
#include "sim/sim_exit.hh"
+using namespace gem5;
using namespace SparcISA;
}};
diff --git a/src/arch/x86/isa/includes.isa b/src/arch/x86/isa/includes.isa
index 0136624..fe28516 100644
--- a/src/arch/x86/isa/includes.isa
+++ b/src/arch/x86/isa/includes.isa
@@ -69,6 +69,7 @@
#include "mem/packet.hh"
#include "sim/faults.hh"
+using namespace gem5;
using X86ISA::GpRegIndex;
using X86ISA::FpRegIndex;
using X86ISA::CtrlRegIndex;
@@ -96,6 +97,7 @@
#include "mem/packet.hh"
#include "sim/full_system.hh"
+using namespace gem5;
using namespace X86ISA;
}};
@@ -123,6 +125,7 @@
#include "sim/pseudo_inst.hh"
#include "sim/sim_exit.hh"
+using namespace gem5;
using namespace X86ISA;
}};
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/46327
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ibd2c5ba936b7fcc4b97e7db7b161c0755b6b9872
Gerrit-Change-Number: 46327
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s