mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
MIR Serialization: Serialize simple MachineRegisterInfo attributes.
This commit serializes the 3 scalar boolean attributes from the MachineRegisterInfo class: IsSSA, TracksRegLiveness, and TracksSubRegLiveness. These attributes are serialized as part of the machine function YAML mapping. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D10618 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240579 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/AsmParser/Parser.h"
|
||||
#include "llvm/CodeGen/MachineFunction.h"
|
||||
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||||
#include "llvm/CodeGen/MIRYamlMapping.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/DiagnosticInfo.h"
|
||||
@@ -83,6 +84,9 @@ public:
|
||||
bool initializeMachineBasicBlock(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
const yaml::MachineBasicBlock &YamlMBB);
|
||||
|
||||
bool initializeRegisterInfo(MachineRegisterInfo &RegInfo,
|
||||
const yaml::MachineFunction &YamlMF);
|
||||
|
||||
private:
|
||||
/// Return a MIR diagnostic converted from an MI string diagnostic.
|
||||
SMDiagnostic diagFromMIStringDiag(const SMDiagnostic &Error,
|
||||
@@ -212,6 +216,9 @@ bool MIRParserImpl::initializeMachineFunction(MachineFunction &MF) {
|
||||
MF.setAlignment(YamlMF.Alignment);
|
||||
MF.setExposesReturnsTwice(YamlMF.ExposesReturnsTwice);
|
||||
MF.setHasInlineAsm(YamlMF.HasInlineAsm);
|
||||
if (initializeRegisterInfo(MF.getRegInfo(), YamlMF))
|
||||
return true;
|
||||
|
||||
const auto &F = *MF.getFunction();
|
||||
for (const auto &YamlMBB : YamlMF.BasicBlocks) {
|
||||
const BasicBlock *BB = nullptr;
|
||||
@@ -250,6 +257,18 @@ bool MIRParserImpl::initializeMachineBasicBlock(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MIRParserImpl::initializeRegisterInfo(
|
||||
MachineRegisterInfo &RegInfo, const yaml::MachineFunction &YamlMF) {
|
||||
assert(RegInfo.isSSA());
|
||||
if (!YamlMF.IsSSA)
|
||||
RegInfo.leaveSSA();
|
||||
assert(RegInfo.tracksLiveness());
|
||||
if (!YamlMF.TracksRegLiveness)
|
||||
RegInfo.invalidateLiveness();
|
||||
RegInfo.enableSubRegLiveness(YamlMF.TracksSubRegLiveness);
|
||||
return false;
|
||||
}
|
||||
|
||||
SMDiagnostic MIRParserImpl::diagFromMIStringDiag(const SMDiagnostic &Error,
|
||||
SMRange SourceRange) {
|
||||
assert(SourceRange.isValid() && "Invalid source range");
|
||||
|
Reference in New Issue
Block a user