|
28 | 28 | #include "llvm/MC/MCStreamer.h"
|
29 | 29 | #include "llvm/MC/TargetRegistry.h"
|
30 | 30 | #include "llvm/Support/Chrono.h"
|
31 |
| -#include "llvm/Support/CommandLine.h" |
32 | 31 | #include "llvm/Support/ConvertEBCDIC.h"
|
33 | 32 | #include "llvm/Support/FormatProviders.h"
|
34 | 33 | #include "llvm/Support/FormatVariadic.h"
|
35 | 34 |
|
36 | 35 | using namespace llvm;
|
37 | 36 |
|
38 |
| -cl::opt<uint64_t> TranslationTime( |
39 |
| - "translation-time", |
40 |
| - cl::desc("sets the time of compilation in seconds since epoch"), |
41 |
| - cl::init(0)); |
42 |
| - |
43 | 37 | // Return an RI instruction like MI with opcode Opcode, but with the
|
44 | 38 | // GR64 register operands turned into GR32s.
|
45 | 39 | static MCInst lowerRILow(const MachineInstr *MI, unsigned Opcode) {
|
@@ -1057,11 +1051,21 @@ static uint32_t getProductPatch(Module &M) {
|
1057 | 1051 | return LLVM_VERSION_PATCH;
|
1058 | 1052 | }
|
1059 | 1053 |
|
| 1054 | +static time_t getTranslationTime(Module &M) { |
| 1055 | + std::time_t Time = 0; |
| 1056 | + if (auto *Val = cast_or_null<ConstantAsMetadata>( |
| 1057 | + M.getModuleFlag("TranslationTime"))) { |
| 1058 | + long SecondsSinceEpoch = cast<ConstantInt>(Val->getValue())->getSExtValue(); |
| 1059 | + Time = static_cast<time_t>(SecondsSinceEpoch); |
| 1060 | + } |
| 1061 | + return Time; |
| 1062 | +} |
| 1063 | + |
1060 | 1064 | void SystemZAsmPrinter::emitIDRLSection(Module &M) {
|
1061 | 1065 | OutStreamer->pushSection();
|
1062 | 1066 | OutStreamer->switchSection(getObjFileLowering().getIDRLSection());
|
1063 | 1067 | constexpr unsigned IDRLDataLength = 30;
|
1064 |
| - std::time_t Time = TranslationTime; |
| 1068 | + std::time_t Time = getTranslationTime(M); |
1065 | 1069 |
|
1066 | 1070 | uint32_t ProductVersion = getProductVersion(M);
|
1067 | 1071 | uint32_t ProductRelease = getProductRelease(M);
|
@@ -1390,7 +1394,7 @@ void SystemZAsmPrinter::emitPPA2(Module &M) {
|
1390 | 1394 | PPA2Sym = OutContext.createTempSymbol("PPA2", false);
|
1391 | 1395 | MCSymbol *DateVersionSym = OutContext.createTempSymbol("DVS", false);
|
1392 | 1396 |
|
1393 |
| - std::time_t Time = TranslationTime; |
| 1397 | + std::time_t Time = getTranslationTime(M); |
1394 | 1398 | SmallString<15> CompilationTime; // 14 + null
|
1395 | 1399 | raw_svector_ostream O(CompilationTime);
|
1396 | 1400 | O << formatv("{0:%Y%m%d%H%M%S}", llvm::sys::toUtcTime(Time));
|
|
0 commit comments