Skip to content

[CodeGen] Use std::bitset for MachineFunctionProperties #94627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions llvm/include/llvm/CodeGen/MachineFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#define LLVM_CODEGEN_MACHINEFUNCTION_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/SmallVector.h"
Expand All @@ -34,6 +33,7 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Recycler.h"
#include "llvm/Target/TargetOptions.h"
#include <bitset>
#include <cassert>
#include <cstdint>
#include <memory>
Expand Down Expand Up @@ -217,22 +217,21 @@ class MachineFunctionProperties {
}

MachineFunctionProperties &reset(const MachineFunctionProperties &MFP) {
Properties.reset(MFP.Properties);
Properties &= ~MFP.Properties;
return *this;
}

// Returns true if all properties set in V (i.e. required by a pass) are set
// in this.
bool verifyRequiredProperties(const MachineFunctionProperties &V) const {
return !V.Properties.test(Properties);
return (Properties | ~V.Properties).all();
}

/// Print the MachineFunctionProperties in human-readable form.
void print(raw_ostream &OS) const;

private:
BitVector Properties =
BitVector(static_cast<unsigned>(Property::LastProperty)+1);
std::bitset<static_cast<unsigned>(Property::LastProperty) + 1> Properties;
};

struct SEHHandler {
Expand Down
Loading