|
| 1 | +#include "llvm/Support/Yk.h" |
1 | 2 | #include "llvm/Support/CommandLine.h"
|
| 3 | +#include "llvm/Support/ManagedStatic.h" |
2 | 4 |
|
3 | 5 | using namespace llvm;
|
4 | 6 |
|
5 | 7 | bool YkAllocLLVMBCSection;
|
6 |
| -static cl::opt<bool, true> YkAllocLLVMBCSectionParser( |
7 |
| - "yk-alloc-llvmbc-section", cl::desc("Make the `.llvmbc` section loadable"), |
8 |
| - cl::NotHidden, cl::location(YkAllocLLVMBCSection)); |
| 8 | +namespace { |
| 9 | +struct CreateYkAllocLLVMBCSectionParser { |
| 10 | + static void *call() { |
| 11 | + return new cl::opt<bool, true>( |
| 12 | + "yk-alloc-llvmbc-section", |
| 13 | + cl::desc("Make the `.llvmbc` section loadable"), cl::NotHidden, |
| 14 | + cl::location(YkAllocLLVMBCSection)); |
| 15 | + } |
| 16 | +}; |
| 17 | +} // namespace |
| 18 | +static ManagedStatic<cl::opt<bool, true>, CreateYkAllocLLVMBCSectionParser> |
| 19 | + YkAllocLLVMBCSectionParser; |
9 | 20 |
|
10 | 21 | bool YkAllocLLVMBBAddrMapSection;
|
11 |
| -static cl::opt<bool, true> YkAllocLLVMBBAddrMapSectionParser( |
12 |
| - "yk-alloc-llvmbbaddrmap-section", |
13 |
| - cl::desc("Make the `.llvmbbaddrmap` section loadable"), cl::NotHidden, |
14 |
| - cl::location(YkAllocLLVMBBAddrMapSection)); |
| 22 | +namespace { |
| 23 | +struct CreateYkAllocLLVMBBAddrMapSectionParser { |
| 24 | + static void *call() { |
| 25 | + return new cl::opt<bool, true>( |
| 26 | + "yk-alloc-llvmbbaddrmap-section", |
| 27 | + cl::desc("Make the `.llvmbbaddrmap` section loadable"), cl::NotHidden, |
| 28 | + cl::location(YkAllocLLVMBBAddrMapSection)); |
| 29 | + } |
| 30 | +}; |
| 31 | +} // namespace |
| 32 | +static ManagedStatic<cl::opt<bool, true>, |
| 33 | + CreateYkAllocLLVMBBAddrMapSectionParser> |
| 34 | + YkAllocLLVMBBAddrMapSectionParser; |
15 | 35 |
|
16 | 36 | bool YkExtendedLLVMBBAddrMapSection;
|
17 |
| -static cl::opt<bool, true> YkExtendedLLVMBBAddrMapSectionParser( |
18 |
| - "yk-extended-llvmbbaddrmap-section", |
19 |
| - cl::desc("Use the extended Yk `.llvmbbaddrmap` section format"), |
20 |
| - cl::NotHidden, cl::location(YkExtendedLLVMBBAddrMapSection)); |
| 37 | +namespace { |
| 38 | +struct CreateYkExtendedLLVMBBAddrMapSectionParser { |
| 39 | + static void *call() { |
| 40 | + return new cl::opt<bool, true>( |
| 41 | + "yk-extended-llvmbbaddrmap-section", |
| 42 | + cl::desc("Use the extended Yk `.llvmbbaddrmap` section format"), |
| 43 | + cl::NotHidden, cl::location(YkExtendedLLVMBBAddrMapSection)); |
| 44 | + } |
| 45 | +}; |
| 46 | +} // namespace |
| 47 | +static ManagedStatic<cl::opt<bool, true>, |
| 48 | + CreateYkExtendedLLVMBBAddrMapSectionParser> |
| 49 | + YkExtendedLLVMBBAddrMapSectionParser; |
21 | 50 |
|
22 | 51 | bool YkStackMapOffsetFix;
|
23 |
| -static cl::opt<bool, true> YkStackMapOffsetFixParser( |
24 |
| - "yk-stackmap-offset-fix", |
25 |
| - cl::desc("Apply a fix to stackmaps that corrects the reported instruction " |
26 |
| - "offset in the presence of calls. (deprecated by " |
27 |
| - "yk-stackmap-spillreloads-fix)"), |
28 |
| - cl::NotHidden, cl::location(YkStackMapOffsetFix)); |
| 52 | +namespace { |
| 53 | +struct CreateYkStackMapOffsetFixParser { |
| 54 | + static void *call() { |
| 55 | + return new cl::opt<bool, true>( |
| 56 | + "yk-stackmap-offset-fix", |
| 57 | + cl::desc( |
| 58 | + "Apply a fix to stackmaps that corrects the reported instruction " |
| 59 | + "offset in the presence of calls. (deprecated by " |
| 60 | + "yk-stackmap-spillreloads-fix)"), |
| 61 | + cl::NotHidden, cl::location(YkStackMapOffsetFix)); |
| 62 | + } |
| 63 | +}; |
| 64 | +} // namespace |
| 65 | +static ManagedStatic<cl::opt<bool, true>, CreateYkStackMapOffsetFixParser> |
| 66 | + YkStackMapOffsetFixParser; |
29 | 67 |
|
30 | 68 | bool YkStackMapAdditionalLocs;
|
31 |
| -static cl::opt<bool, true> YkStackMapAdditionalLocsParser( |
32 |
| - "yk-stackmap-add-locs", |
33 |
| - cl::desc("Encode additional locations for registers into stackmaps."), |
34 |
| - cl::NotHidden, cl::location(YkStackMapAdditionalLocs)); |
| 69 | +namespace { |
| 70 | +struct CreateYkStackMapAdditionalLocsParser { |
| 71 | + static void *call() { |
| 72 | + return new cl::opt<bool, true>( |
| 73 | + "yk-stackmap-add-locs", |
| 74 | + cl::desc("Encode additional locations for registers into stackmaps."), |
| 75 | + cl::NotHidden, cl::location(YkStackMapAdditionalLocs)); |
| 76 | + } |
| 77 | +}; |
| 78 | +} // namespace |
| 79 | +static ManagedStatic<cl::opt<bool, true>, CreateYkStackMapAdditionalLocsParser> |
| 80 | + YkStackMapAdditionalLocsParser; |
35 | 81 |
|
36 | 82 | bool YkStackmapsSpillReloadsFix;
|
37 |
| -static cl::opt<bool, true> YkStackMapSpillFixParser( |
38 |
| - "yk-stackmap-spillreloads-fix", |
39 |
| - cl::desc("Revert stackmaps and its operands after the register allocator " |
40 |
| - "has emitted spill reloads."), |
41 |
| - cl::NotHidden, cl::location(YkStackmapsSpillReloadsFix)); |
| 83 | +namespace { |
| 84 | +struct CreateYkStackmapsSpillReloadsFixParser { |
| 85 | + static void *call() { |
| 86 | + return new cl::opt<bool, true>( |
| 87 | + "yk-stackmap-spillreloads-fix", |
| 88 | + cl::desc( |
| 89 | + "Revert stackmaps and its operands after the register allocator " |
| 90 | + "has emitted spill reloads."), |
| 91 | + cl::NotHidden, cl::location(YkStackmapsSpillReloadsFix)); |
| 92 | + } |
| 93 | +}; |
| 94 | +} // namespace |
| 95 | +static ManagedStatic<cl::opt<bool, true>, |
| 96 | + CreateYkStackmapsSpillReloadsFixParser> |
| 97 | + YkStackmapsSpillFixParser; |
| 98 | + |
| 99 | +void llvm::initYkOptions() { |
| 100 | + *YkAllocLLVMBCSectionParser; |
| 101 | + *YkAllocLLVMBBAddrMapSectionParser; |
| 102 | + *YkExtendedLLVMBBAddrMapSectionParser; |
| 103 | + *YkStackMapOffsetFixParser; |
| 104 | + *YkStackMapAdditionalLocsParser; |
| 105 | + *YkStackmapsSpillFixParser; |
| 106 | +} |
0 commit comments