[go: up one dir, main page]

CN104915180B - A kind of method and apparatus of data manipulation - Google Patents

A kind of method and apparatus of data manipulation Download PDF

Info

Publication number
CN104915180B
CN104915180B CN201410085731.0A CN201410085731A CN104915180B CN 104915180 B CN104915180 B CN 104915180B CN 201410085731 A CN201410085731 A CN 201410085731A CN 104915180 B CN104915180 B CN 104915180B
Authority
CN
China
Prior art keywords
operation instruction
instruction
critical
memory controller
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410085731.0A
Other languages
Chinese (zh)
Other versions
CN104915180A (en
Inventor
崔晓松
张广飞
张柳航
侯锐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
Original Assignee
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd, Institute of Computing Technology of CAS filed Critical Huawei Technologies Co Ltd
Priority to CN201410085731.0A priority Critical patent/CN104915180B/en
Publication of CN104915180A publication Critical patent/CN104915180A/en
Application granted granted Critical
Publication of CN104915180B publication Critical patent/CN104915180B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The embodiment of the present invention provides a kind of method and apparatus of data manipulation, is related to the communications field, can accurately judge whether data read command is key instruction, improves the speed that processor reads data in internal memory, and it is too high to avoid hardware cost.This method includes:It is key to determine that the first operational order has in compiler, and after first operational order is changed into the second operational order, Memory Controller Hub receives second operational order, key instruction that the Memory Controller Hub carries according to second operational order mark determines that second operational order is key instruction, and according to preference strategy in internal memory to should the data of the second operational order operate.The embodiment of the present invention is used for the operation to internal storage data.

Description

一种数据操作的方法和设备A method and device for data manipulation

技术领域technical field

本发明涉及通信领域,尤其涉及一种数据操作的方法和设备。The present invention relates to the communication field, in particular to a data operation method and device.

背景技术Background technique

现有的处理器访问内存的系统中,该处理器对应至少一级缓存,则该处理器在发出数据读取指令时,首先在缓存中进行查询,若在每一级缓存中都找不到该数据读取指令对应的数据时,该数据读取指令会被传递到内存控制器中,由内存控制器进行指令调度,最终通过访问内存的方式读取该数据读取指令对应的数据。In an existing system in which a processor accesses memory, the processor corresponds to at least one level of cache, and when the processor issues a data read command, it first queries the cache, and if no data is found in each level of cache When the data corresponding to the data read instruction is transmitted, the data read instruction will be transmitted to the memory controller, and the memory controller will schedule the instruction, and finally read the data corresponding to the data read instruction by accessing the memory.

由于在内存中读取数据的延迟时间较长,若该数据读取指令为关键性指令,也就是说,后续的多条指令的执行都依赖于该数据读取指令,则降低了该处理器对整个进程的处理速率,因此,为了解决这一问题,现有技术中通过增加检测模块和预测模块来判断该数据读取指令是否为关键性指令,则该内存控制器优先对确定为关键性指令的数据读取指令进行处理,减少了该处理器在内存中读取数据的延迟时间。其中,该检测模块用于,在指令提交队列中检测到延迟较长的数据读取指令时,通知该预测模块对该数据读取指令进行查询和预测;该预测模块用于,根据保存的历史信息对该数据读取指令进行查询和预测。Due to the long delay time of reading data in the memory, if the data reading instruction is a key instruction, that is to say, the execution of subsequent multiple instructions depends on the data reading instruction, the processor will be reduced. The processing rate of the entire process, therefore, in order to solve this problem, in the prior art, it is judged whether the data reading instruction is a critical instruction by adding a detection module and a prediction module, and the memory controller first determines that it is a critical instruction The data read instruction of the instruction is processed, reducing the delay time of the processor to read the data in the memory. Wherein, the detection module is used to notify the prediction module to query and predict the data read instruction when detecting a long-delayed data read instruction in the instruction submission queue; the prediction module is used to, according to the saved history The information queries and predicts the data read instruction.

但是,该检测模块和该预测模块增加了硬件的成本,并且,该预测模块根据历史信息来预测该数据读取指令是否为关键性指令存在较大的误差。However, the detection module and the prediction module increase the cost of hardware, and the prediction module predicts whether the data reading instruction is a critical instruction based on historical information, and there is a large error.

发明内容Contents of the invention

本发明提供一种数据操作的方法和设备,能够准确的判断数据读取指令是否为关键性指令,提高处理器在内存中读取数据的速率,并且避免了硬件成本过高。The invention provides a method and device for data operation, which can accurately judge whether a data reading instruction is a key instruction, improve the speed at which a processor reads data in a memory, and avoid high hardware costs.

为达到上述目的,本发明采用如下技术方案:To achieve the above object, the present invention adopts the following technical solutions:

第一方面提供一种数据操作的方法,包括:The first aspect provides a data manipulation method, including:

在编译器确定第一操作指令具有关键性,并将所述第一操作指令更改为第二操作指令后,内存控制器接收所述第二操作指令;所述第二操作指令携带关键指令标识;After the compiler determines that the first operation instruction is critical and changes the first operation instruction to a second operation instruction, the memory controller receives the second operation instruction; the second operation instruction carries a key instruction identifier;

所述内存控制器根据所述关键指令标识确定所述第二操作指令为关键性指令;The memory controller determines that the second operation instruction is a critical instruction according to the critical instruction identifier;

根据优先策略对内存中对应所述第二操作指令的数据进行操作。Operate the data corresponding to the second operation instruction in the memory according to the priority strategy.

在第一方面的第一种可能的实现方式中,若所述第一操作指令为数据读取指令,则所述内存控制器接收所述第二操作指令包括:In a first possible implementation manner of the first aspect, if the first operation instruction is a data read instruction, receiving the second operation instruction by the memory controller includes:

在处理器未在缓存中找到对应所述第一操作指令的数据时,接收所述处理器发送的所述第一操作指令;receiving the first operation instruction sent by the processor when the processor does not find data corresponding to the first operation instruction in the cache;

结合第一方面或第一种可能的实现方式,在第二种可能的实现方式中,若所述内存控制器中待调用的操作指令不是关键性指令,则所述根据优先策略对内存中对应所述第二操作指令的数据进行操作包括:With reference to the first aspect or the first possible implementation, in the second possible implementation, if the operation instruction to be invoked in the memory controller is not a critical instruction, the corresponding The data operation of the second operation instruction includes:

优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作。The second operation instruction is preferentially invoked to operate on data corresponding to the second operation instruction in the memory.

结合第二种可能的实现方式,在第三种可能的实现方式中,在所述优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作之前,所述方法还包括:With reference to the second possible implementation manner, in a third possible implementation manner, before the preferentially calling the second operation instruction to operate on the data corresponding to the second operation instruction in the memory, the method further include:

根据所述第二操作指令的操作数与所述内存控制器中待调用的操作指令的操作数确定所述内存控制器中待调用的操作指令与所述第二操作指令不存在序的关系。According to the operand of the second operation instruction and the operand of the operation instruction to be called in the memory controller, it is determined that there is no order relationship between the operation instruction to be called in the memory controller and the second operation instruction.

第二方面提供一种数据操作的方法,包括:The second aspect provides a data manipulation method, including:

编译器对源代码进行编译得到目标代码;The compiler compiles the source code to obtain the object code;

确定所述目标代码中的第一操作指令是否具有关键性;determining whether a first operation instruction in the object code is critical;

在确定所述第一操作指令具有关键性时,将所述第一操作指令更改为第二操作指令,其中,所述第二操作指令携带关键指令标识,以便内存控制器在接收到所述第二操作指令时,根据所述关键指令标识确定所述第二操作指令为关键性指令,并根据优先策略对内存中对应所述第二操作指令的数据进行操作。When determining that the first operation instruction is critical, changing the first operation instruction to a second operation instruction, wherein the second operation instruction carries a key instruction identifier, so that the memory controller receives the first operation instruction When the second operation instruction is used, the second operation instruction is determined to be a critical instruction according to the key instruction identifier, and the data corresponding to the second operation instruction in the memory is operated according to a priority policy.

在第二方面的第一种可能的实现方式中,所述确定所述目标代码中的第一操作指令是否具有关键性包括:In a first possible implementation manner of the second aspect, the determining whether the first operation instruction in the target code is critical includes:

在所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,确定所述第一操作指令具有关键性。When the operand of the first operation instruction and the operand of the operation instruction subsequent to the first operation instruction meet a preset condition, it is determined that the first operation instruction is critical.

第三方面提供一种内存控制器,包括:A third aspect provides a memory controller, including:

接收单元,用于在编译器确定第一操作指令具有关键性,并将所述第一操作指令更改为第二操作指令后,接收所述第二操作指令;所述第二操作指令携带关键指令标识;A receiving unit, configured to receive the second operation instruction after the compiler determines that the first operation instruction is critical and changes the first operation instruction to a second operation instruction; the second operation instruction carries a key instruction logo;

确定单元,用于根据所述关键指令标识确定所述第二操作指令为关键性指令;A determining unit, configured to determine, according to the key instruction identifier, that the second operation instruction is a key instruction;

处理单元,用于根据优先策略对内存中对应所述第二操作指令的数据进行操作。The processing unit is configured to operate the data corresponding to the second operation instruction in the memory according to the priority policy.

在第三方面的第一种可能的实现方式中,所述接收单元具体用于:若所述第一操作指令为数据读取指令,在处理器未在缓存中找到对应所述第一操作指令的数据时,接收所述处理器发送的所述第一操作指令;In a first possible implementation manner of the third aspect, the receiving unit is specifically configured to: if the first operation instruction is a data read instruction, if the processor does not find the corresponding first operation instruction in the cache When receiving the first operation instruction sent by the processor;

结合第三方面或第一种可能的实现方式,在第二种可能的实现方式中,所述处理单元具体用于:若所述内存控制器中待调用的操作指令不是关键性指令,优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作。In combination with the third aspect or the first possible implementation manner, in the second possible implementation manner, the processing unit is specifically configured to: if the operation instruction to be called in the memory controller is not a critical instruction, preferentially call The second operation instruction operates on data corresponding to the second operation instruction in the memory.

结合第二种可能的实现方式,在第三种可能的实现方式中,所述处理单元具体用于:在优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作之前,根据所述第二操作指令的操作数与所述内存控制器中待调用的操作指令的操作数确定所述内存控制器中待调用的操作指令与所述第二操作指令不存在序的关系。With reference to the second possible implementation manner, in a third possible implementation manner, the processing unit is specifically configured to: perform an operation on the data corresponding to the second operation instruction in the memory after preferentially calling the second operation instruction Before, according to the operand of the second operation instruction and the operand of the operation instruction to be called in the memory controller, it is determined that the order of the operation instruction to be called in the memory controller and the second operation instruction does not exist relation.

第四方面提供一种编译器,包括:A fourth aspect provides a compiler, including:

处理单元,用于对源代码进行编译得到目标代码;a processing unit, configured to compile the source code to obtain the object code;

确定单元,用于确定所述目标代码中的第一操作指令是否具有关键性;a determining unit, configured to determine whether the first operation instruction in the target code is critical;

所述处理单元还用于,在确定所述第一操作指令具有关键性时,将所述第一操作指令更改为第二操作指令,其中,所述第二操作指令携带关键指令标识,以便内存控制器在接收到所述第二操作指令时,根据所述关键指令标识确定所述第二操作指令为关键性指令,并根据优先策略对内存中对应所述第二操作指令的数据进行操作。The processing unit is further configured to, when determining that the first operation instruction is critical, change the first operation instruction into a second operation instruction, wherein the second operation instruction carries a key instruction identifier, so that the memory When the controller receives the second operation instruction, it determines that the second operation instruction is a critical instruction according to the key instruction identifier, and operates the data corresponding to the second operation instruction in the memory according to a priority policy.

在第四方面的第一种可能的实现方式中,所述确定单元具体用于:In a first possible implementation manner of the fourth aspect, the determining unit is specifically configured to:

在所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,确定所述第一操作指令具有关键性。When the operand of the first operation instruction and the operand of the operation instruction subsequent to the first operation instruction meet a preset condition, it is determined that the first operation instruction is critical.

采用上述方案,在编译器确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令后,内存控制器接收该第二操作指令,该内存控制器根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,并根据优先策略对内存中对应该第二操作指令的数据进行操作。这样,若该内存控制器接收到数据读取指令,能够根据该数据读取指令是否携带关键指令标识确定该数据读取指令是否为关键性指令,并优先调用该数据读取指令在内存中读取对应的数据,能够准确的判断数据读取指令是否为关键性指令,提高处理器在内存中读取数据的速率,并且避免了查询和预测带来的硬件成本过高的问题。With the above solution, after the compiler determines that the first operation instruction is critical and changes the first operation instruction to the second operation instruction, the memory controller receives the second operation instruction, and the memory controller receives the second operation instruction according to the second operation instruction. The key instruction identification carried by the instruction determines that the second operation instruction is a key instruction, and the data corresponding to the second operation instruction in the memory is operated according to the priority strategy. In this way, if the memory controller receives a data read instruction, it can determine whether the data read instruction is a critical instruction according to whether the data read instruction carries a key instruction identifier, and preferentially calls the data read instruction to read in the memory. Fetching the corresponding data can accurately judge whether the data reading instruction is a key instruction, improve the speed at which the processor reads data in the memory, and avoid the problem of high hardware cost caused by query and prediction.

附图说明Description of drawings

图1为本发明实施例提供的一种处理器访问内存的系统的结构示意图;FIG. 1 is a schematic structural diagram of a system for accessing memory by a processor according to an embodiment of the present invention;

图2为本发明实施例提供的一种数据操作的方法的流程示意图;FIG. 2 is a schematic flowchart of a data manipulation method provided by an embodiment of the present invention;

图3为本发明实施例提供的一种内存控制器指令队列的示意图;FIG. 3 is a schematic diagram of a memory controller instruction queue provided by an embodiment of the present invention;

图4为本发明实施例提供的另一种数据操作的方法的流程示意图;FIG. 4 is a schematic flowchart of another data manipulation method provided by an embodiment of the present invention;

图5为本发明实施例提供的一种内存控制器的结构示意图;FIG. 5 is a schematic structural diagram of a memory controller provided by an embodiment of the present invention;

图6为本发明实施例提供的一种编译器的结构示意图;FIG. 6 is a schematic structural diagram of a compiler provided by an embodiment of the present invention;

图7为本发明实施例提供的另一种内存控制器的结构示意图;FIG. 7 is a schematic structural diagram of another memory controller provided by an embodiment of the present invention;

图8为本发明实施例提供的另一种编译器的结构示意图。FIG. 8 is a schematic structural diagram of another compiler provided by an embodiment of the present invention.

具体实施方式detailed description

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明以下实施例可以应用于处理器访问内存的系统,该系统如图1所示,包括:编译器、处理器、一级缓存、二级缓存、内存控制器和内存,其连接关系如图1所示,所述编译器,用于将源代码进行编译得到可执行程序;所述处理器,用于执行所述编译器得到的可执行程序;所述一级缓存,用于快速缓存数据;所述二级缓存,用于快速缓存数据;所述内存控制器是计算机系统内部控制内存并且通过内存控制器使内存与处理器之间交换数据的重要组成部分;所述内存,用于存储数据,其存储容量大于缓存,但读写访问速度小于缓存的读写速度。The following embodiments of the present invention can be applied to a system in which a processor accesses memory. The system is shown in FIG. 1, the compiler is used to compile the source code to obtain an executable program; the processor is used to execute the executable program obtained by the compiler; the first-level cache is used to quickly cache data ; The secondary cache is used to quickly cache data; the memory controller is an important part of the computer system to control the memory and exchange data between the memory and the processor through the memory controller; the memory is used to store Data whose storage capacity is greater than that of the cache, but whose read and write access speed is less than that of the cache.

本发明实施例提供一种数据操作的方法,如图2所示,包括:An embodiment of the present invention provides a method for data manipulation, as shown in FIG. 2 , including:

S201、在编译器确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令后,内存控制器接收该第二操作指令。S201. After the compiler determines that the first operation instruction is critical and changes the first operation instruction to a second operation instruction, the memory controller receives the second operation instruction.

其中,该第二操作指令携带关键指令标识。Wherein, the second operation instruction carries a key instruction identifier.

具体地,编译器对源代码进行编译得到目标代码,并对得到的目标代码进行检测,检测出具有关键性的第一操作指令,则该编译器将该第一操作指令更改为携带关键指令标识的第二操作指令。Specifically, the compiler compiles the source code to obtain the target code, and detects the obtained target code, and detects a critical first operation instruction, then the compiler changes the first operation instruction to carry the key instruction identifier The second operation instruction.

可选地,该编译器在该第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。Optionally, the compiler determines that the first operation instruction is critical when an operand of the first operation instruction and an operand of an operation instruction subsequent to the first operation instruction satisfy a preset condition.

示例地,源代码为:For example, the source code is:

……...

for(i=1;i<100;i++)for(i=1; i<100; i++)

a[i]=a[0]+i;a[i]=a[0]+i;

……...

该编译器编译得到目标代码:The compiler compiles the object code:

……...

LDR R2,[R1];LDR R2, [R1];

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3,R2,#99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

进一步地,该编译器在得到上述目标代码后,对该目标代码进行扫描,检测每条操作指令的操作数与该操作指令后续的操作指令的操作数的关系,在第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。例如,该预设条件为该第一操作指令中的操作数在后续操作指令的操作数中出现次数大于5,则在上述目标代码中,对于第一操作指令LDR R2,[R1],该第一操作指令表示将R1地址处的数据读出保存到寄存器R2中,该编译器通过对该第一操作指令后续的操作指令进行扫描可确定该第一操作指令中的操作数R2在后续指令中出现的次数大于5,则该编译器确定该第一操作指令具有关键性。Further, after the compiler obtains the above object code, it scans the object code to detect the relationship between the operand of each operation instruction and the operand of the operation instruction subsequent to the operation instruction, and the operand of the first operation instruction When an operand of an operation instruction following the first operation instruction satisfies a preset condition, it is determined that the first operation instruction is critical. For example, the preset condition is that the number of occurrences of the operand in the first operation instruction in the operands of the subsequent operation instruction is greater than 5, then in the above object code, for the first operation instruction LDR R2, [R1], the first operation instruction An operation instruction indicates that the data at the address of R1 is read and stored in the register R2, and the compiler can determine that the operand R2 in the first operation instruction is in the subsequent instruction by scanning the operation instructions subsequent to the first operation instruction. If the number of occurrences is greater than 5, the compiler determines that the first operation instruction is critical.

由源代码可知,执行循环得到数组a[1]到数组a[99]的值都使用到数组a[0]的值,也就是对应的目标代码中的寄存器R2中的值,因此,若该第一操作指令未成功执行,后续的操作指令都无法执行。It can be seen from the source code that the value of array a[1] to array a[99] obtained by executing the loop uses the value of array a[0], which is the value in register R2 in the corresponding target code. Therefore, if the If the first operation instruction is not successfully executed, subsequent operation instructions cannot be executed.

进一步地,该编译器在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令,如LDR_c R2,[R1],则更改后的目标代码为:Further, when the compiler determines that the first operation instruction is critical, it changes the first operation instruction into a second operation instruction, such as LDR_c R2, [R1], and the changed object code is:

……...

LDR_c R2,[R1]LDR_c R2, [R1]

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3,R2,#99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

需要说明的是,上述预设条件还可以为该第一操作指令中的操作数在后续操作指令的操作数中出现的频率大于N,N为大于零的正整数,即该编译器在扫描目标代码后,若确定该第一操作指令的操作数R2在后续操作指令中出现的频率大于N,则该编译器确定该第一操作指令具有关键性。It should be noted that the above preset condition can also be that the frequency of the operand in the first operation instruction appearing in the operand of the subsequent operation instruction is greater than N, and N is a positive integer greater than zero, that is, the compiler is scanning the target After the code, if it is determined that the operand R2 of the first operation instruction occurs more frequently than N in subsequent operation instructions, the compiler determines that the first operation instruction is critical.

可选地,若该第一操作指令为数据读取指令,则在处理器未在缓存中找到对应该第一操作指令的数据时,该内存控制器接收该处理器发送的该第一操作指令。Optionally, if the first operation instruction is a data read instruction, when the processor does not find the data corresponding to the first operation instruction in the cache, the memory controller receives the first operation instruction sent by the processor .

需要说明的是,该处理器支持该第二操作指令的存在,并且,该处理器在处理该第二操作指令时,和该第一操作指令的处理方式一样。即若该第一操作指令为数据读取指令,则该处理器在执行第二操作指令时,首先在缓存中查询对应该第二操作指令的数据,若缓存中存在对应该第二操作指令的数据,则该处理器读取该数据;若在每一级缓存中都找不到该第二操作指令对应的数据时,则将该第二操作指令指发送至内存控制器中。It should be noted that the processor supports the existence of the second operation instruction, and when the processor processes the second operation instruction, the processing manner is the same as that of the first operation instruction. That is, if the first operation instruction is a data read instruction, when the processor executes the second operation instruction, it first queries the data corresponding to the second operation instruction in the cache, and if there is a data corresponding to the second operation instruction in the cache data, the processor reads the data; if the data corresponding to the second operation instruction cannot be found in each level of cache, the second operation instruction is sent to the memory controller.

S202、该内存控制器根据该关键指令标识确定该第二操作指令为关键性指令。S202. The memory controller determines that the second operation instruction is a critical instruction according to the critical instruction identifier.

具体地,该内存控制器在接收到该第二操作指令时,根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,其中,该关键指令标识可以为该第二操作指令的操作码的名称,如上述LDR_c,也可以是该指令携带的其他标识信息,用于指示该第二操作指令的关键性。Specifically, when the memory controller receives the second operation instruction, it determines that the second operation instruction is a critical instruction according to the key instruction identification carried by the second operation instruction, wherein the key instruction identification can be the second The name of the operation code of the operation instruction, such as the above-mentioned LDR_c, may also be other identification information carried by the instruction, which is used to indicate the criticality of the second operation instruction.

S203、该内存控制器根据优先策略对内存中对应该第二操作指令的数据进行操作。S203. The memory controller operates the data corresponding to the second operation instruction in the memory according to the priority policy.

可选地,若该内存控制器中待调用的操作指令不是关键性指令,则该内存控制器优先调用该第二操作指令对内存中对应该第二操作指令的数据进行操作。Optionally, if the operation instruction to be invoked in the memory controller is not a critical instruction, the memory controller preferentially invokes the second operation instruction to operate on data corresponding to the second operation instruction in the memory.

可选地,在该优先调用该第二操作指令对内存中对应该第二操作指令的数据进行操作之前,该内存控制器根据该第二操作指令的操作数与该内存控制器中待调用的操作指令的操作数确定该内存控制器中待调用的操作指令与该第二操作指令不存在序的关系。Optionally, before the preferentially calling the second operation instruction to operate on the data corresponding to the second operation instruction in the memory, the memory controller according to the operand of the second operation instruction and the memory controller to be called The operand of the operation instruction determines that there is no order relationship between the operation instruction to be called in the memory controller and the second operation instruction.

需要说明的是,上述序的关系是指该内存控制器只能首先执行该待调用的操作指令,后执行该第二操作指令,例如:It should be noted that the relationship of the above sequence means that the memory controller can only execute the operation instruction to be called first, and then execute the second operation instruction, for example:

STR R1,R2STR R1, R2

LDR_c R3,R2LDR_c R3, R2

有上述代码可知,只能在执行STR R1,R2将寄存器R1中的数据写入寄存器R2中之后,才能执行LDR_c R3,R2从寄存器R2中的数据读如寄存器R3,因此该STR与该LDR_c存在序的关系。According to the above code, LDR_c R3 can only be executed after executing STR R1 and R2 to write the data in register R1 into register R2, and R2 reads the data in register R2 as register R3, so the STR and the LDR_c exist sequence relationship.

示例地,该优先策略为:若该内存控制器的指令队列中的待调用指令为关键性指令,则优先执行该待调用指令;若该内存控制器的指令队列中的待调用指令不是关键性指令且待调用指令与该第二操作指令存在序的关系,则优先执行该待调用指令;若该内存控制器的指令队列中的待调用指令不是关键性指令且待调用指令与该第二操作指令不存在序的关系,则优先执行该第二操作指令。Exemplarily, the priority policy is: if the instruction to be called in the instruction queue of the memory controller is a critical instruction, then execute the instruction to be called preferentially; if the instruction to be called in the instruction queue of the memory controller is not critical instruction and there is an order relationship between the instruction to be called and the second operation instruction, the instruction to be called is executed first; if the instruction to be called in the instruction queue of the memory controller is not a critical instruction and the instruction to be called is related to the second operation If there is no order relationship among the instructions, the second operation instruction is executed preferentially.

如图3所示,该内存控制器的指令队列中,包括操作指令LDR_c、STR、LDR和第二操作指令,则该内存控制器执行操作指令的顺序依次为LDR_c、STR、第二操作指令、LDR。其中,该LDR_c为关键性指令且与该第二操作指令不存在序的关系;该STR与该第二操作指令存在序的关系,例如,该第二操作指令为数据读取指令,且该第二操作指令的目的操作数和该STR对应的源操作数相同,也就是说,内存控制器在执行STR指令对某一地址进行写操作后,执行该第二操作指令读取同一地址的数据,因此该STR必须在该第二操作指令之前执行;该LDR不是关键性指令且与该第二操作指令不存在序的关系。As shown in FIG. 3 , the instruction queue of the memory controller includes operation instructions LDR_c, STR, LDR and the second operation instruction, and the order in which the memory controller executes the operation instructions is LDR_c, STR, the second operation instruction, LDR. Wherein, the LDR_c is a key instruction and does not have an order relationship with the second operation instruction; the STR has an order relationship with the second operation instruction, for example, the second operation instruction is a data read instruction, and the second operation instruction The destination operand of the second operation instruction is the same as the source operand corresponding to the STR, that is, after the memory controller executes the STR instruction to write to a certain address, it executes the second operation instruction to read the data at the same address, Therefore, the STR must be executed before the second operation instruction; the LDR is not a critical instruction and has no order relationship with the second operation instruction.

采用上述方法,在编译器确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令后,内存控制器接收该第二操作指令,该内存控制器根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,并根据优先策略对内存中对应该第二操作指令的数据进行操作。这样,若该内存控制器接收到数据读取指令,能够根据该数据读取指令是否携带关键指令标识确定该数据读取指令是否为关键性指令,并优先调用该数据读取指令在内存中读取对应的数据,能够准确的判断数据读取指令是否为关键性指令,提高处理器在内存中读取数据的速率,并且避免了查询和预测带来的硬件成本过高的问题。Using the above method, after the compiler determines that the first operation instruction is critical and changes the first operation instruction to the second operation instruction, the memory controller receives the second operation instruction, and the memory controller according to the second operation instruction The key instruction identification carried by the instruction determines that the second operation instruction is a key instruction, and the data corresponding to the second operation instruction in the memory is operated according to the priority policy. In this way, if the memory controller receives a data read instruction, it can determine whether the data read instruction is a critical instruction according to whether the data read instruction carries a key instruction identifier, and preferentially calls the data read instruction to read in the memory. Fetching the corresponding data can accurately judge whether the data reading instruction is a key instruction, improve the speed at which the processor reads data in the memory, and avoid the problem of high hardware cost caused by query and prediction.

本发明实施例提供一种数据操作的方法,如图4所示,包括:An embodiment of the present invention provides a data manipulation method, as shown in FIG. 4 , including:

S401、编译器对源代码进行编译得到目标代码。S401. The compiler compiles the source code to obtain the object code.

S402、该编译器确定该目标代码中的第一操作指令是否具有关键性。S402. The compiler determines whether the first operation instruction in the object code is critical.

可选地,该编译器在该第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。Optionally, the compiler determines that the first operation instruction is critical when an operand of the first operation instruction and an operand of an operation instruction subsequent to the first operation instruction satisfy a preset condition.

示例地,源代码为:For example, the source code is:

……...

for(i=1;i<100;i++)for(i=1; i<100; i++)

a[i]=a[0]+i;a[i]=a[0]+i;

……...

该编译器编译得到目标代码:The compiler compiles the object code:

……...

LDR R2,[R1];LDR R2, [R1];

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3,R2,#99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

进一步地,该编译器在得到上述目标代码后,对该目标代码进行扫描,检测每条操作指令的操作数与该操作指令后续的操作指令的操作数的关系,在第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。例如,该预设条件为该第一操作指令中的操作数在后续操作指令的操作数中出现次数大于5,则在上述目标代码中,对于第一操作指令LDR R2,[R1],该第一操作指令表示将R1地址处的数据读出保存到寄存器R2中,该编译器通过对该第一操作指令后续的操作指令进行扫描可确定该第一操作指令中的操作数R2在后续指令中出现的次数大于5,则该编译器确定该第一操作指令具有关键性。Further, after the compiler obtains the above object code, it scans the object code to detect the relationship between the operand of each operation instruction and the operand of the operation instruction subsequent to the operation instruction, and the operand of the first operation instruction When an operand of an operation instruction following the first operation instruction satisfies a preset condition, it is determined that the first operation instruction is critical. For example, the preset condition is that the number of occurrences of the operand in the first operation instruction in the operands of the subsequent operation instruction is greater than 5, then in the above object code, for the first operation instruction LDR R2, [R1], the first operation instruction An operation instruction indicates that the data at the address of R1 is read and stored in the register R2, and the compiler can determine that the operand R2 in the first operation instruction is in the subsequent instruction by scanning the operation instructions subsequent to the first operation instruction. If the number of occurrences is greater than 5, the compiler determines that the first operation instruction is critical.

由源代码可知,执行循环得到数组a[1]到数组a[99]的值都使用到数组a[0]的值,也就是对应的目标代码中的寄存器R2中的值,因此,若该第一操作指令未成功执行,后续的操作指令都无法执行。It can be seen from the source code that the value of array a[1] to array a[99] obtained by executing the loop uses the value of array a[0], which is the value in register R2 in the corresponding target code. Therefore, if the If the first operation instruction is not successfully executed, subsequent operation instructions cannot be executed.

需要说明的是,上述预设条件还可以为该第一操作指令中的操作数在后续操作指令的操作数中出现的频率大于N,N为大于零的正整数,即该编译器在扫描目标代码后,若确定该第一操作指令的操作数R2在后续操作指令中出现的频率大于N,则该编译器确定该第一操作指令具有关键性。It should be noted that the above preset condition can also be that the frequency of the operand in the first operation instruction appearing in the operand of the subsequent operation instruction is greater than N, and N is a positive integer greater than zero, that is, the compiler is scanning the target After the code, if it is determined that the operand R2 of the first operation instruction occurs more frequently than N in subsequent operation instructions, the compiler determines that the first operation instruction is critical.

S403、该编译器在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令。S403. When the compiler determines that the first operation instruction is critical, change the first operation instruction into a second operation instruction.

其中,该第二操作指令携带关键指令标识,以便内存控制器在接收到该第二操作指令时,根据该关键指令标识确定该第二操作指令为关键性指令,并根据优先策略通过该第二操作指令对内存中对应该第二操作指令的数据进行操作。Wherein, the second operation instruction carries a key instruction identification, so that when the memory controller receives the second operation instruction, it determines that the second operation instruction is a key instruction according to the key instruction identification, and passes the second operation instruction according to the priority policy. The operation instruction operates on the data corresponding to the second operation instruction in the memory.

示例地,该编译器在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令,如将该第一操作指令LDR R2,[R1]更改为第二操作指令LDR_c R2,[R1],则更改后的目标代码为:For example, when the compiler determines that the first operation instruction is critical, it changes the first operation instruction into a second operation instruction, such as changing the first operation instruction LDR R2, [R1] into a second operation instruction LDR_c R2, [R1], then the changed object code is:

……...

LDR_c R2,[R1]LDR_c R2, [R1]

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3, R2, #99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

可选地,若该第一操作指令为数据读取指令,则在处理器未在缓存中找到对应该第一操作指令的数据时,该内存控制器接收该处理器发送的该第一操作指令。Optionally, if the first operation instruction is a data read instruction, when the processor does not find the data corresponding to the first operation instruction in the cache, the memory controller receives the first operation instruction sent by the processor .

需要说明的是,该处理器支持该第二操作指令的存在,并且,该处理器在处理该第二操作指令时,和该第一操作指令的处理方式一样。即若该第一操作指令为数据读取指令,则该处理器在执行第二操作指令时,首先在缓存中查询对应该第二操作指令的数据,若缓存中存在对应该第二操作指令的数据,则该处理器读取该数据;若在每一级缓存中都找不到该第二操作指令对应的数据时,则将该第二操作指令指发送至内存控制器中。It should be noted that the processor supports the existence of the second operation instruction, and when the processor processes the second operation instruction, the processing manner is the same as that of the first operation instruction. That is, if the first operation instruction is a data read instruction, when the processor executes the second operation instruction, it first queries the data corresponding to the second operation instruction in the cache, and if there is a data corresponding to the second operation instruction in the cache data, the processor reads the data; if the data corresponding to the second operation instruction cannot be found in each level of cache, the second operation instruction is sent to the memory controller.

该内存控制器在接收到该第二操作指令时,根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,其中,该关键指令标识可以为该第二操作指令的操作码的名称,如上述LDR_c,也可以是该指令携带的其他标识信息,用于指示该第二操作指令的关键性。When the memory controller receives the second operation instruction, it determines that the second operation instruction is a critical instruction according to the key instruction identification carried by the second operation instruction, wherein the key instruction identification may be the key instruction of the second operation instruction. The name of the operation code, such as the above-mentioned LDR_c, may also be other identification information carried by the instruction, which is used to indicate the criticality of the second operation instruction.

采用上述方法,编译器在得到目标代码后,确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令,以便内存控制器在接收到该第二操作指令时,确定该第二操作指令为关键性指令,并根据优先策略对内存中对应该第二操作指令的数据进行操作。这样,若该内存控制器接收到数据读取指令,能够根据该数据读取指令是否携带关键指令标识确定该数据读取指令是否为关键性指令,并优先调用该数据读取指令在内存中读取对应的数据,能够准确的判断数据读取指令是否为关键性指令,提高处理器在内存中读取数据的速率,并且避免了查询和预测带来的硬件成本过高的问题。Using the above method, after the compiler obtains the target code, it determines that the first operation instruction is critical, and changes the first operation instruction into a second operation instruction, so that the memory controller can determine The second operation instruction is a critical instruction, and the data corresponding to the second operation instruction in the memory is operated according to the priority policy. In this way, if the memory controller receives a data read instruction, it can determine whether the data read instruction is a critical instruction according to whether the data read instruction carries a key instruction identifier, and preferentially calls the data read instruction to read in the memory. Fetching the corresponding data can accurately judge whether the data reading instruction is a key instruction, improve the speed at which the processor reads data in the memory, and avoid the problem of high hardware cost caused by query and prediction.

本发明实施例提供一种内存控制器50,如图5所示,包括:An embodiment of the present invention provides a memory controller 50, as shown in FIG. 5, including:

接收单元51,用于在编译器确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令后,接收该第二操作指令。The receiving unit 51 is configured to receive the second operation instruction after the compiler determines that the first operation instruction is critical and changes the first operation instruction into a second operation instruction.

其中,该第二操作指令携带关键指令标识。Wherein, the second operation instruction carries a key instruction identifier.

确定单元52,用于根据该关键指令标识确定该第二操作指令为关键性指令。The determining unit 52 is configured to determine, according to the key instruction identifier, that the second operation instruction is a key instruction.

处理单元53,用于根据优先策略对内存中对应该第二操作指令的数据进行操作。The processing unit 53 is configured to operate the data corresponding to the second operation instruction in the memory according to the priority policy.

具体地,编译器对源代码进行编译得到目标代码,并对得到的目标代码进行检测,检测出具有关键性的第一操作指令,则该编译器将该第一操作指令更改为携带关键指令标识的第二操作指令。Specifically, the compiler compiles the source code to obtain the target code, and detects the obtained target code, and detects a critical first operation instruction, then the compiler changes the first operation instruction to carry the key instruction identifier The second operation instruction.

可选地,该编译器在该第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。Optionally, the compiler determines that the first operation instruction is critical when an operand of the first operation instruction and an operand of an operation instruction subsequent to the first operation instruction satisfy a preset condition.

示例地,源代码为:For example, the source code is:

……...

for(i=1;i<100;i++)for(i=1; i<100; i++)

a[i]=a[0]+i;a[i]=a[0]+i;

……...

该编译器编译得到目标代码:The compiler compiles the object code:

……...

LDR R2,[R1];LDR R2, [R1];

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3, R2, #99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

进一步地,该编译器在得到上述目标代码后,对该目标代码进行扫描,检测每条操作指令的操作数与该操作指令后续的操作指令的操作数的关系,在第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。例如,该预设条件为该第一操作指令中的操作数在后续操作指令的操作数中出现次数大于5,则在上述目标代码中,对于第一操作指令LDR R2,[R1],该第一操作指令表示将R1地址处的数据读出保存到寄存器R2中,该编译器通过对该第一操作指令后续的操作指令进行扫描可确定该第一操作指令中的操作数R2在后续指令中出现的次数大于5,则该编译器确定该第一操作指令具有关键性。Further, after the compiler obtains the above object code, it scans the object code to detect the relationship between the operand of each operation instruction and the operand of the operation instruction subsequent to the operation instruction, and the operand of the first operation instruction When an operand of an operation instruction following the first operation instruction satisfies a preset condition, it is determined that the first operation instruction is critical. For example, the preset condition is that the number of occurrences of the operand in the first operation instruction in the operands of the subsequent operation instruction is greater than 5, then in the above object code, for the first operation instruction LDR R2, [R1], the first operation instruction An operation instruction indicates that the data at the address of R1 is read and stored in the register R2, and the compiler can determine that the operand R2 in the first operation instruction is in the subsequent instruction by scanning the operation instructions subsequent to the first operation instruction. If the number of occurrences is greater than 5, the compiler determines that the first operation instruction is critical.

由源代码可知,执行循环得到数组a[1]到数组a[99]的值都使用到数组a[0]的值,也就是对应的目标代码中的寄存器R2中的值,因此,若该第一操作指令未成功执行,后续的操作指令都无法执行。It can be seen from the source code that the value of array a[1] to array a[99] obtained by executing the loop uses the value of array a[0], which is the value in register R2 in the corresponding target code. Therefore, if the If the first operation instruction is not successfully executed, subsequent operation instructions cannot be executed.

进一步地,该编译器在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令,如LDR_c R2,[R1],则更改后的目标代码为:Further, when the compiler determines that the first operation instruction is critical, it changes the first operation instruction into a second operation instruction, such as LDR_c R2, [R1], and the changed object code is:

……...

LDR_c R2,[R1]LDR_c R2, [R1]

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3, R2, #99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

需要说明的是,上述预设条件还可以为该第一操作指令中的操作数在后续操作指令的操作数中出现的频率大于N,N为大于零的正整数,即该编译器在扫描目标代码后,若确定该第一操作指令的操作数R2在后续操作指令中出现的频率大于N,则该编译器确定该第一操作指令具有关键性。It should be noted that the above preset condition can also be that the frequency of the operand in the first operation instruction appearing in the operand of the subsequent operation instruction is greater than N, and N is a positive integer greater than zero, that is, the compiler is scanning the target After the code, if it is determined that the operand R2 of the first operation instruction occurs more frequently than N in subsequent operation instructions, the compiler determines that the first operation instruction is critical.

可选地,该接收单元51具体用于,若该第一操作指令为数据读取指令,在处理器未在缓存中找到对应该第一操作指令的数据时,接收该处理器发送的该第一操作指令。Optionally, the receiving unit 51 is specifically configured to, if the first operation instruction is a data read instruction, receive the second operation instruction sent by the processor when the processor does not find the data corresponding to the first operation instruction in the cache. an operation instruction.

需要说明的是,该处理器支持该第二操作指令的存在,并且,该处理器在处理该第二操作指令时,和该第一操作指令的处理方式一样。即若该第一操作指令为数据读取指令,则该处理器在执行第二操作指令时,首先在缓存中查询对应该第二操作指令的数据,若缓存中存在对应该第二操作指令的数据,则该处理器读取该数据;若在每一级缓存中都找不到该第二操作指令对应的数据时,则将该第二操作指令指发送至内存控制器中。It should be noted that the processor supports the existence of the second operation instruction, and when the processor processes the second operation instruction, the processing manner is the same as that of the first operation instruction. That is, if the first operation instruction is a data read instruction, when the processor executes the second operation instruction, it first queries the data corresponding to the second operation instruction in the cache, and if there is a data corresponding to the second operation instruction in the cache data, the processor reads the data; if the data corresponding to the second operation instruction cannot be found in each level of cache, the second operation instruction is sent to the memory controller.

进一步地,该内存控制器在接收到该第二操作指令时,根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,其中,该关键指令标识可以为该第二操作指令的操作码的名称,如上述LDR_c,也可以是该指令携带的其他标识信息,用于指示该第二操作指令的关键性。Further, when the memory controller receives the second operation instruction, it determines that the second operation instruction is a critical instruction according to the key instruction identification carried by the second operation instruction, wherein the key instruction identification can be the second The name of the operation code of the operation instruction, such as the above-mentioned LDR_c, may also be other identification information carried by the instruction, which is used to indicate the criticality of the second operation instruction.

可选地,该处理单元53具体用于,若该内存控制器中待调用的操作指令不是关键性指令,优先调用该第二操作指令对内存中对应该第二操作指令的数据进行操作。Optionally, the processing unit 53 is specifically configured to, if the operation instruction to be invoked in the memory controller is not a critical instruction, preferentially invoke the second operation instruction to operate on data corresponding to the second operation instruction in the memory.

可选地,该处理单元53还用于,在优先调用该第二操作指令对内存中对应该第二操作指令的数据进行操作之前,根据该第二操作指令的操作数与该内存控制器中待调用的操作指令的操作数确定该内存控制器中待调用的操作指令与该第二操作指令不存在序的关系。Optionally, the processing unit 53 is also configured to, before preferentially calling the second operation instruction to operate on the data in the memory corresponding to the second operation instruction, according to the operand of the second operation instruction and the memory controller The operand of the operation instruction to be called determines that there is no order relationship between the operation instruction to be called in the memory controller and the second operation instruction.

需要说明的是,上述序的关系是指该内存控制器只能首先执行该待调用的操作指令,后执行该第二操作指令,例如:It should be noted that the relationship of the above sequence means that the memory controller can only execute the operation instruction to be called first, and then execute the second operation instruction, for example:

STR R1,R2STR R1, R2

LDR_c R3,R2LDR_c R3, R2

有上述代码可知,只能在执行STR R1,R2将寄存器R1中的数据写入寄存器R2中之后,才能执行LDR_c R3,R2从寄存器R2中的数据读如寄存器R3,因此该STR与该LDR_c存在序的关系。According to the above code, LDR_c R3 can only be executed after executing STR R1 and R2 to write the data in register R1 into register R2, and R2 reads the data in register R2 as register R3, so the STR and the LDR_c exist sequence relationship.

示例地,该优先策略为:若该内存控制器的指令队列中的待调用指令为关键性指令,则优先执行该待调用指令;若该内存控制器的指令队列中的待调用指令不是关键性指令且待调用指令与该第二操作指令存在序的关系,则优先执行该待调用指令;若该内存控制器的指令队列中的待调用指令不是关键性指令且待调用指令与该第二操作指令不存在序的关系,则优先执行该第二操作指令。Exemplarily, the priority policy is: if the instruction to be called in the instruction queue of the memory controller is a critical instruction, then execute the instruction to be called preferentially; if the instruction to be called in the instruction queue of the memory controller is not critical instruction and there is an order relationship between the instruction to be called and the second operation instruction, the instruction to be called is executed first; if the instruction to be called in the instruction queue of the memory controller is not a critical instruction and the instruction to be called is related to the second operation If there is no order relationship among the instructions, the second operation instruction is executed preferentially.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional modules according to needs. The internal structure of the device is divided into different functional modules to complete all or part of the functions described above. For the specific working process of the units described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not repeated here.

采用上述内存控制器,在编译器确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令后,该内存控制器接收该第二操作指令,该内存控制器根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,并根据优先策略对内存中对应该第二操作指令的数据进行操作。这样,若该内存控制器接收到数据读取指令,能够根据该数据读取指令是否携带关键指令标识确定该数据读取指令是否为关键性指令,并优先调用该数据读取指令在内存中读取对应的数据,能够准确的判断数据读取指令是否为关键性指令,提高处理器在内存中读取数据的速率,并且避免了查询和预测带来的硬件成本过高的问题。With the above memory controller, after the compiler determines that the first operation instruction is critical and changes the first operation instruction into a second operation instruction, the memory controller receives the second operation instruction, and the memory controller according to the The key instruction identification carried by the second operation instruction determines that the second operation instruction is a key instruction, and the data corresponding to the second operation instruction in the memory is operated according to the priority strategy. In this way, if the memory controller receives a data read instruction, it can determine whether the data read instruction is a critical instruction according to whether the data read instruction carries a key instruction identifier, and preferentially calls the data read instruction to read in the memory. Fetching the corresponding data can accurately judge whether the data reading instruction is a key instruction, improve the speed at which the processor reads data in the memory, and avoid the problem of high hardware cost caused by query and prediction.

本发明实施例提供一种编译器60,如图6所示,包括:An embodiment of the present invention provides a compiler 60, as shown in FIG. 6, including:

处理单元61,用于对源代码进行编译得到目标代码。The processing unit 61 is configured to compile the source code to obtain the object code.

确定单元62,用于确定该目标代码中的第一操作指令是否具有关键性。The determining unit 62 is configured to determine whether the first operation instruction in the object code is critical.

该处理单元61还用于,在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令。The processing unit 61 is further configured to, when determining that the first operation instruction is critical, change the first operation instruction into a second operation instruction.

其中,该第二操作指令携带关键指令标识,以便内存控制器在接收到该第二操作指令时,根据该关键指令标识确定该第二操作指令为关键性指令,并根据优先策略对内存中对应该第二操作指令的数据进行操作。Wherein, the second operation instruction carries a key instruction identification, so that when the memory controller receives the second operation instruction, it determines that the second operation instruction is a key instruction according to the key instruction identification, and according to the priority policy, the pair in the memory The operation should be performed on the data of the second operation instruction.

可选地,该确定单元62具体用于,在该第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。Optionally, the determining unit 62 is specifically configured to determine that the first operation instruction is critical when the operand of the first operation instruction and the operand of a subsequent operation instruction of the first operation instruction meet a preset condition.

示例地,源代码为:For example, the source code is:

……...

for(i=1;i<100;i++)for(i=1; i<100; i++)

a[i]=a[0]+i;a[i]=a[0]+i;

……...

该编译器编译得到目标代码:The compiler compiles the object code:

……...

LDR R2,[R1];LDR R2, [R1];

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3,R2,#99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

进一步地,该编译器在得到上述目标代码后,对该目标代码进行扫描,检测每条操作指令的操作数与该操作指令后续的操作指令的操作数的关系,在第一操作指令的操作数和该第一操作指令后续的操作指令的操作数满足预设条件时,确定该第一操作指令具有关键性。例如,该预设条件为该第一操作指令中的操作数在后续操作指令的操作数中出现次数大于5,则在上述目标代码中,对于第一操作指令LDR R2,[R1],该第一操作指令表示将R1地址处的数据读出保存到寄存器R2中,该编译器通过对该第一操作指令后续的操作指令进行扫描可确定该第一操作指令中的操作数R2在后续指令中出现的次数大于5,则该编译器确定该第一操作指令具有关键性。Further, after the compiler obtains the above object code, it scans the object code to detect the relationship between the operand of each operation instruction and the operand of the operation instruction subsequent to the operation instruction, and the operand of the first operation instruction When an operand of an operation instruction following the first operation instruction satisfies a preset condition, it is determined that the first operation instruction is critical. For example, the preset condition is that the number of occurrences of the operand in the first operation instruction in the operands of the subsequent operation instruction is greater than 5, then in the above object code, for the first operation instruction LDR R2, [R1], the first operation instruction An operation instruction indicates that the data at the address of R1 is read and stored in the register R2, and the compiler can determine that the operand R2 in the first operation instruction is in the subsequent instruction by scanning the operation instructions subsequent to the first operation instruction. If the number of occurrences is greater than 5, the compiler determines that the first operation instruction is critical.

由源代码可知,执行循环得到数组a[1]到数组a[99]的值都使用到数组a[0]的值,也就是对应的目标代码中的寄存器R2中的值,因此,若该第一操作指令未成功执行,后续的操作指令都无法执行。It can be seen from the source code that the value of array a[1] to array a[99] obtained by executing the loop uses the value of array a[0], which is the value in register R2 in the corresponding target code. Therefore, if the If the first operation instruction is not successfully executed, subsequent operation instructions cannot be executed.

进一步地,该编译器在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令,如LDR_c R2,[R1],则更改后的目标代码为:Further, when the compiler determines that the first operation instruction is critical, it changes the first operation instruction into a second operation instruction, such as LDR_c R2, [R1], and the changed object code is:

……...

LDR_c R2,[R1]LDR_c R2, [R1]

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1, #2]

……...

ADD R3,R2,#99ADD R3, R2, #99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

需要说明的是,上述预设条件还可以为该第一操作指令中的操作数在后续操作指令的操作数中出现的频率大于N,N为大于零的正整数,即该编译器在扫描目标代码后,若确定该第一操作指令的操作数R2在后续操作指令中出现的频率大于N,则该编译器确定该第一操作指令具有关键性。It should be noted that the above preset condition can also be that the frequency of the operand in the first operation instruction appearing in the operand of the subsequent operation instruction is greater than N, and N is a positive integer greater than zero, that is, the compiler is scanning the target After the code, if it is determined that the operand R2 of the first operation instruction occurs more frequently than N in subsequent operation instructions, the compiler determines that the first operation instruction is critical.

进一步地,该编译器在确定该第一操作指令具有关键性时,将该第一操作指令更改为第二操作指令,如将该第一操作指令LDR R2,[R1]更改为第二操作指令LDR_c R2,[R1],则更改后的目标代码为:Further, when the compiler determines that the first operation instruction is critical, it changes the first operation instruction into a second operation instruction, such as changing the first operation instruction LDR R2, [R1] into a second operation instruction LDR_c R2, [R1], then the changed object code is:

……...

LDR_c R2,[R1]LDR_c R2, [R1]

ADD R3,R2,#1ADD R3,R2,#1

STR R3,[R1,#1]STR R3,[R1,#1]

ADD R3,R2,#2ADD R3,R2,#2

STR R3,[R1,#2]STR R3, [R1,#2]

……...

ADD R3,R2,#99ADD R3,R2,#99

STR R3,[R1,#99]STR R3, [R1, #99]

……...

可选地,若该第一操作指令为数据读取指令,则在处理器未在缓存中找到对应该第一操作指令的数据时,该内存控制器接收该处理器发送的该第一操作指令。Optionally, if the first operation instruction is a data read instruction, when the processor does not find the data corresponding to the first operation instruction in the cache, the memory controller receives the first operation instruction sent by the processor .

需要说明的是,该处理器支持该第二操作指令的存在,并且,该处理器在处理该第二操作指令时,和该第一操作指令的处理方式一样。即若该第一操作指令为数据读取指令,则该处理器在执行第二操作指令时,首先在缓存中查询对应该第二操作指令的数据,若缓存中存在对应该第二操作指令的数据,则该处理器读取该数据;若在每一级缓存中都找不到该第二操作指令对应的数据时,则将该第二操作指令指发送至内存控制器中。It should be noted that the processor supports the existence of the second operation instruction, and when the processor processes the second operation instruction, the processing manner is the same as that of the first operation instruction. That is, if the first operation instruction is a data read instruction, when the processor executes the second operation instruction, it first queries the data corresponding to the second operation instruction in the cache, and if there is a data corresponding to the second operation instruction in the cache data, the processor reads the data; if the data corresponding to the second operation instruction cannot be found in each level of cache, the second operation instruction is sent to the memory controller.

该内存控制器在接收到该第二操作指令时,根据该第二操作指令携带的关键指令标识确定该第二操作指令为关键性指令,其中,该关键指令标识可以为该第二操作指令的操作码的名称,如上述LDR_c,也可以是该指令携带的其他标识信息,用于指示该第二操作指令的关键性。When the memory controller receives the second operation instruction, it determines that the second operation instruction is a critical instruction according to the key instruction identification carried by the second operation instruction, wherein the key instruction identification may be the key instruction of the second operation instruction. The name of the operation code, such as the above-mentioned LDR_c, may also be other identification information carried by the instruction, which is used to indicate the criticality of the second operation instruction.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional modules according to needs. The internal structure of the device is divided into different functional modules to complete all or part of the functions described above. For the specific working process of the units described above, reference may be made to the corresponding process in the foregoing method embodiments, and details are not repeated here.

采用上述编译器,该编译器在得到目标代码后,确定第一操作指令具有关键性,并将该第一操作指令更改为第二操作指令,以便内存控制器在接收到该第二操作指令时,确定该第二操作指令为关键性指令,并根据优先策略对内存中对应该第二操作指令的数据进行操作。这样,若该内存控制器接收到数据读取指令,能够根据该数据读取指令是否携带关键指令标识确定该数据读取指令是否为关键性指令,并优先调用该数据读取指令在内存中读取对应的数据,能够准确的判断数据读取指令是否为关键性指令,提高处理器在内存中读取数据的速率,并且避免了查询和预测带来的硬件成本过高的问题。Using the above-mentioned compiler, after obtaining the object code, the compiler determines that the first operation instruction is critical, and changes the first operation instruction into a second operation instruction, so that when the memory controller receives the second operation instruction , determining that the second operation instruction is a critical instruction, and operating the data corresponding to the second operation instruction in the memory according to the priority strategy. In this way, if the memory controller receives a data read instruction, it can determine whether the data read instruction is a critical instruction according to whether the data read instruction carries a key instruction identifier, and preferentially calls the data read instruction to read in the memory. Fetching the corresponding data can accurately judge whether the data reading instruction is a key instruction, improve the speed at which the processor reads data in the memory, and avoid the problem of high hardware cost caused by query and prediction.

本发明实施例提供一种内存控制器70,如图7所示,该内存控制器70包括:An embodiment of the present invention provides a memory controller 70. As shown in FIG. 7, the memory controller 70 includes:

处理器(processor)71、通信接口(Communications Interface)72、存储器(memory)73和通信总线74;其中,所述处理器71、所述通信接口72和所述存储器73通过所述通信总线74完成相互间的通信。A processor (processor) 71, a communication interface (Communications Interface) 72, a memory (memory) 73, and a communication bus 74; wherein, the processor 71, the communication interface 72, and the memory 73 are completed through the communication bus 74 mutual communication.

处理器71可能是一个多核中央处理器CPU,或者是特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。The processor 71 may be a multi-core CPU, or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention.

存储器73用于存放程序代码,所述程序代码包括计算机操作指令和网络流图。存储器73可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 73 is used to store program codes, which include computer operation instructions and network flow diagrams. The memory 73 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory.

所述通信接口72,用于实现这些装置之间的连接通信。The communication interface 72 is used to realize connection and communication between these devices.

所述处理器71用于执行所述存储器73中的程序代码,以实现以下操作:The processor 71 is used to execute the program codes in the memory 73 to achieve the following operations:

在编译器确定第一操作指令具有关键性,并将所述第一操作指令更改为第二操作指令后,收所述第二操作指令;所述第二操作指令携带关键指令标识;After the compiler determines that the first operation instruction is critical and changes the first operation instruction to a second operation instruction, receiving the second operation instruction; the second operation instruction carries a key instruction identifier;

根据所述关键指令标识确定所述第二操作指令为关键性指令;determining that the second operation instruction is a critical instruction according to the key instruction identifier;

根据优先策略对内存中对应所述第二操作指令的数据进行操作。Operate the data corresponding to the second operation instruction in the memory according to the priority policy.

可选地,若所述第一操作指令为数据读取指令,则所述内存控制器接收所述第二操作指令具体包括:Optionally, if the first operation instruction is a data read instruction, receiving the second operation instruction by the memory controller specifically includes:

在处理器未在缓存中找到对应所述第一操作指令的数据时,接收所述处理器发送的所述第一操作指令。When the processor does not find data corresponding to the first operation instruction in the cache, the first operation instruction sent by the processor is received.

可选地,若所述内存控制器中待调用的操作指令不是关键性指令,则所述根据优先策略对内存中对应所述第二操作指令的数据进行操作具体包括:Optionally, if the operation instruction to be called in the memory controller is not a critical instruction, the operating the data corresponding to the second operation instruction in the memory according to the priority strategy specifically includes:

优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作。The second operation instruction is preferentially invoked to operate on data corresponding to the second operation instruction in the memory.

可选地,在所述优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作之前,所述操作还包括:Optionally, before the preferentially calling the second operation instruction to operate on the data corresponding to the second operation instruction in the memory, the operation further includes:

根据所述第二操作指令的操作数与所述内存控制器中待调用的操作指令的操作数确定所述内存控制器中待调用的操作指令与所述第二操作指令不存在序的关系。According to the operand of the second operation instruction and the operand of the operation instruction to be called in the memory controller, it is determined that there is no order relationship between the operation instruction to be called in the memory controller and the second operation instruction.

所属本领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的内存控制器的具体工作过程和描述,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process and description of the above-described memory controller can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

本发明实施例提供一种编译器80,如图8所示,该编译器80包括:An embodiment of the present invention provides a compiler 80. As shown in FIG. 8, the compiler 80 includes:

处理器(processor)81、通信接口(Communications Interface)82、存储器(memory)83和通信总线84;其中,所述处理器81、所述通信接口82和所述存储器83通过所述通信总线84完成相互间的通信。A processor (processor) 81, a communication interface (Communications Interface) 82, a memory (memory) 83, and a communication bus 84; wherein, the processor 81, the communication interface 82, and the memory 83 are completed through the communication bus 84 mutual communication.

处理器81可能是一个多核中央处理器CPU,或者是特定集成电路ASIC(Application Specific Integrated Circuit),或者是被配置成实施本发明实施例的一个或多个集成电路。The processor 81 may be a multi-core CPU, or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present invention.

存储器83用于存放程序代码,所述程序代码包括计算机操作指令和网络流图。存储器83可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 83 is used to store program codes, which include computer operation instructions and network flow diagrams. The memory 83 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory.

所述通信接口82,用于实现这些装置之间的连接通信。The communication interface 82 is used to realize connection and communication between these devices.

所述处理器81用于执行所述存储器83中的程序代码,以实现以下操作:The processor 81 is used to execute the program code in the memory 83 to realize the following operations:

对源代码进行编译得到目标代码;Compile the source code to get the object code;

确定所述目标代码中的第一操作指令是否具有关键性;determining whether a first operation instruction in the object code is critical;

在确定所述第一操作指令具有关键性时,将所述第一操作指令更改为第二操作指令,其中,所述第二操作指令携带关键指令标识,以便内存控制器在接收到所述第二操作指令时,根据所述关键指令标识确定所述第二操作指令为关键性指令,并根据优先策略对内存中对应所述第二操作指令的数据进行操作。When determining that the first operation instruction is critical, changing the first operation instruction to a second operation instruction, wherein the second operation instruction carries a key instruction identifier, so that the memory controller receives the first operation instruction When the second operation instruction is used, the second operation instruction is determined to be a critical instruction according to the key instruction identifier, and the data corresponding to the second operation instruction in the memory is operated according to a priority policy.

可选地,所述确定所述目标代码中的第一操作指令是否具有关键性具体包括:Optionally, the determining whether the first operation instruction in the target code is critical specifically includes:

在所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,定所述第一操作指令具有关键性。When the operand of the first operation instruction and the operand of the operation instruction subsequent to the first operation instruction satisfy a preset condition, the first operation instruction is determined to be critical.

所属本领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的感应装置的具体工作过程和描述,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process and description of the above-described sensing device can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. All should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims (10)

1.一种数据操作的方法,其特征在于,包括:1. A method for data manipulation, comprising: 在编译器确定第一操作指令具有关键性,并将所述第一操作指令更改为第二操作指令后,内存控制器接收所述第二操作指令;所述第二操作指令携带关键指令标识;其中,所述第一操作指令具有关键性是指,所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,所述第一操作指令具有关键性;After the compiler determines that the first operation instruction is critical and changes the first operation instruction to a second operation instruction, the memory controller receives the second operation instruction; the second operation instruction carries a key instruction identifier; Wherein, the criticality of the first operation instruction means that when the operand of the first operation instruction and the operand of the operation instruction subsequent to the first operation instruction meet a preset condition, the first operation instruction has Criticality; 所述内存控制器根据所述关键指令标识确定所述第二操作指令为关键性指令;The memory controller determines that the second operation instruction is a critical instruction according to the critical instruction identifier; 根据优先策略对内存中对应所述第二操作指令的数据进行操作。Operate the data corresponding to the second operation instruction in the memory according to the priority policy. 2.根据权利要求1所述的方法,其特征在于,若所述第一操作指令为数据读取指令,则所述内存控制器接收所述第二操作指令包括:2. The method according to claim 1, wherein if the first operation instruction is a data read instruction, receiving the second operation instruction by the memory controller comprises: 在处理器未在缓存中找到对应所述第一操作指令的数据时,接收所述处理器发送的所述第一操作指令。When the processor does not find data corresponding to the first operation instruction in the cache, the first operation instruction sent by the processor is received. 3.根据权利要求1或2所述的方法,其特征在于,若所述内存控制器中待调用的操作指令不是关键性指令,则所述根据优先策略对内存中对应所述第二操作指令的数据进行操作包括:3. The method according to claim 1 or 2, wherein, if the operation instruction to be called in the memory controller is not a critical instruction, the corresponding second operation instruction in the memory according to the priority policy The data to manipulate includes: 优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作。The second operation instruction is preferentially invoked to operate on data corresponding to the second operation instruction in the memory. 4.根据权利要求3所述的方法,其特征在于,在所述优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作之前,所述方法还包括:4. The method according to claim 3, wherein before the preferentially calling the second operation instruction to operate on the data corresponding to the second operation instruction in the memory, the method further comprises: 根据所述第二操作指令的操作数与所述内存控制器中待调用的操作指令的操作数确定所述内存控制器中待调用的操作指令与所述第二操作指令不存在序的关系;According to the operand of the second operation instruction and the operand of the operation instruction to be called in the memory controller, it is determined that there is no order relationship between the operation instruction to be called in the memory controller and the second operation instruction; 所述序的关系是指所述内存控制器只能先执行所述待调用的操作指令,后执行所述第二操作指令。The sequence relationship means that the memory controller can only execute the operation instruction to be called first, and then execute the second operation instruction. 5.一种数据操作的方法,其特征在于,包括:5. A method for data manipulation, comprising: 编译器对源代码进行编译得到目标代码;The compiler compiles the source code to obtain the object code; 确定所述目标代码中的第一操作指令是否具有关键性;其中,所述第一操作指令具有关键性是指,所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,所述第一操作指令具有关键性;determining whether the first operation instruction in the target code is critical; where the first operation instruction is critical means that the operand of the first operation instruction and the operation instruction subsequent to the first operation instruction When the operand of satisfies the preset condition, the first operation instruction is critical; 在确定所述第一操作指令具有关键性时,将所述第一操作指令更改为第二操作指令,其中,所述第二操作指令携带关键指令标识,以便内存控制器在接收到所述第二操作指令时,根据所述关键指令标识确定所述第二操作指令为关键性指令,并根据优先策略对内存中对应所述第二操作指令的数据进行操作。When determining that the first operation instruction is critical, changing the first operation instruction to a second operation instruction, wherein the second operation instruction carries a key instruction identifier, so that the memory controller receives the first operation instruction When the second operation instruction is used, the second operation instruction is determined to be a critical instruction according to the key instruction identifier, and the data corresponding to the second operation instruction in the memory is operated according to a priority strategy. 6.一种内存控制器,其特征在于,包括:6. A memory controller, characterized in that, comprising: 接收单元,用于在编译器确定第一操作指令具有关键性,并将所述第一操作指令更改为第二操作指令后,接收所述第二操作指令;所述第二操作指令携带关键指令标识;其中,所述第一操作指令具有关键性是指,所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,所述第一操作指令具有关键性;A receiving unit, configured to receive the second operation instruction after the compiler determines that the first operation instruction is critical and changes the first operation instruction to a second operation instruction; the second operation instruction carries a key instruction identification; wherein, the first operation instruction has criticality means that when the operand of the first operation instruction and the operand of the operation instruction subsequent to the first operation instruction meet a preset condition, the first operation the order is critical; 确定单元,用于根据所述关键指令标识确定所述第二操作指令为关键性指令;A determining unit, configured to determine, according to the key instruction identifier, that the second operation instruction is a key instruction; 处理单元,用于根据优先策略对内存中对应所述第二操作指令的数据进行操作。The processing unit is configured to operate the data corresponding to the second operation instruction in the memory according to the priority policy. 7.根据权利要求6所述的内存控制器,其特征在于,所述接收单元具体用于:若所述第一操作指令为数据读取指令,在处理器未在缓存中找到对应所述第一操作指令的数据时,接收所述处理器发送的所述第一操作指令。7. The memory controller according to claim 6, wherein the receiving unit is specifically configured to: if the first operation instruction is a data read instruction, the processor does not find the corresponding operation instruction in the cache. When the data of an operation instruction is received, the first operation instruction sent by the processor is received. 8.根据权利要求6或7所述的内存控制器,其特征在于,所述处理单元具体用于:若所述内存控制器中待调用的操作指令不是关键性指令,优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作。8. The memory controller according to claim 6 or 7, wherein the processing unit is specifically configured to: if the operation instruction to be called in the memory controller is not a critical instruction, preferentially call the second The operation instruction operates on the data corresponding to the second operation instruction in the memory. 9.根据权利要求8所述的内存控制器,其特征在于,所述处理单元具体用于:在优先调用所述第二操作指令对内存中对应所述第二操作指令的数据进行操作之前,根据所述第二操作指令的操作数与所述内存控制器中待调用的操作指令的操作数确定所述内存控制器中待调用的操作指令与所述第二操作指令不存在序的关系;9. The memory controller according to claim 8, wherein the processing unit is specifically configured to: before preferentially calling the second operation instruction to operate on data corresponding to the second operation instruction in the memory, According to the operand of the second operation instruction and the operand of the operation instruction to be called in the memory controller, it is determined that there is no order relationship between the operation instruction to be called in the memory controller and the second operation instruction; 所述序的关系是指所述内存控制器只能先执行所述待调用的操作指令,后执行所述第二操作指令。The sequence relationship means that the memory controller can only execute the operation instruction to be called first, and then execute the second operation instruction. 10.一种编译器,其特征在于,包括:10. A compiler, characterized in that, comprising: 处理单元,用于对源代码进行编译得到目标代码;a processing unit, configured to compile the source code to obtain the object code; 确定单元,用于确定所述目标代码中的第一操作指令是否具有关键性;其中,所述第一操作指令具有关键性是指,所述第一操作指令的操作数和所述第一操作指令后续的操作指令的操作数满足预设条件时,所述第一操作指令具有关键性;A determining unit, configured to determine whether the first operation instruction in the target code is critical; where the first operation instruction is critical means that the operand of the first operation instruction and the first operation When the operand of the operation instruction following the instruction satisfies a preset condition, the first operation instruction is critical; 所述处理单元还用于,在确定所述第一操作指令具有关键性时,将所述第一操作指令更改为第二操作指令,其中,所述第二操作指令携带关键指令标识,以便内存控制器在接收到所述第二操作指令时,根据所述关键指令标识确定所述第二操作指令为关键性指令,并根据优先策略对内存中对应所述第二操作指令的数据进行操作。The processing unit is further configured to, when determining that the first operation instruction is critical, change the first operation instruction into a second operation instruction, wherein the second operation instruction carries a key instruction identifier, so that the memory When the controller receives the second operation instruction, it determines that the second operation instruction is a critical instruction according to the key instruction identifier, and operates the data corresponding to the second operation instruction in the memory according to a priority strategy.
CN201410085731.0A 2014-03-10 2014-03-10 A kind of method and apparatus of data manipulation Active CN104915180B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410085731.0A CN104915180B (en) 2014-03-10 2014-03-10 A kind of method and apparatus of data manipulation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410085731.0A CN104915180B (en) 2014-03-10 2014-03-10 A kind of method and apparatus of data manipulation

Publications (2)

Publication Number Publication Date
CN104915180A CN104915180A (en) 2015-09-16
CN104915180B true CN104915180B (en) 2017-12-22

Family

ID=54084269

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410085731.0A Active CN104915180B (en) 2014-03-10 2014-03-10 A kind of method and apparatus of data manipulation

Country Status (1)

Country Link
CN (1) CN104915180B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107179895B (en) * 2017-05-17 2020-08-28 北京中科睿芯科技有限公司 Method for accelerating instruction execution speed in data stream structure by applying composite instruction

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1834899A (en) * 2005-03-18 2006-09-20 威盛电子股份有限公司 Device and method for enabling floating-point format to implement instruction-level specification
CN101534319A (en) * 2008-11-11 2009-09-16 航旅信通(北京)信息技术有限公司 Method, system and proxy server for canceling inter-instruction dependency relationship
CN101833440A (en) * 2010-04-30 2010-09-15 西安交通大学 Compiler-supported speculative multi-thread memory data synchronization execution method and device
CN102681819A (en) * 2011-03-10 2012-09-19 炬力集成电路设计有限公司 Method and device for realizing flexible and low-cost instruct replacement
CN102830954A (en) * 2012-08-24 2012-12-19 北京中科信芯科技有限责任公司 Method and device for instruction scheduling
CN103020003A (en) * 2012-12-31 2013-04-03 哈尔滨工业大学 Multi-core program determinacy replay-facing memory competition recording device and control method thereof

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2393274B (en) * 2002-09-20 2006-03-15 Advanced Risc Mach Ltd Data processing system having an external instruction set and an internal instruction set
US20080148020A1 (en) * 2006-12-13 2008-06-19 Luick David A Low Cost Persistent Instruction Predecoded Issue and Dispatcher
US20130113809A1 (en) * 2011-11-07 2013-05-09 Nvidia Corporation Technique for inter-procedural memory address space optimization in gpu computing compiler
US9256408B2 (en) * 2012-01-20 2016-02-09 Qualcomm Incorporated Optimizing texture commands for graphics processing unit

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1834899A (en) * 2005-03-18 2006-09-20 威盛电子股份有限公司 Device and method for enabling floating-point format to implement instruction-level specification
CN101534319A (en) * 2008-11-11 2009-09-16 航旅信通(北京)信息技术有限公司 Method, system and proxy server for canceling inter-instruction dependency relationship
CN101833440A (en) * 2010-04-30 2010-09-15 西安交通大学 Compiler-supported speculative multi-thread memory data synchronization execution method and device
CN102681819A (en) * 2011-03-10 2012-09-19 炬力集成电路设计有限公司 Method and device for realizing flexible and low-cost instruct replacement
CN102830954A (en) * 2012-08-24 2012-12-19 北京中科信芯科技有限责任公司 Method and device for instruction scheduling
CN103020003A (en) * 2012-12-31 2013-04-03 哈尔滨工业大学 Multi-core program determinacy replay-facing memory competition recording device and control method thereof

Also Published As

Publication number Publication date
CN104915180A (en) 2015-09-16

Similar Documents

Publication Publication Date Title
US12265862B2 (en) System and method for offloading application functions to a device
CN108463826B (en) Processor extensions for protecting a stack during ring transitions
US10678583B2 (en) Guest controlled virtual device packet filtering
US7237051B2 (en) Mechanism to control hardware interrupt acknowledgement in a virtual machine system
US9146682B2 (en) Method and apparatus for storing data
US8832666B2 (en) Dynamic instrumentation
US9201823B2 (en) Pessimistic interrupt affinity for devices
US20110219373A1 (en) Virtual machine management apparatus and virtualization method for virtualization-supporting terminal platform
US11016769B1 (en) Method and apparatus for processing information
US11093245B2 (en) Computer system and memory access technology
CN103455363A (en) Command processing method, device and physical host of virtual machine
JP2009527815A5 (en)
US9880849B2 (en) Allocation of load instruction(s) to a queue buffer in a processor system based on prediction of an instruction pipeline hazard
US8862786B2 (en) Program execution with improved power efficiency
JP6293910B2 (en) Hardware acceleration for inline caching in dynamic languages
CN104915180B (en) A kind of method and apparatus of data manipulation
US9038075B2 (en) Batch execution of system calls in an operating system
US10958597B2 (en) General purpose ring buffer handling in a network controller
KR20160113143A (en) Hardware acceleration for inline caches in dynamic languages
US10284501B2 (en) Technologies for multi-core wireless network data transmission
CN116501385A (en) Instruction processing method, processor, chip and computer equipment
US20150324203A1 (en) Hazard prediction for a group of memory access instructions using a buffer associated with branch prediction
JP6138482B2 (en) Embedded system
WO2016153378A1 (en) Cross-level prefetch for shared multi-level libraries

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant