aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CommandFlags.cpp
diff options
context:
space:
mode:
authorQiongsi Wu <qwu@ibm.com>2023-03-23 09:16:18 -0400
committerQiongsi Wu <qwu@ibm.com>2023-03-23 09:44:47 -0400
commit4f9929add5369490c9607fc9203761483d2bc916 (patch)
tree1f3e3d4cf0d953c308fa89f93f5d452e82c2fb86 /llvm/lib/CodeGen/CommandFlags.cpp
parentfd4aeba307ca30da00a8db21a200cc9afcef63c6 (diff)
downloadllvm-4f9929add5369490c9607fc9203761483d2bc916.zip
llvm-4f9929add5369490c9607fc9203761483d2bc916.tar.gz
llvm-4f9929add5369490c9607fc9203761483d2bc916.tar.bz2
[AIX][CodeGen] Storage Locations for Constant Pointers
This patch adds an `llc` option `-mroptr` to specify storage locations for constant pointers on AIX. When the `-mroptr` option is specified, constant pointers, virtual function tables, and virtual type tables are placed in read-only storage. Otherwise, by default, pointers, virtual function tables, and virtual type tables are placed are placed in read/write storage. https://reviews.llvm.org/D144190 enables the `-mroptr` option for `clang`. Reviewed By: hubert.reinterpretcast, stephenpeckham, myhsu, MaskRay, serge-sans-paille Differential Revision: https://reviews.llvm.org/D144189
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
-rw-r--r--llvm/lib/CodeGen/CommandFlags.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index 51d259c..5ef6507 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -103,6 +103,7 @@ CGOPT(bool, XRayOmitFunctionIndex)
CGOPT(bool, DebugStrictDwarf)
CGOPT(unsigned, AlignLoops)
CGOPT(bool, JMCInstrument)
+CGOPT(bool, XCOFFReadOnlyPointers)
codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
#define CGBINDOPT(NAME) \
@@ -478,6 +479,13 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
cl::init(false));
CGBINDOPT(JMCInstrument);
+ static cl::opt<bool> XCOFFReadOnlyPointers(
+ "mroptr",
+ cl::desc("When set to true, const objects with relocatable address "
+ "values are put into the RO data section."),
+ cl::init(false));
+ CGBINDOPT(XCOFFReadOnlyPointers);
+
#undef CGBINDOPT
mc::RegisterMCTargetOptionsFlags();
@@ -554,6 +562,7 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
Options.DebugStrictDwarf = getDebugStrictDwarf();
Options.LoopAlignment = getAlignLoops();
Options.JMCInstrument = getJMCInstrument();
+ Options.XCOFFReadOnlyPointers = getXCOFFReadOnlyPointers();
Options.MCOptions = mc::InitMCTargetOptionsFromFlags();