diff options
Diffstat (limited to 'backend/lib/CodeGen/MachineFunction.cpp')
| -rw-r--r-- | backend/lib/CodeGen/MachineFunction.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/lib/CodeGen/MachineFunction.cpp b/backend/lib/CodeGen/MachineFunction.cpp index 64b6440..294158b 100644 --- a/backend/lib/CodeGen/MachineFunction.cpp +++ b/backend/lib/CodeGen/MachineFunction.cpp @@ -75,6 +75,17 @@ MachineFunction::~MachineFunction() { } } +Expected<void> MachineFunction::setTargetState(TargetFunctionState State) { + if (TargetState.hasValue()) { + return makeUnexpected(ErrorCode::InvalidArgument, "machine function already has target state"); + } + auto Verification = State.verify(); + if (!Verification) + return std::unexpected(Verification.error()); + TargetState = std::move(State); + return {}; +} + Expected<MachineBasicBlock *> MachineFunction::createBasicBlock() { auto ID = BlockIDGenerator.allocate(); if (!ID) |
