diff options
author | Korey Sewell <ksewell@umich.edu> | 2009-05-12 15:01:14 -0400 |
---|---|---|
committer | Korey Sewell <ksewell@umich.edu> | 2009-05-12 15:01:14 -0400 |
commit | 98b1452058ae7e82df7cb7c0373c62a97981a2b9 (patch) | |
tree | dcc1d95c125bc692daac52ff7aecf1d04dd12c6c /src/cpu/inorder/inorder_dyn_inst.hh | |
parent | 2012202b06a620998709f605f8f8692ad718294d (diff) | |
download | gem5-98b1452058ae7e82df7cb7c0373c62a97981a2b9.tar.xz |
inorder-miscregs: Fix indexing for misc. reg operands and update result-types for better tracing of these types of values
Diffstat (limited to 'src/cpu/inorder/inorder_dyn_inst.hh')
-rw-r--r-- | src/cpu/inorder/inorder_dyn_inst.hh | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/cpu/inorder/inorder_dyn_inst.hh b/src/cpu/inorder/inorder_dyn_inst.hh index 8e88fc583..143d10783 100644 --- a/src/cpu/inorder/inorder_dyn_inst.hh +++ b/src/cpu/inorder/inorder_dyn_inst.hh @@ -226,14 +226,27 @@ class InOrderDynInst : public FastAlloc, public RefCounted /** An instruction src/dest has to be one of these types */ union InstValue { uint64_t integer; - float fp; double dbl; }; + //@TODO: Naming Convention for Enums? + enum ResultType { + None, + Integer, + Float, + Double + }; + + /** Result of an instruction execution */ struct InstResult { + ResultType type; InstValue val; Tick tick; + + InstResult() + : type(None), tick(0) + {} }; /** The source of the instruction; assumes for now that there's only one @@ -315,6 +328,9 @@ class InOrderDynInst : public FastAlloc, public RefCounted // BASE INSTRUCTION INFORMATION. // //////////////////////////////////////////////////////////// + std::string instName() { return staticInst->getName(); } + + void setMachInst(ExtMachInst inst); /** Sets the StaticInst. */ @@ -827,9 +843,31 @@ class InOrderDynInst : public FastAlloc, public RefCounted MiscReg readMiscRegOperandNoEffect(const StaticInst *si, int idx); /** Returns the result value instruction. */ - uint64_t readIntResult(int idx) { return instResult[idx].val.integer; } - float readFloatResult(int idx) { return instResult[idx].val.fp; } - double readDoubleResult(int idx) { return instResult[idx].val.dbl; } + ResultType resultType(int idx) + { + return instResult[idx].type; + } + + uint64_t readIntResult(int idx) + { + return instResult[idx].val.integer; + } + + /** Depending on type, return Float or Double */ + double readFloatResult(int idx) + { + //assert(instResult[idx].type != Integer && instResult[idx].type != None); + //@todo: TypeCast FLOAT onto DOUBLE instead of separate value + return (instResult[idx].type == Float) ? + (float) instResult[idx].val.dbl : instResult[idx].val.dbl; + } + + double readDoubleResult(int idx) + { + assert(instResult[idx].type == Double); + return instResult[idx].val.dbl; + } + Tick readResultTime(int idx) { return instResult[idx].tick; } uint64_t* getIntResultPtr(int idx) { return &instResult[idx].val.integer; } |