Use instruction itinerary to determine what instructions are 'cheap'.
[oota-llvm.git] / include / llvm / System / Program.h
index 177fa7cf7ee779090a6ceb5c7dd04872f3a03b33..7017305a2eb6aeb29f52e7a5523de4dd18f4a9f1 100644 (file)
@@ -29,7 +29,8 @@ namespace sys {
   /// @since 1.4
   /// @brief An abstraction for finding and executing programs.
   class Program {
-    unsigned Pid_;
+    /// Opaque handle for target specific data.
+    void *Data_;
 
     // Noncopyable.
     Program(const Program& other);
@@ -39,11 +40,11 @@ namespace sys {
     /// @{
   public:
 
-    Program() : Pid_(0)
-    {}
+    Program();
+    ~Program();
 
     /// Return process ID of this program.
-    unsigned GetPid() { return Pid_; }
+    unsigned GetPid() const;
 
     /// This function executes the program using the \p arguments provided.  The
     /// invoked program will inherit the stdin, stdout, and stderr file
@@ -96,7 +97,17 @@ namespace sys {
       ///< it doesn't.
       std::string* ErrMsg = 0 ///< If non-zero, provides a pointer to a string
       ///< instance in which error messages will be returned. If the string
-      ///< is non-empty upon return an error occurred while invoking the
+      ///< is non-empty upon return an error occurred while waiting.
+      );
+
+    /// This function terminates the program.
+    /// @returns true if an error occured.
+    /// @see Execute
+    /// @brief Terminates the program.
+    bool Kill
+    ( std::string* ErrMsg = 0 ///< If non-zero, provides a pointer to a string
+      ///< instance in which error messages will be returned. If the string
+      ///< is non-empty upon return an error occurred while killing the
       ///< program.
       );
 
@@ -105,18 +116,18 @@ namespace sys {
     /// locations to search (e.g. the PATH on Unix).
     /// @returns A Path object initialized to the path of the program or a
     /// Path object that is empty (invalid) if the program could not be found.
-    /// @throws nothing
     /// @brief Construct a Program by finding it by name.
     static Path FindProgramByName(const std::string& name);
 
-    // These methods change the specified standard stream (stdin or stdout) to
-    // binary mode. They return true if an error occurred
+    // These methods change the specified standard stream (stdin,
+    // stdout, or stderr) to binary mode. They return true if an error
+    // occurred
     static bool ChangeStdinToBinary();
     static bool ChangeStdoutToBinary();
+    static bool ChangeStderrToBinary();
 
     /// A convenience function equivalent to Program prg; prg.Execute(..);
     /// prg.Wait(..);
-    /// @throws nothing
     /// @see Execute, Wait
     static int ExecuteAndWait(const Path& path,
                               const char** args,
@@ -127,7 +138,6 @@ namespace sys {
                               std::string* ErrMsg = 0);
 
     /// A convenience function equivalent to Program prg; prg.Execute(..);
-    /// @throws nothing
     /// @see Execute
     static void ExecuteNoWait(const Path& path,
                               const char** args,