aboutsummaryrefslogtreecommitdiff
path: root/src/cuda-sim/ptx_ir.cc
diff options
context:
space:
mode:
authorTim Rogers <[email protected]>2013-02-21 23:56:39 -0800
committerAndrew Boktor <[email protected]>2014-08-14 13:50:05 -0700
commit355b9bcbc870fb79a5d682748f2475432c5cb6a5 (patch)
treeb2b4e671874102de77a8d3ab44555aab90413df3 /src/cuda-sim/ptx_ir.cc
parentb346aa92a4d8a432eb5b6f5aa5d4cc22aef41833 (diff)
Fixing a bug exposed by the fix for bug 42.
The "_" "null" register potentially generated by ptx and intentionally generated by ptxplus was being initialized without a type. This caused the parser to think it was not a register. Fix is to allow the parser to think of it as register, but ensure the arch-sim does not by adding a flag indicating that it is special. [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 15305]
Diffstat (limited to 'src/cuda-sim/ptx_ir.cc')
-rw-r--r--src/cuda-sim/ptx_ir.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/cuda-sim/ptx_ir.cc b/src/cuda-sim/ptx_ir.cc
index 0dffe70..678febf 100644
--- a/src/cuda-sim/ptx_ir.cc
+++ b/src/cuda-sim/ptx_ir.cc
@@ -191,8 +191,23 @@ bool symbol_table::add_function_decl( const char *name, int entry_point, functio
} else {
assert( !prior_decl );
*sym_table = new symbol_table( "", entry_point, this );
- symbol *null_reg = (*sym_table)->add_variable("_",NULL,0,"",0);
+
+ // Initial setup code to support a register represented as "_".
+ // This register is used when an instruction operand is
+ // not read or written. However, the parser must recognize it
+ // as a legitimate register but we do not want to pass
+ // it to the micro-architectural register to the performance simulator.
+ // For this purpose we add a symbol to the symbol table but
+ // mark it as a non_arch_reg so it does not effect the performance sim.
+ type_info_key null_key( reg_space, 0, 0, 0, 0, 0 );
+ null_key.set_is_non_arch_reg();
+ // First param is null - which is bad.
+ // However, the first parameter is actually unread in the constructor...
+ // TODO - remove the symbol_table* from type_info
+ type_info* null_type_info = new type_info( NULL, null_key );
+ symbol *null_reg = (*sym_table)->add_variable( "_", null_type_info, 0, "", 0 );
null_reg->set_regno(0, 0);
+
(*sym_table)->set_name(name);
(*func_info)->set_symtab(*sym_table);
m_function_symtab_lookup[key] = *sym_table;