[llvm] c941db5 - [macho] Allow CPUSubtype to be adjusted before writing it to a file

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 13:17:56 PST 2019


Author: Daniel Sanders
Date: 2019-11-18T12:57:39-08:00
New Revision: c941db5b1acdc45fc1c50762684f1014e981abc6

URL: https://github.com/llvm/llvm-project/commit/c941db5b1acdc45fc1c50762684f1014e981abc6
DIFF: https://github.com/llvm/llvm-project/commit/c941db5b1acdc45fc1c50762684f1014e981abc6.diff

LOG: [macho] Allow CPUSubtype to be adjusted before writing it to a file

Summary:
It's not always possible for a target to provide a MachO CPUSubtype up
front as is required by the current implementation. Sometimes you need more
information like the particular CPU implementation you are targeting.

Give MCMachObjectTargetWriter subclasses the opportunity to modify the
CPUSubtype after the MCMachObjectTargetWriter is created but before the
object starts being written. Typically this would be done in response to
instructions from a TargetStreamer.

Reviewers: pete

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D70344

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCMachObjectWriter.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCMachObjectWriter.h b/llvm/include/llvm/MC/MCMachObjectWriter.h
index 278aebee99ac..853e5066f039 100644
--- a/llvm/include/llvm/MC/MCMachObjectWriter.h
+++ b/llvm/include/llvm/MC/MCMachObjectWriter.h
@@ -28,7 +28,9 @@ class MachObjectWriter;
 class MCMachObjectTargetWriter : public MCObjectTargetWriter {
   const unsigned Is64Bit : 1;
   const uint32_t CPUType;
-  const uint32_t CPUSubtype;
+protected:
+  uint32_t CPUSubtype;
+public:
   unsigned LocalDifference_RIT;
 
 protected:


        


More information about the llvm-commits mailing list