parameters: (instruction, global_dict=None)
return_statement: return maybe_vectorized_instruction
docstring: Decorator to vectorize instructions.
docstring_summary: Decorator to vectorize instructions.
docstring_tokens: Decorator to vectorize instructions .
function: def vectorize(instruction, global_dict=None):
      """ Decorator to vectorize instructions. """
  
      if global_dict is None:
          global_dict = inspect.getmodule(instruction).__dict__
  
      class Vectorized_Instruction(instruction):
          __slots__ = ['size']
          def __init__(self, size, *args, **kwargs):
              self.size = size
              super(Vectorized_Instruction, self).__init__(*args, **kwargs)
              for arg,f in zip(self.args, self.arg_format):
                  if issubclass(ArgFormats[f], RegisterArgFormat):
                      arg.set_size(size)
          def get_code(self):
              return (self.size << 9) + self.code
          def get_pre_arg(self):
              return "%d, " % self.size
          def is_vec(self):
              return self.size > 1
          def get_size(self):
              return self.size
          def expand(self):
              set_global_vector_size(self.size)
              super(Vectorized_Instruction, self).expand()
              reset_global_vector_size()
  
      @functools.wraps(instruction)
      def maybe_vectorized_instruction(*args, **kwargs):
          if global_vector_size == 1:
              return instruction(*args, **kwargs)
          else:
              return Vectorized_Instruction(global_vector_size, *args, **kwargs)
      maybe_vectorized_instruction.vec_ins = Vectorized_Instruction
      maybe_vectorized_instruction.std_ins = instruction
      
      vectorized_name = 'v' + instruction.__name__
      Vectorized_Instruction.__name__ = vectorized_name
      global_dict[vectorized_name] = Vectorized_Instruction
      global_dict[instruction.__name__ + '_class'] = instruction
      return maybe_vectorized_instruction
function_tokens: def vectorize ( instruction , global_dict = None ) : if global_dict is None : global_dict = inspect . getmodule ( instruction ) . __dict__ class Vectorized_Instruction ( instruction ) : __slots__ = [ 'size' ] def __init__ ( self , size , * args , * * kwargs ) : self . size = size super ( Vectorized_Instruction , self ) . __init__ ( * args , * * kwargs ) for arg , f in zip ( self . args , self . arg_format ) : if issubclass ( ArgFormats [ f ] , RegisterArgFormat ) : arg . set_size ( size ) def get_code ( self ) : return ( self . size << 9 ) + self . code def get_pre_arg ( self ) : return "%d, " % self . size def is_vec ( self ) : return self . size > 1 def get_size ( self ) : return self . size def expand ( self ) : set_global_vector_size ( self . size ) super ( Vectorized_Instruction , self ) . expand ( ) reset_global_vector_size ( ) @ functools . wraps ( instruction ) def maybe_vectorized_instruction ( * args , * * kwargs ) : if global_vector_size == 1 : return instruction ( * args , * * kwargs ) else : return Vectorized_Instruction ( global_vector_size , * args , * * kwargs ) maybe_vectorized_instruction . vec_ins = Vectorized_Instruction maybe_vectorized_instruction . std_ins = instruction vectorized_name = 'v' + instruction . __name__ Vectorized_Instruction . __name__ = vectorized_name global_dict [ vectorized_name ] = Vectorized_Instruction global_dict [ instruction . __name__ + '_class' ] = instruction return maybe_vectorized_instruction