branch.isa (4004:d551cf1bba0d) branch.isa (4253:65a2461fcfc2)
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 26 unchanged lines hidden (view full) ---

35output header {{
36 /**
37 * Base class for branch operations.
38 */
39 class Branch : public SparcStaticInst
40 {
41 protected:
42 // Constructor
1// Copyright (c) 2006-2007 The Regents of The University of Michigan
2// All rights reserved.
3//
4// Redistribution and use in source and binary forms, with or without
5// modification, are permitted provided that the following conditions are
6// met: redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer;
8// redistributions in binary form must reproduce the above copyright

--- 26 unchanged lines hidden (view full) ---

35output header {{
36 /**
37 * Base class for branch operations.
38 */
39 class Branch : public SparcStaticInst
40 {
41 protected:
42 // Constructor
43 Branch(const char *mnem, MachInst _machInst, OpClass __opClass) :
43 Branch(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
44 SparcStaticInst(mnem, _machInst, __opClass)
45 {
46 }
47
48 std::string generateDisassembly(Addr pc,
49 const SymbolTable *symtab) const;
50 };
51
52 /**
53 * Base class for branch operations with an immediate displacement.
54 */
55 class BranchDisp : public Branch
56 {
57 protected:
58 // Constructor
44 SparcStaticInst(mnem, _machInst, __opClass)
45 {
46 }
47
48 std::string generateDisassembly(Addr pc,
49 const SymbolTable *symtab) const;
50 };
51
52 /**
53 * Base class for branch operations with an immediate displacement.
54 */
55 class BranchDisp : public Branch
56 {
57 protected:
58 // Constructor
59 BranchDisp(const char *mnem, MachInst _machInst,
59 BranchDisp(const char *mnem, ExtMachInst _machInst,
60 OpClass __opClass) :
61 Branch(mnem, _machInst, __opClass)
62 {
63 }
64
65 std::string generateDisassembly(Addr pc,
66 const SymbolTable *symtab) const;
67
68 int32_t disp;
69 };
70
71 /**
72 * Base class for branches with n bit displacements.
73 */
74 template<int bits>
75 class BranchNBits : public BranchDisp
76 {
77 protected:
78 // Constructor
60 OpClass __opClass) :
61 Branch(mnem, _machInst, __opClass)
62 {
63 }
64
65 std::string generateDisassembly(Addr pc,
66 const SymbolTable *symtab) const;
67
68 int32_t disp;
69 };
70
71 /**
72 * Base class for branches with n bit displacements.
73 */
74 template<int bits>
75 class BranchNBits : public BranchDisp
76 {
77 protected:
78 // Constructor
79 BranchNBits(const char *mnem, MachInst _machInst,
79 BranchNBits(const char *mnem, ExtMachInst _machInst,
80 OpClass __opClass) :
81 BranchDisp(mnem, _machInst, __opClass)
82 {
83 disp = sext<bits + 2>((_machInst & mask(bits)) << 2);
84 }
85 };
86
87 /**
88 * Base class for 16bit split displacements.
89 */
90 class BranchSplit : public BranchDisp
91 {
92 protected:
93 // Constructor
80 OpClass __opClass) :
81 BranchDisp(mnem, _machInst, __opClass)
82 {
83 disp = sext<bits + 2>((_machInst & mask(bits)) << 2);
84 }
85 };
86
87 /**
88 * Base class for 16bit split displacements.
89 */
90 class BranchSplit : public BranchDisp
91 {
92 protected:
93 // Constructor
94 BranchSplit(const char *mnem, MachInst _machInst,
94 BranchSplit(const char *mnem, ExtMachInst _machInst,
95 OpClass __opClass) :
96 BranchDisp(mnem, _machInst, __opClass)
97 {
98 disp = sext<18>((D16HI << 16) | (D16LO << 2));
99 }
100 };
101
102 /**
103 * Base class for branches that use an immediate and a register to
104 * compute their displacements.
105 */
106 class BranchImm13 : public Branch
107 {
108 protected:
109 // Constructor
95 OpClass __opClass) :
96 BranchDisp(mnem, _machInst, __opClass)
97 {
98 disp = sext<18>((D16HI << 16) | (D16LO << 2));
99 }
100 };
101
102 /**
103 * Base class for branches that use an immediate and a register to
104 * compute their displacements.
105 */
106 class BranchImm13 : public Branch
107 {
108 protected:
109 // Constructor
110 BranchImm13(const char *mnem, MachInst _machInst, OpClass __opClass) :
110 BranchImm13(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
111 Branch(mnem, _machInst, __opClass), imm(sext<13>(SIMM13))
112 {
113 }
114
115 std::string generateDisassembly(Addr pc,
116 const SymbolTable *symtab) const;
117
118 int32_t imm;

--- 152 unchanged lines hidden ---
111 Branch(mnem, _machInst, __opClass), imm(sext<13>(SIMM13))
112 {
113 }
114
115 std::string generateDisassembly(Addr pc,
116 const SymbolTable *symtab) const;
117
118 int32_t imm;

--- 152 unchanged lines hidden ---