@@ -78,27 +78,35 @@ struct BranchInfo
7878{
7979 Addr pc;
8080 Addr target;
81+ // An independent resolved bit to indicate whether CFI is resolved
82+ // or not for TAGE training, which is trained in resolve stage so
83+ // it's necessary to know whether the branch is resolved and skip
84+ // the BTB entry or not.
85+ bool resolved;
8186 bool isCond;
8287 bool isIndirect;
8388 bool isCall;
8489 bool isReturn;
8590 uint8_t size;
8691 bool isUncond () const { return !this ->isCond ; }
8792 Addr getEnd () { return this ->pc + this ->size ; }
88- BranchInfo () : pc(0 ), target(0 ), isCond(false ), isIndirect(false ), isCall(false ), isReturn(false ), size(0 ) {}
93+ BranchInfo ()
94+ : pc(0 ), target(0 ), resolved(false ), isCond(false ), isIndirect(false ), isCall(false ), isReturn(false ), size(0 )
95+ {
96+ }
8997 // BranchInfo(const Addr &pc, const Addr &target_pc, bool is_cond) :
9098 // pc(pc), target(target_pc), isCond(is_cond), isIndirect(false), isCall(false), isReturn(false), size(0) {}
91- BranchInfo (const Addr &control_pc,
92- const Addr &target_pc ,
93- const StaticInstPtr &static_inst ,
94- unsigned size) :
95- pc (control_pc ),
96- target (target_pc ),
97- isCond (static_inst->isCondCtrl ()),
98- isIndirect (static_inst->isIndirectCtrl ()),
99- isCall(static_inst-> isCall ()),
100- isReturn(static_inst-> isReturn () && !static_inst->isNonSpeculative() && !static_inst->isDirectCtrl()),
101- size(size) { }
99+ BranchInfo (const Addr &control_pc, const Addr &target_pc, const StaticInstPtr &static_inst, unsigned size)
100+ : pc(control_pc) ,
101+ target (target_pc) ,
102+ resolved( false ),
103+ isCond(static_inst-> isCondCtrl () ),
104+ isIndirect(static_inst-> isIndirectCtrl () ),
105+ isCall (static_inst->isCall ()),
106+ isReturn (static_inst->isReturn () && !static_inst->isNonSpeculative() && !static_inst->isDirectCtrl ()),
107+ size(size)
108+ {
109+ }
102110 int getType () const {
103111 if (isCond) {
104112 return BR_COND;
@@ -165,16 +173,11 @@ struct BTBEntry : BranchInfo
165173{
166174 bool valid;
167175 bool alwaysTaken;
168- // An independent resolved bit to indicate whether CFI is resolved
169- // or not for TAGE training, which is trained in resolve stage so
170- // it's necessary to know whether the branch is resolved and skip
171- // the BTB entry or not.
172- bool resolved;
173176 int ctr;
174177 Addr tag;
175178 // Addr offset; // retrived from lowest bits of pc
176- BTBEntry () : valid(false ), alwaysTaken(false ), resolved( false ), ctr(0 ), tag(0 ) {}
177- BTBEntry (const BranchInfo &bi) : BranchInfo(bi), valid(true ), alwaysTaken(true ), resolved( false ), ctr(0 ) {}
179+ BTBEntry () : valid(false ), alwaysTaken(false ), ctr(0 ), tag(0 ) {}
180+ BTBEntry (const BranchInfo &bi) : BranchInfo(bi), valid(true ), alwaysTaken(true ), ctr(0 ) {}
178181 BranchInfo getBranchInfo () { return BranchInfo (*this ); }
179182};
180183
0 commit comments