Procházet zdrojové kódy

add util methods to Assembly cote Block to add constant values to a scecific register

Kolja Strohm před 1 týdnem
rodič
revize
3c61d307b7
2 změnil soubory, kde provedl 37 přidání a 0 odebrání
  1. 14 0
      Assembly.cpp
  2. 23 0
      Assembly.h

+ 14 - 0
Assembly.cpp

@@ -7401,6 +7401,20 @@ void Framework::Assembly::AssemblyBlock::addAddition(
             new GPRegisterArgument(source, part)}));
 }
 
+void Framework::Assembly::AssemblyBlock::addAddition(
+    GPRegister target, char value, GPRegisterPart part)
+{
+    instructions.add(new Instruction(ADD,
+        {new GPRegisterArgument(target, part), new ConstantArgument(value)}));
+}
+
+void Framework::Assembly::AssemblyBlock::addAddition(
+    GPRegister target, int value, GPRegisterPart part)
+{
+    instructions.add(new Instruction(ADD,
+        {new GPRegisterArgument(target, part), new ConstantArgument(value)}));
+}
+
 void Framework::Assembly::AssemblyBlock::addAddition(
     FPRegister target, FPRegister source, FPDataType type, FPRegisterPart part)
 {

+ 23 - 0
Assembly.h

@@ -727,6 +727,29 @@ namespace Framework
             DLLEXPORT void addAddition(GPRegister target,
                 GPRegister source,
                 GPRegisterPart part = FULL64);
+            /**
+             * adds the given value to the given part of the target
+             * register and stores the result in the given part of the target
+             * register. single operation.
+             *
+             * \param target the target register
+             * \param value the value to add
+             * \param part the target register part
+             */
+            DLLEXPORT void addAddition(
+                GPRegister target, char value, GPRegisterPart part = LOWER8);
+            /**
+             * adds the given value to the given part of the target
+             * register and stores the result in the given part of the target
+             * register. single operation.
+             *
+             * \param target the target register
+             * \param value the value to add
+             * \param part the target register part (only LOWER32 or FULL64 are
+             * valid)
+             */
+            DLLEXPORT void addAddition(
+                GPRegister target, int value, GPRegisterPart part = LOWER32);
             /**
              * adds the value of the source register to the value of the target
              * register and stores the result in the target register. single