@@ -1081,14 +1081,11 @@ bool EmulateInstructionMIPS::EvaluateInstruction(uint32_t evaluate_options) {
1081
1081
* mc_insn.getOpcode() returns decoded opcode. However to make use
1082
1082
* of llvm::Mips::<insn> we would need "MipsGenInstrInfo.inc".
1083
1083
*/
1084
- llvm::StringRef op_name_ref = m_insn_info->getName (mc_insn.getOpcode ());
1084
+ const char *op_name = m_insn_info->getName (mc_insn.getOpcode ()). data ( );
1085
1085
1086
- if (op_name_ref. empty () )
1086
+ if (op_name == nullptr )
1087
1087
return false ;
1088
1088
1089
- std::string op_name_str = op_name_ref;
1090
- const char *op_name = op_name_str.c_str ();
1091
-
1092
1089
/*
1093
1090
* Decoding has been done already. Just get the call-back function
1094
1091
* and emulate the instruction.
@@ -1351,10 +1348,7 @@ bool EmulateInstructionMIPS::Emulate_SUBU_ADDU(llvm::MCInst &insn) {
1351
1348
bool success = false ;
1352
1349
uint64_t result;
1353
1350
uint8_t src, dst, rt;
1354
-
1355
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
1356
- std::string op_name_str = op_name_ref;
1357
- const char *op_name = op_name_str.c_str ();
1351
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
1358
1352
1359
1353
dst = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
1360
1354
src = m_reg_info->getEncodingValue (insn.getOperand (1 ).getReg ());
@@ -1806,9 +1800,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops(llvm::MCInst &insn) {
1806
1800
bool success = false ;
1807
1801
uint32_t rs, rt;
1808
1802
int32_t offset, pc, target = 0 , rs_val, rt_val;
1809
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
1810
- std::string op_name_str = op_name_ref;
1811
- const char *op_name = op_name_str.c_str ();
1803
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
1812
1804
1813
1805
rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
1814
1806
rt = m_reg_info->getEncodingValue (insn.getOperand (1 ).getReg ());
@@ -1857,11 +1849,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_3ops_C(llvm::MCInst &insn) {
1857
1849
bool success = false ;
1858
1850
uint32_t rs, rt;
1859
1851
int32_t offset, pc, target = 0 , rs_val, rt_val;
1860
-
1861
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
1862
- std::string op_name_str = op_name_ref;
1863
- const char *op_name = op_name_str.c_str ();
1864
-
1852
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
1865
1853
uint32_t current_inst_size = m_insn_info->get (insn.getOpcode ()).getSize ();
1866
1854
1867
1855
rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
@@ -1941,9 +1929,7 @@ bool EmulateInstructionMIPS::Emulate_Bcond_Link_C(llvm::MCInst &insn) {
1941
1929
uint32_t rs;
1942
1930
int32_t offset, pc, target = 0 ;
1943
1931
int32_t rs_val;
1944
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
1945
- std::string op_name_str = op_name_ref;
1946
- const char *op_name = op_name_str.c_str ();
1932
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
1947
1933
1948
1934
rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
1949
1935
offset = insn.getOperand (1 ).getImm ();
@@ -2012,9 +1998,7 @@ bool EmulateInstructionMIPS::Emulate_Bcond_Link(llvm::MCInst &insn) {
2012
1998
uint32_t rs;
2013
1999
int32_t offset, pc, target = 0 ;
2014
2000
int32_t rs_val;
2015
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2016
- std::string op_name_str = op_name_ref;
2017
- const char *op_name = op_name_str.c_str ();
2001
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2018
2002
2019
2003
rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
2020
2004
offset = insn.getOperand (1 ).getImm ();
@@ -2064,9 +2048,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops(llvm::MCInst &insn) {
2064
2048
uint32_t rs;
2065
2049
int32_t offset, pc, target = 0 ;
2066
2050
int32_t rs_val;
2067
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2068
- std::string op_name_str = op_name_ref;
2069
- const char *op_name = op_name_str.c_str ();
2051
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2070
2052
2071
2053
rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
2072
2054
offset = insn.getOperand (1 ).getImm ();
@@ -2119,9 +2101,7 @@ bool EmulateInstructionMIPS::Emulate_BXX_2ops_C(llvm::MCInst &insn) {
2119
2101
uint32_t rs;
2120
2102
int32_t offset, pc, target = 0 ;
2121
2103
int32_t rs_val;
2122
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2123
- std::string op_name_str = op_name_ref;
2124
- const char *op_name = op_name_str.c_str ();
2104
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2125
2105
uint32_t current_inst_size = m_insn_info->get (insn.getOpcode ()).getSize ();
2126
2106
2127
2107
rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
@@ -2207,9 +2187,7 @@ bool EmulateInstructionMIPS::Emulate_Branch_MM(llvm::MCInst &insn) {
2207
2187
bool success = false ;
2208
2188
int32_t target = 0 ;
2209
2189
uint32_t current_inst_size = m_insn_info->get (insn.getOpcode ()).getSize ();
2210
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2211
- std::string op_name_str = op_name_ref;
2212
- const char *op_name = op_name_str.c_str ();
2190
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2213
2191
bool update_ra = false ;
2214
2192
uint32_t ra_offset = 0 ;
2215
2193
@@ -2309,9 +2287,7 @@ bool EmulateInstructionMIPS::Emulate_Branch_MM(llvm::MCInst &insn) {
2309
2287
bool EmulateInstructionMIPS::Emulate_JALRx16_MM (llvm::MCInst &insn) {
2310
2288
bool success = false ;
2311
2289
uint32_t ra_offset = 0 ;
2312
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2313
- std::string op_name_str = op_name_ref;
2314
- const char *op_name = op_name_str.c_str ();
2290
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2315
2291
2316
2292
uint32_t rs = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
2317
2293
@@ -2350,9 +2326,7 @@ bool EmulateInstructionMIPS::Emulate_JALRx16_MM(llvm::MCInst &insn) {
2350
2326
bool EmulateInstructionMIPS::Emulate_JALx (llvm::MCInst &insn) {
2351
2327
bool success = false ;
2352
2328
uint32_t offset = 0 , target = 0 , pc = 0 , ra_offset = 0 ;
2353
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2354
- std::string op_name_str = op_name_ref;
2355
- const char *op_name = op_name_str.c_str ();
2329
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2356
2330
2357
2331
/*
2358
2332
* JALS target
@@ -2700,9 +2674,7 @@ bool EmulateInstructionMIPS::Emulate_FP_branch(llvm::MCInst &insn) {
2700
2674
bool success = false ;
2701
2675
uint32_t cc, fcsr;
2702
2676
int32_t pc, offset, target = 0 ;
2703
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2704
- std::string op_name_str = op_name_ref;
2705
- const char *op_name = op_name_str.c_str ();
2677
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2706
2678
2707
2679
cc = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
2708
2680
offset = insn.getOperand (1 ).getImm ();
@@ -2818,9 +2790,7 @@ bool EmulateInstructionMIPS::Emulate_3D_branch(llvm::MCInst &insn) {
2818
2790
bool success = false ;
2819
2791
uint32_t cc, fcsr;
2820
2792
int32_t pc, offset, target = 0 ;
2821
- llvm::StringRef op_name_ref = m_insn_info->getName (insn.getOpcode ());
2822
- std::string op_name_str = op_name_ref;
2823
- const char *op_name = op_name_str.c_str ();
2793
+ const char *op_name = m_insn_info->getName (insn.getOpcode ()).data ();
2824
2794
2825
2795
cc = m_reg_info->getEncodingValue (insn.getOperand (0 ).getReg ());
2826
2796
offset = insn.getOperand (1 ).getImm ();
0 commit comments