aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/cpu/disassembler.h
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-08-03 20:03:34 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-08-03 20:07:29 -0700
commit36725ea1dcc80e9953a88076b499b44296ff74d8 (patch)
treef96ae9563fbdd30b2979a122429636111631e75f /tensorflow/compiler/xla/service/cpu/disassembler.h
parent3a6eba20c08239bd066e76bce6c3de1635b47932 (diff)
Add a configuration option for code size.
This change adds a CPU-specific flag: xla_cpu_optimize_for_size When this flag is passed, it changes the optimizers to run more or less analogously to LLVM's -Os optimizations. There are two things that turning on the code size optimization option controls: * the internal settings of some optimization passes (which is mostly controlled through a function attribute) * the passes that get run (which is decided by the pass manager) This change also refactors the code by reorganizing the way that CPU backend specific flags are queried, as well as some other minor refactoring. PiperOrigin-RevId: 164218771
Diffstat (limited to 'tensorflow/compiler/xla/service/cpu/disassembler.h')
-rw-r--r--tensorflow/compiler/xla/service/cpu/disassembler.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/tensorflow/compiler/xla/service/cpu/disassembler.h b/tensorflow/compiler/xla/service/cpu/disassembler.h
index 4c03567ee6..b6feaa7e45 100644
--- a/tensorflow/compiler/xla/service/cpu/disassembler.h
+++ b/tensorflow/compiler/xla/service/cpu/disassembler.h
@@ -33,19 +33,29 @@ limitations under the License.
namespace xla {
namespace cpu {
+struct DisassemblerResult {
+ DisassemblerResult(const string& text, size_t code_size_bytes)
+ : text(text), code_size_bytes(code_size_bytes) {}
+
+ // The dissassembled text sections of the object file.
+ string text;
+ // The total number of bytes of executable code in the object file.
+ uint64_t code_size_bytes;
+};
+
// Class for disassembling object files (and potentially other constructs) into
-// X86 assembly. Builds all the LLVM disassembly and instruction printing
+// x86/ARM assembly. Builds all the LLVM disassembly and instruction printing
// constructs from a given TargetMachine.
class Disassembler {
public:
explicit Disassembler(const llvm::TargetMachine& target_machine);
- // Returns a string containing the disassembled text sections of the given
- // object file.
+ // Returns a DisassemblerResult for the given object file, containing the
+ // disassembled code.
//
// If we couldnt' retrieve a disassembler for this platform, an error status
// is returned.
- StatusOr<string> DisassembleObjectFile(
+ StatusOr<DisassemblerResult> DisassembleObjectFile(
const llvm::object::ObjectFile& object_file) const;
private: