<commit_before>module LLVM
  # The PassManager runs a queue of passes on a module. See
  # http://llvm.org/docs/Passes.html for the list of available passes.
  class PassManager
    # Creates a new pass manager on the given ExecutionEngine.
    def initialize(execution_engine)
      ptr = C.LLVMCreatePassManager()
      C.LLVMAddTargetData(
        C.LLVMGetExecutionEngineTargetData(execution_engine), ptr)
      @ptr = ptr
    end
    
    # @private
    def to_ptr
      @ptr
    end
    
    def <<(name)
      send(:"#{name}!")
      self
    end

    def do_initialization
    end

    def do_finalization
    end

    # Runs the passes on the given module.
    def run(mod)
      C.LLVMRunPassManager(self, mod)
    end
    
    # Disposes the pass manager.
    def dispose
      C.LLVMDisposePassManager(self)
    end
  end

  class FunctionPassManager < PassManager
    # Creates a new pass manager on the given ExecutionEngine and Module.
    def initialize(execution_engine, mod)
      ptr = C.LLVMCreateFunctionPassManagerForModule(mod)
      C.LLVMAddTargetData(
        C.LLVMGetExecutionEngineTargetData(execution_engine), ptr)
      @ptr = ptr
    end

    def do_initialization
      C.LLVMInitializeFunctionPassManager(self) != 0
    end

    def do_finalization
      C.LLVMFinalizeFunctionPassManager(self) != 0
    end

    # Runs the passes on the given function.
    def run(fn)
      C.LLVMRunFunctionPassManager(self, fn)
    end
  end
end<commit_msg>Improved docs for pass managers.<commit_after>module LLVM
  # The PassManager runs a queue of passes on a module. See
  # http://llvm.org/docs/Passes.html for the list of available passes.
  class PassManager
    # Creates a new pass manager on the given ExecutionEngine.
    def initialize(execution_engine)
      ptr = C.LLVMCreatePassManager()
      C.LLVMAddTargetData(
        C.LLVMGetExecutionEngineTargetData(execution_engine), ptr)
      @ptr = ptr
    end
    
    # @private
    def to_ptr
      @ptr
    end
    
    # Append a pass to the pass queue.
    # @param [Symbol]
    # @return [LLVM::PassManager]
    def <<(name)
      send(:"#{name}!")
      self
    end

    def do_initialization
    end

    def do_finalization
    end

    # Run the pass queue on the given module.
    # @param [LLVM::Module]
    # @return [true, false] Indicates whether the module was modified.
    def run(mod)
      C.LLVMRunPassManager(self, mod) != 0
    end
    
    # Disposes the pass manager.
    def dispose
      C.LLVMDisposePassManager(self)
    end
  end

  class FunctionPassManager < PassManager
    # Creates a new pass manager on the given ExecutionEngine and Module.
    def initialize(execution_engine, mod)
      ptr = C.LLVMCreateFunctionPassManagerForModule(mod)
      C.LLVMAddTargetData(
        C.LLVMGetExecutionEngineTargetData(execution_engine), ptr)
      @ptr = ptr
    end

    def do_initialization
      C.LLVMInitializeFunctionPassManager(self) != 0
    end

    def do_finalization
      C.LLVMFinalizeFunctionPassManager(self) != 0
    end

    # Run the pass queue on the given function.
    # @param [LLVM::Function]
    # @return [true, false] indicates whether the function was modified.
    def run(fn)
      C.LLVMRunFunctionPassManager(self, fn) != 0
    end
  end
end
{'fraction_non_alphanumeric': 0.07147201946472019, 'fraction_numerical': 0.0018248175182481751, 'mean_word_length': 2.634254143646409, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7460797', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1006, 'n_words': 294}