[llvm] 46e19e3 - [RDF] Do not use trailing return type after all, NFC
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 9 15:38:07 PDT 2023
Author: Krzysztof Parzyszek
Date: 2023-06-09T15:36:48-07:00
New Revision: 46e19e3a2c45e7fb5f501bdb983a7151c158304f
URL: https://github.com/llvm/llvm-project/commit/46e19e3a2c45e7fb5f501bdb983a7151c158304f
DIFF: https://github.com/llvm/llvm-project/commit/46e19e3a2c45e7fb5f501bdb983a7151c158304f.diff
LOG: [RDF] Do not use trailing return type after all, NFC
This sort of reverts commit d3b34b7f3a7cbfc96aea897419f167b5ee19e61a,
the issue with `Use` will be addressed by using fully-qualified name.
Added:
Modified:
llvm/include/llvm/CodeGen/RDFGraph.h
llvm/lib/CodeGen/RDFGraph.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/RDFGraph.h b/llvm/include/llvm/CodeGen/RDFGraph.h
index 1c7108fe8dc53..fafbf1f03a83a 100644
--- a/llvm/include/llvm/CodeGen/RDFGraph.h
+++ b/llvm/include/llvm/CodeGen/RDFGraph.h
@@ -293,29 +293,29 @@ struct NodeAttrs {
};
// clang-format on
- static auto type(uint16_t T) -> uint16_t { //
+ static uint16_t type(uint16_t T) { //
return T & TypeMask;
}
- static auto kind(uint16_t T) -> uint16_t { //
+ static uint16_t kind(uint16_t T) { //
return T & KindMask;
}
- static auto flags(uint16_t T) -> uint16_t { //
+ static uint16_t flags(uint16_t T) { //
return T & FlagMask;
}
- static auto set_type(uint16_t A, uint16_t T) -> uint16_t {
+ static uint16_t set_type(uint16_t A, uint16_t T) {
return (A & ~TypeMask) | T;
}
- static auto set_kind(uint16_t A, uint16_t K) -> uint16_t {
+ static uint16_t set_kind(uint16_t A, uint16_t K) {
return (A & ~KindMask) | K;
}
- static auto set_flags(uint16_t A, uint16_t F) -> uint16_t {
+ static uint16_t set_flags(uint16_t A, uint16_t F) {
return (A & ~FlagMask) | F;
}
// Test if A contains B.
- static auto contains(uint16_t A, uint16_t B) -> bool {
+ static bool contains(uint16_t A, uint16_t B) {
if (type(A) != Code)
return false;
uint16_t KB = kind(B);
@@ -348,11 +348,11 @@ template <typename T> struct NodeAddr {
template <typename S>
NodeAddr(const NodeAddr<S> &NA) : Addr(static_cast<T>(NA.Addr)), Id(NA.Id) {}
- auto operator==(const NodeAddr<T> &NA) const -> bool {
+ bool operator==(const NodeAddr<T> &NA) const {
assert((Addr == NA.Addr) == (Id == NA.Id));
return Addr == NA.Addr;
}
- auto operator!=(const NodeAddr<T> &NA) const -> bool {
+ bool operator!=(const NodeAddr<T> &NA) const { //
return !operator==(NA);
}
@@ -414,22 +414,22 @@ struct NodeAllocator {
assert(isPowerOf2_32(NPB));
}
- auto ptr(NodeId N) const -> NodeBase * {
+ NodeBase *ptr(NodeId N) const {
uint32_t N1 = N - 1;
uint32_t BlockN = N1 >> BitsPerIndex;
uint32_t Offset = (N1 & IndexMask) * NodeMemSize;
return reinterpret_cast<NodeBase *>(Blocks[BlockN] + Offset);
}
- auto id(const NodeBase *P) const -> NodeId;
- auto New() -> Node;
- auto clear() -> void;
+ NodeId id(const NodeBase *P) const;
+ Node New();
+ void clear();
private:
- auto startNewBlock() -> void;
- auto needNewBlock() -> bool;
+ void startNewBlock();
+ bool needNewBlock();
- auto makeId(uint32_t Block, uint32_t Index) const -> uint32_t {
+ uint32_t makeId(uint32_t Block, uint32_t Index) const {
// Add 1 to the id, to avoid the id of 0, which is treated as "null".
return ((Block << BitsPerIndex) | Index) + 1;
}
@@ -449,11 +449,9 @@ struct TargetOperandInfo {
TargetOperandInfo(const TargetInstrInfo &tii) : TII(tii) {}
virtual ~TargetOperandInfo() = default;
- virtual auto isPreserving(const MachineInstr &In, unsigned OpNum) const
- -> bool;
- virtual auto isClobbering(const MachineInstr &In, unsigned OpNum) const
- -> bool;
- virtual auto isFixedReg(const MachineInstr &In, unsigned OpNum) const -> bool;
+ virtual bool isPreserving(const MachineInstr &In, unsigned OpNum) const;
+ virtual bool isClobbering(const MachineInstr &In, unsigned OpNum) const;
+ virtual bool isFixedReg(const MachineInstr &In, unsigned OpNum) const;
const TargetInstrInfo &TII;
};
@@ -467,16 +465,16 @@ struct PackedRegisterRef {
struct LaneMaskIndex : private IndexedSet<LaneBitmask> {
LaneMaskIndex() = default;
- auto getLaneMaskForIndex(uint32_t K) const -> LaneBitmask {
+ LaneBitmask getLaneMaskForIndex(uint32_t K) const {
return K == 0 ? LaneBitmask::getAll() : get(K);
}
- auto getIndexForLaneMask(LaneBitmask LM) -> uint32_t {
+ uint32_t getIndexForLaneMask(LaneBitmask LM) {
assert(LM.any());
return LM.all() ? 0 : insert(LM);
}
- auto getIndexForLaneMask(LaneBitmask LM) const -> uint32_t {
+ uint32_t getIndexForLaneMask(LaneBitmask LM) const {
assert(LM.any());
return LM.all() ? 0 : find(LM);
}
@@ -487,24 +485,22 @@ struct NodeBase {
// Make sure this is a POD.
NodeBase() = default;
- auto getType() const -> uint16_t { return NodeAttrs::type(Attrs); }
- auto getKind() const -> uint16_t { return NodeAttrs::kind(Attrs); }
- auto getFlags() const -> uint16_t { return NodeAttrs::flags(Attrs); }
- auto getNext() const -> NodeId { return Next; }
+ uint16_t getType() const { return NodeAttrs::type(Attrs); }
+ uint16_t getKind() const { return NodeAttrs::kind(Attrs); }
+ uint16_t getFlags() const { return NodeAttrs::flags(Attrs); }
+ NodeId getNext() const { return Next; }
- auto getAttrs() const -> uint16_t { return Attrs; }
- auto setAttrs(uint16_t A) -> void { Attrs = A; }
- auto setFlags(uint16_t F) -> void {
- setAttrs(NodeAttrs::set_flags(getAttrs(), F));
- }
+ uint16_t getAttrs() const { return Attrs; }
+ void setAttrs(uint16_t A) { Attrs = A; }
+ void setFlags(uint16_t F) { setAttrs(NodeAttrs::set_flags(getAttrs(), F)); }
// Insert node NA after "this" in the circular chain.
- auto append(Node NA) -> void;
+ void append(Node NA);
// Initialize all members to 0.
- auto init() -> void { memset(this, 0, sizeof *this); }
+ void init() { memset(this, 0, sizeof *this); }
- auto setNext(NodeId N) -> void { Next = N; }
+ void setNext(NodeId N) { Next = N; }
protected:
uint16_t Attrs;
@@ -553,117 +549,108 @@ using NodeSet = std::set<NodeId>;
struct RefNode : public NodeBase {
RefNode() = default;
- auto getRegRef(const DataFlowGraph &G) const -> RegisterRef;
+ RegisterRef getRegRef(const DataFlowGraph &G) const;
- auto getOp() -> MachineOperand & {
+ MachineOperand &getOp() {
assert(!(getFlags() & NodeAttrs::PhiRef));
return *RefData.Op;
}
- auto setRegRef(RegisterRef RR, DataFlowGraph &G) -> void;
- auto setRegRef(MachineOperand *Op, DataFlowGraph &G) -> void;
+ void setRegRef(RegisterRef RR, DataFlowGraph &G);
+ void setRegRef(MachineOperand *Op, DataFlowGraph &G);
- auto getReachingDef() const -> NodeId { return RefData.RD; }
- auto setReachingDef(NodeId RD) -> void { RefData.RD = RD; }
+ NodeId getReachingDef() const { return RefData.RD; }
+ void setReachingDef(NodeId RD) { RefData.RD = RD; }
- auto getSibling() const -> NodeId { return RefData.Sib; }
- auto setSibling(NodeId Sib) -> void { RefData.Sib = Sib; }
+ NodeId getSibling() const { return RefData.Sib; }
+ void setSibling(NodeId Sib) { RefData.Sib = Sib; }
- auto isUse() const -> bool {
+ bool isUse() const {
assert(getType() == NodeAttrs::Ref);
return getKind() == NodeAttrs::Use;
}
- auto isDef() const -> bool {
+ bool isDef() const {
assert(getType() == NodeAttrs::Ref);
return getKind() == NodeAttrs::Def;
}
template <typename Predicate>
- auto getNextRef(RegisterRef RR, Predicate P, bool NextOnly,
- const DataFlowGraph &G) -> Ref;
- auto getOwner(const DataFlowGraph &G) -> Node;
+ Ref getNextRef(RegisterRef RR, Predicate P, bool NextOnly,
+ const DataFlowGraph &G);
+ Node getOwner(const DataFlowGraph &G);
};
struct DefNode : public RefNode {
- auto getReachedDef() const -> NodeId { //
- return RefData.Def.DD;
- }
- auto setReachedDef(NodeId D) -> void { //
- RefData.Def.DD = D;
- }
- auto getReachedUse() const -> NodeId { //
- return RefData.Def.DU;
- }
- auto setReachedUse(NodeId U) -> void { //
- RefData.Def.DU = U;
- }
+ NodeId getReachedDef() const { return RefData.Def.DD; }
+ void setReachedDef(NodeId D) { RefData.Def.DD = D; }
+ NodeId getReachedUse() const { return RefData.Def.DU; }
+ void setReachedUse(NodeId U) { RefData.Def.DU = U; }
- auto linkToDef(NodeId Self, Def DA) -> void;
+ void linkToDef(NodeId Self, Def DA);
};
struct UseNode : public RefNode {
- auto linkToDef(NodeId Self, Def DA) -> void;
+ void linkToDef(NodeId Self, Def DA);
};
struct PhiUseNode : public UseNode {
- auto getPredecessor() const -> NodeId {
+ NodeId getPredecessor() const {
assert(getFlags() & NodeAttrs::PhiRef);
return RefData.PhiU.PredB;
}
- auto setPredecessor(NodeId B) -> void {
+ void setPredecessor(NodeId B) {
assert(getFlags() & NodeAttrs::PhiRef);
RefData.PhiU.PredB = B;
}
};
struct CodeNode : public NodeBase {
- template <typename T> auto getCode() const -> T {
+ template <typename T> T getCode() const { //
return static_cast<T>(CodeData.CP);
}
- auto setCode(void *C) -> void { CodeData.CP = C; }
+ void setCode(void *C) { CodeData.CP = C; }
- auto getFirstMember(const DataFlowGraph &G) const -> Node;
- auto getLastMember(const DataFlowGraph &G) const -> Node;
- auto addMember(Node NA, const DataFlowGraph &G) -> void;
- auto addMemberAfter(Node MA, Node NA, const DataFlowGraph &G) -> void;
- auto removeMember(Node NA, const DataFlowGraph &G) -> void;
+ Node getFirstMember(const DataFlowGraph &G) const;
+ Node getLastMember(const DataFlowGraph &G) const;
+ void addMember(Node NA, const DataFlowGraph &G);
+ void addMemberAfter(Node MA, Node NA, const DataFlowGraph &G);
+ void removeMember(Node NA, const DataFlowGraph &G);
- auto members(const DataFlowGraph &G) const -> NodeList;
+ NodeList members(const DataFlowGraph &G) const;
template <typename Predicate>
- auto members_if(Predicate P, const DataFlowGraph &G) const -> NodeList;
+ NodeList members_if(Predicate P, const DataFlowGraph &G) const;
};
struct InstrNode : public CodeNode {
- auto getOwner(const DataFlowGraph &G) -> Node;
+ Node getOwner(const DataFlowGraph &G);
};
struct PhiNode : public InstrNode {
- auto getCode() const -> MachineInstr * { return nullptr; }
+ MachineInstr *getCode() const { return nullptr; }
};
struct StmtNode : public InstrNode {
- auto getCode() const -> MachineInstr * {
+ MachineInstr *getCode() const { //
return CodeNode::getCode<MachineInstr *>();
}
};
struct BlockNode : public CodeNode {
- auto getCode() const -> MachineBasicBlock * {
+ MachineBasicBlock *getCode() const {
return CodeNode::getCode<MachineBasicBlock *>();
}
- auto addPhi(Phi PA, const DataFlowGraph &G) -> void;
+ void addPhi(Phi PA, const DataFlowGraph &G);
};
struct FuncNode : public CodeNode {
- auto getCode() const -> MachineFunction * {
+ MachineFunction *getCode() const {
return CodeNode::getCode<MachineFunction *>();
}
- auto findBlock(const MachineBasicBlock *BB, const DataFlowGraph &G) const
- -> Block;
- auto getEntryBlock(const DataFlowGraph &G) -> Block;
+ Block findBlock(const MachineBasicBlock *BB, const DataFlowGraph &G) const;
+ Block getEntryBlock(const DataFlowGraph &G);
};
struct DataFlowGraph {
@@ -675,59 +662,55 @@ struct DataFlowGraph {
const MachineDominanceFrontier &mdf,
const TargetOperandInfo &toi);
- auto ptr(NodeId N) const -> NodeBase *;
- template <typename T> auto ptr(NodeId N) const -> T {
+ NodeBase *ptr(NodeId N) const;
+ template <typename T> T ptr(NodeId N) const { //
return static_cast<T>(ptr(N));
}
- auto id(const NodeBase *P) const -> NodeId;
+ NodeId id(const NodeBase *P) const;
- template <typename T> auto addr(NodeId N) const -> NodeAddr<T> {
+ template <typename T> NodeAddr<T> addr(NodeId N) const {
return {ptr<T>(N), N};
}
- auto getFunc() const -> Func { return TheFunc; }
- auto getMF() const -> MachineFunction & { return MF; }
- auto getTII() const -> const TargetInstrInfo & { return TII; }
- auto getTRI() const -> const TargetRegisterInfo & { return TRI; }
- auto getPRI() const -> const PhysicalRegisterInfo & { return PRI; }
- auto getDT() const -> const MachineDominatorTree & { return MDT; }
- auto getDF() const -> const MachineDominanceFrontier & { return MDF; }
- auto getLiveIns() const -> const RegisterAggr & { return LiveIns; }
+ Func getFunc() const { return TheFunc; }
+ MachineFunction &getMF() const { return MF; }
+ const TargetInstrInfo &getTII() const { return TII; }
+ const TargetRegisterInfo &getTRI() const { return TRI; }
+ const PhysicalRegisterInfo &getPRI() const { return PRI; }
+ const MachineDominatorTree &getDT() const { return MDT; }
+ const MachineDominanceFrontier &getDF() const { return MDF; }
+ const RegisterAggr &getLiveIns() const { return LiveIns; }
struct DefStack {
DefStack() = default;
- auto empty() const -> bool { return Stack.empty() || top() == bottom(); }
+ bool empty() const { return Stack.empty() || top() == bottom(); }
private:
using value_type = Def;
struct Iterator {
using value_type = DefStack::value_type;
- auto up() -> Iterator & {
+ Iterator &up() {
Pos = DS.nextUp(Pos);
return *this;
}
- auto down() -> Iterator & {
+ Iterator &down() {
Pos = DS.nextDown(Pos);
return *this;
}
- auto operator*() const -> value_type {
+ value_type operator*() const {
assert(Pos >= 1);
return DS.Stack[Pos - 1];
}
- auto operator->() const -> const value_type * {
+ const value_type *operator->() const {
assert(Pos >= 1);
return &DS.Stack[Pos - 1];
}
- auto operator==(const Iterator &It) const -> bool {
- return Pos == It.Pos;
- }
- auto operator!=(const Iterator &It) const -> bool {
- return Pos != It.Pos;
- }
+ bool operator==(const Iterator &It) const { return Pos == It.Pos; }
+ bool operator!=(const Iterator &It) const { return Pos != It.Pos; }
private:
friend struct DefStack;
@@ -743,27 +726,26 @@ struct DataFlowGraph {
public:
using iterator = Iterator;
- auto top() const -> iterator { return Iterator(*this, true); }
- auto bottom() const -> iterator { return Iterator(*this, false); }
- auto size() const -> unsigned;
+ iterator top() const { return Iterator(*this, true); }
+ iterator bottom() const { return Iterator(*this, false); }
+ unsigned size() const;
- auto push(Def DA) -> void { Stack.push_back(DA); }
- auto pop() -> void;
- auto start_block(NodeId N) -> void;
- auto clear_block(NodeId N) -> void;
+ void push(Def DA) { Stack.push_back(DA); }
+ void pop();
+ void start_block(NodeId N);
+ void clear_block(NodeId N);
private:
friend struct Iterator;
using StorageType = std::vector<value_type>;
- auto isDelimiter(const StorageType::value_type &P, NodeId N = 0) const
- -> bool {
+ bool isDelimiter(const StorageType::value_type &P, NodeId N = 0) const {
return (P.Addr == nullptr) && (N == 0 || P.Id == N);
}
- auto nextUp(unsigned P) const -> unsigned;
- auto nextDown(unsigned P) const -> unsigned;
+ unsigned nextUp(unsigned P) const;
+ unsigned nextDown(unsigned P) const;
StorageType Stack;
};
@@ -772,118 +754,111 @@ struct DataFlowGraph {
// Map: Register (physical or virtual) -> DefStack
using DefStackMap = std::unordered_map<RegisterId, DefStack>;
- auto build(unsigned Options = BuildOptions::None) -> void;
- auto pushAllDefs(Instr IA, DefStackMap &DM) -> void;
- auto markBlock(NodeId B, DefStackMap &DefM) -> void;
- auto releaseBlock(NodeId B, DefStackMap &DefM) -> void;
+ void build(unsigned Options = BuildOptions::None);
+ void pushAllDefs(Instr IA, DefStackMap &DM);
+ void markBlock(NodeId B, DefStackMap &DefM);
+ void releaseBlock(NodeId B, DefStackMap &DefM);
- auto pack(RegisterRef RR) -> PackedRegisterRef {
+ PackedRegisterRef pack(RegisterRef RR) {
return {RR.Reg, LMI.getIndexForLaneMask(RR.Mask)};
}
- auto pack(RegisterRef RR) const -> PackedRegisterRef {
+ PackedRegisterRef pack(RegisterRef RR) const {
return {RR.Reg, LMI.getIndexForLaneMask(RR.Mask)};
}
- auto unpack(PackedRegisterRef PR) const -> RegisterRef {
+ RegisterRef unpack(PackedRegisterRef PR) const {
return RegisterRef(PR.Reg, LMI.getLaneMaskForIndex(PR.MaskId));
}
- auto makeRegRef(unsigned Reg, unsigned Sub) const -> RegisterRef;
- auto makeRegRef(const MachineOperand &Op) const -> RegisterRef;
+ RegisterRef makeRegRef(unsigned Reg, unsigned Sub) const;
+ RegisterRef makeRegRef(const MachineOperand &Op) const;
- auto getNextRelated(Instr IA, Ref RA) const -> Ref;
- auto getNextShadow(Instr IA, Ref RA, bool Create) -> Ref;
- auto getNextShadow(Instr IA, Ref RA) const -> Ref;
+ Ref getNextRelated(Instr IA, Ref RA) const;
+ Ref getNextShadow(Instr IA, Ref RA, bool Create);
+ Ref getNextShadow(Instr IA, Ref RA) const;
- auto getRelatedRefs(Instr IA, Ref RA) const -> NodeList;
+ NodeList getRelatedRefs(Instr IA, Ref RA) const;
- auto findBlock(MachineBasicBlock *BB) const -> Block {
- return BlockNodes.at(BB);
- }
+ Block findBlock(MachineBasicBlock *BB) const { return BlockNodes.at(BB); }
- auto unlinkUse(Use UA, bool RemoveFromOwner) -> void {
+ void unlinkUse(Use UA, bool RemoveFromOwner) {
unlinkUseDF(UA);
if (RemoveFromOwner)
removeFromOwner(UA);
}
- auto unlinkDef(Def DA, bool RemoveFromOwner) -> void {
+ void unlinkDef(Def DA, bool RemoveFromOwner) {
unlinkDefDF(DA);
if (RemoveFromOwner)
removeFromOwner(DA);
}
// Some useful filters.
- template <uint16_t Kind> static auto IsRef(const Node BA) -> bool {
+ template <uint16_t Kind> static bool IsRef(const Node BA) {
return BA.Addr->getType() == NodeAttrs::Ref && BA.Addr->getKind() == Kind;
}
- template <uint16_t Kind> static auto IsCode(const Node BA) -> bool {
+ template <uint16_t Kind> static bool IsCode(const Node BA) {
return BA.Addr->getType() == NodeAttrs::Code && BA.Addr->getKind() == Kind;
}
- static auto IsDef(const Node BA) -> bool {
+ static bool IsDef(const Node BA) {
return BA.Addr->getType() == NodeAttrs::Ref &&
BA.Addr->getKind() == NodeAttrs::Def;
}
- static auto IsUse(const Node BA) -> bool {
+ static bool IsUse(const Node BA) {
return BA.Addr->getType() == NodeAttrs::Ref &&
BA.Addr->getKind() == NodeAttrs::Use;
}
- static auto IsPhi(const Node BA) -> bool {
+ static bool IsPhi(const Node BA) {
return BA.Addr->getType() == NodeAttrs::Code &&
BA.Addr->getKind() == NodeAttrs::Phi;
}
- static auto IsPreservingDef(const Def DA) -> bool {
+ static bool IsPreservingDef(const Def DA) {
uint16_t Flags = DA.Addr->getFlags();
return (Flags & NodeAttrs::Preserving) && !(Flags & NodeAttrs::Undef);
}
private:
- auto reset() -> void;
-
- auto getLandingPadLiveIns() const -> RegisterAggr;
-
- auto newNode(uint16_t Attrs) -> Node;
- auto cloneNode(const Node B) -> Node;
- auto newUse(Instr Owner, MachineOperand &Op, uint16_t Flags = NodeAttrs::None)
- -> Use;
- auto newPhiUse(Phi Owner, RegisterRef RR, Block PredB,
- uint16_t Flags = NodeAttrs::PhiRef) -> PhiUse;
- auto newDef(Instr Owner, MachineOperand &Op, uint16_t Flags = NodeAttrs::None)
- -> Def;
- auto newDef(Instr Owner, RegisterRef RR, uint16_t Flags = NodeAttrs::PhiRef)
- -> Def;
- auto newPhi(Block Owner) -> Phi;
- auto newStmt(Block Owner, MachineInstr *MI) -> Stmt;
- auto newBlock(Func Owner, MachineBasicBlock *BB) -> Block;
- auto newFunc(MachineFunction *MF) -> Func;
+ void reset();
+
+ RegisterAggr getLandingPadLiveIns() const;
+
+ Node newNode(uint16_t Attrs);
+ Node cloneNode(const Node B);
+ Use newUse(Instr Owner, MachineOperand &Op, uint16_t Flags = NodeAttrs::None);
+ PhiUse newPhiUse(Phi Owner, RegisterRef RR, Block PredB,
+ uint16_t Flags = NodeAttrs::PhiRef);
+ Def newDef(Instr Owner, MachineOperand &Op, uint16_t Flags = NodeAttrs::None);
+ Def newDef(Instr Owner, RegisterRef RR, uint16_t Flags = NodeAttrs::PhiRef);
+ Phi newPhi(Block Owner);
+ Stmt newStmt(Block Owner, MachineInstr *MI);
+ Block newBlock(Func Owner, MachineBasicBlock *BB);
+ Func newFunc(MachineFunction *MF);
template <typename Predicate>
- auto locateNextRef(Instr IA, Ref RA, Predicate P) const
- -> std::pair<Ref, Ref>;
+ std::pair<Ref, Ref> locateNextRef(Instr IA, Ref RA, Predicate P) const;
using BlockRefsMap = RegisterAggrMap<NodeId>;
- auto buildStmt(Block BA, MachineInstr &In) -> void;
- auto recordDefsForDF(BlockRefsMap &PhiM, Block BA) -> void;
- auto buildPhis(BlockRefsMap &PhiM, RegisterSet &AllRefs, Block BA) -> void;
- auto removeUnusedPhis() -> void;
+ void buildStmt(Block BA, MachineInstr &In);
+ void recordDefsForDF(BlockRefsMap &PhiM, Block BA);
+ void buildPhis(BlockRefsMap &PhiM, RegisterSet &AllRefs, Block BA);
+ void removeUnusedPhis();
- auto pushClobbers(Instr IA, DefStackMap &DM) -> void;
- auto pushDefs(Instr IA, DefStackMap &DM) -> void;
- template <typename T>
- auto linkRefUp(Instr IA, NodeAddr<T> TA, DefStack &DS) -> void;
+ void pushClobbers(Instr IA, DefStackMap &DM);
+ void pushDefs(Instr IA, DefStackMap &DM);
+ template <typename T> void linkRefUp(Instr IA, NodeAddr<T> TA, DefStack &DS);
template <typename Predicate>
- auto linkStmtRefs(DefStackMap &DefM, Stmt SA, Predicate P) -> void;
- auto linkBlockRefs(DefStackMap &DefM, Block BA) -> void;
+ void linkStmtRefs(DefStackMap &DefM, Stmt SA, Predicate P);
+ void linkBlockRefs(DefStackMap &DefM, Block BA);
- auto unlinkUseDF(Use UA) -> void;
- auto unlinkDefDF(Def DA) -> void;
+ void unlinkUseDF(Use UA);
+ void unlinkDefDF(Def DA);
- auto removeFromOwner(Ref RA) -> void {
+ void removeFromOwner(Ref RA) {
Instr IA = RA.Addr->getOwner(*this);
IA.Addr->removeMember(RA, *this);
}
@@ -909,8 +884,8 @@ struct DataFlowGraph {
}; // struct DataFlowGraph
template <typename Predicate>
-auto RefNode::getNextRef(RegisterRef RR, Predicate P, bool NextOnly,
- const DataFlowGraph &G) -> Ref {
+Ref RefNode::getNextRef(RegisterRef RR, Predicate P, bool NextOnly,
+ const DataFlowGraph &G) {
// Get the "Next" reference in the circular list that references RR and
// satisfies predicate "Pred".
auto NA = G.addr<NodeBase *>(getNext());
@@ -943,8 +918,7 @@ auto RefNode::getNextRef(RegisterRef RR, Predicate P, bool NextOnly,
}
template <typename Predicate>
-auto CodeNode::members_if(Predicate P, const DataFlowGraph &G) const
- -> NodeList {
+NodeList CodeNode::members_if(Predicate P, const DataFlowGraph &G) const {
NodeList MM;
auto M = getFirstMember(G);
if (M.Id == 0)
@@ -972,23 +946,23 @@ template <typename T> struct PrintNode : Print<NodeAddr<T>> {
: Print<NodeAddr<T>>(x, g) {}
};
-auto operator<<(raw_ostream &OS, const Print<RegisterRef> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<NodeId> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Def> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Use> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<PhiUse> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Ref> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<NodeList> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<NodeSet> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Phi> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Stmt> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Instr> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Block> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<Func> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<RegisterSet> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<RegisterAggr> &P) -> raw_ostream &;
-auto operator<<(raw_ostream &OS, const Print<DataFlowGraph::DefStack> &P)
- -> raw_ostream &;
+raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterRef> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<NodeId> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Def> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Use> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<PhiUse> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Ref> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<NodeList> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<NodeSet> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Phi> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Stmt> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Instr> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Block> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<Func> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterSet> &P);
+raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterAggr> &P);
+raw_ostream &operator<<(raw_ostream &OS,
+ const Print<DataFlowGraph::DefStack> &P);
} // end namespace rdf
diff --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index b4254e45f8715..382dcbe9b7495 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -46,12 +46,12 @@ using namespace rdf;
namespace llvm {
namespace rdf {
-auto operator<<(raw_ostream &OS, const Print<RegisterRef> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterRef> &P) {
P.G.getPRI().print(OS, P.Obj);
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<NodeId> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<NodeId> &P) {
auto NA = P.G.addr<NodeBase *>(P.Obj);
uint16_t Attrs = NA.Addr->getAttrs();
uint16_t Kind = NodeAttrs::kind(Attrs);
@@ -110,14 +110,14 @@ auto operator<<(raw_ostream &OS, const Print<NodeId> &P) -> raw_ostream & {
return OS;
}
-static auto printRefHeader(raw_ostream &OS, const Ref RA,
- const DataFlowGraph &G) -> void {
+static void printRefHeader(raw_ostream &OS, const Ref RA,
+ const DataFlowGraph &G) {
OS << Print(RA.Id, G) << '<' << Print(RA.Addr->getRegRef(G), G) << '>';
if (RA.Addr->getFlags() & NodeAttrs::Fixed)
OS << '!';
}
-auto operator<<(raw_ostream &OS, const Print<Def> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Def> &P) {
printRefHeader(OS, P.Obj, P.G);
OS << '(';
if (NodeId N = P.Obj.Addr->getReachingDef())
@@ -134,7 +134,7 @@ auto operator<<(raw_ostream &OS, const Print<Def> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<Use> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Use> &P) {
printRefHeader(OS, P.Obj, P.G);
OS << '(';
if (NodeId N = P.Obj.Addr->getReachingDef())
@@ -145,7 +145,7 @@ auto operator<<(raw_ostream &OS, const Print<Use> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<PhiUse> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<PhiUse> &P) {
printRefHeader(OS, P.Obj, P.G);
OS << '(';
if (NodeId N = P.Obj.Addr->getReachingDef())
@@ -159,7 +159,7 @@ auto operator<<(raw_ostream &OS, const Print<PhiUse> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<Ref> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Ref> &P) {
switch (P.Obj.Addr->getKind()) {
case NodeAttrs::Def:
OS << PrintNode<DefNode *>(P.Obj, P.G);
@@ -174,7 +174,7 @@ auto operator<<(raw_ostream &OS, const Print<Ref> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<NodeList> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<NodeList> &P) {
unsigned N = P.Obj.size();
for (auto I : P.Obj) {
OS << Print(I.Id, P.G);
@@ -184,7 +184,7 @@ auto operator<<(raw_ostream &OS, const Print<NodeList> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<NodeSet> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<NodeSet> &P) {
unsigned N = P.Obj.size();
for (auto I : P.Obj) {
OS << Print(I, P.G);
@@ -205,7 +205,7 @@ template <typename T> struct PrintListV {
};
template <typename T>
-auto operator<<(raw_ostream &OS, const PrintListV<T> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const PrintListV<T> &P) {
unsigned N = P.List.size();
for (NodeAddr<T> A : P.List) {
OS << PrintNode<T>(A, P.G);
@@ -217,13 +217,13 @@ auto operator<<(raw_ostream &OS, const PrintListV<T> &P) -> raw_ostream & {
} // end anonymous namespace
-auto operator<<(raw_ostream &OS, const Print<Phi> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Phi> &P) {
OS << Print(P.Obj.Id, P.G) << ": phi ["
<< PrintListV<RefNode *>(P.Obj.Addr->members(P.G), P.G) << ']';
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<Stmt> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Stmt> &P) {
const MachineInstr &MI = *P.Obj.Addr->getCode();
unsigned Opc = MI.getOpcode();
OS << Print(P.Obj.Id, P.G) << ": " << P.G.getTII().getName(Opc);
@@ -247,7 +247,7 @@ auto operator<<(raw_ostream &OS, const Print<Stmt> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<Instr> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Instr> &P) {
switch (P.Obj.Addr->getKind()) {
case NodeAttrs::Phi:
OS << PrintNode<PhiNode *>(P.Obj, P.G);
@@ -262,7 +262,7 @@ auto operator<<(raw_ostream &OS, const Print<Instr> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<Block> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Block> &P) {
MachineBasicBlock *BB = P.Obj.Addr->getCode();
unsigned NP = BB->pred_size();
std::vector<int> Ns;
@@ -294,7 +294,7 @@ auto operator<<(raw_ostream &OS, const Print<Block> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<Func> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<Func> &P) {
OS << "DFG dump:[\n"
<< Print(P.Obj.Id, P.G)
<< ": Function: " << P.Obj.Addr->getCode()->getName() << '\n';
@@ -304,7 +304,7 @@ auto operator<<(raw_ostream &OS, const Print<Func> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<RegisterSet> &P) -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterSet> &P) {
OS << '{';
for (auto I : P.Obj)
OS << ' ' << Print(I, P.G);
@@ -312,14 +312,13 @@ auto operator<<(raw_ostream &OS, const Print<RegisterSet> &P) -> raw_ostream & {
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<RegisterAggr> &P)
- -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterAggr> &P) {
OS << P.Obj;
return OS;
}
-auto operator<<(raw_ostream &OS, const Print<DataFlowGraph::DefStack> &P)
- -> raw_ostream & {
+raw_ostream &operator<<(raw_ostream &OS,
+ const Print<DataFlowGraph::DefStack> &P) {
for (auto I = P.Obj.top(), E = P.Obj.bottom(); I != E;) {
OS << Print(I->Id, P.G) << '<' << Print(I->Addr->getRegRef(P.G), P.G)
<< '>';
@@ -342,7 +341,7 @@ auto operator<<(raw_ostream &OS, const Print<DataFlowGraph::DefStack> &P)
// There is a mapping scheme between node id and its location in a block,
// and within that block is described in the header file.
//
-auto NodeAllocator::startNewBlock() -> void {
+void NodeAllocator::startNewBlock() {
void *T = MemPool.Allocate(NodesPerBlock * NodeMemSize, NodeMemSize);
char *P = static_cast<char *>(T);
Blocks.push_back(P);
@@ -354,7 +353,7 @@ auto NodeAllocator::startNewBlock() -> void {
ActiveEnd = P;
}
-auto NodeAllocator::needNewBlock() -> bool {
+bool NodeAllocator::needNewBlock() {
if (Blocks.empty())
return true;
@@ -363,7 +362,7 @@ auto NodeAllocator::needNewBlock() -> bool {
return Index >= NodesPerBlock;
}
-auto NodeAllocator::New() -> Node {
+Node NodeAllocator::New() {
if (needNewBlock())
startNewBlock();
@@ -374,7 +373,7 @@ auto NodeAllocator::New() -> Node {
return NA;
}
-auto NodeAllocator::id(const NodeBase *P) const -> NodeId {
+NodeId NodeAllocator::id(const NodeBase *P) const {
uintptr_t A = reinterpret_cast<uintptr_t>(P);
for (unsigned i = 0, n = Blocks.size(); i != n; ++i) {
uintptr_t B = reinterpret_cast<uintptr_t>(Blocks[i]);
@@ -386,14 +385,14 @@ auto NodeAllocator::id(const NodeBase *P) const -> NodeId {
llvm_unreachable("Invalid node address");
}
-auto NodeAllocator::clear() -> void {
+void NodeAllocator::clear() {
MemPool.Reset();
Blocks.clear();
ActiveEnd = nullptr;
}
// Insert node NA after "this" in the circular chain.
-auto NodeBase::append(Node NA) -> void {
+void NodeBase::append(Node NA) {
NodeId Nx = Next;
// If NA is already "next", do nothing.
if (Next != NA.Id) {
@@ -405,7 +404,7 @@ auto NodeBase::append(Node NA) -> void {
// Fundamental node manipulator functions.
// Obtain the register reference from a reference node.
-auto RefNode::getRegRef(const DataFlowGraph &G) const -> RegisterRef {
+RegisterRef RefNode::getRegRef(const DataFlowGraph &G) const {
assert(NodeAttrs::type(Attrs) == NodeAttrs::Ref);
if (NodeAttrs::flags(Attrs) & NodeAttrs::PhiRef)
return G.unpack(RefData.PR);
@@ -415,7 +414,7 @@ auto RefNode::getRegRef(const DataFlowGraph &G) const -> RegisterRef {
// Set the register reference in the reference node directly (for references
// in phi nodes).
-auto RefNode::setRegRef(RegisterRef RR, DataFlowGraph &G) -> void {
+void RefNode::setRegRef(RegisterRef RR, DataFlowGraph &G) {
assert(NodeAttrs::type(Attrs) == NodeAttrs::Ref);
assert(NodeAttrs::flags(Attrs) & NodeAttrs::PhiRef);
RefData.PR = G.pack(RR);
@@ -423,7 +422,7 @@ auto RefNode::setRegRef(RegisterRef RR, DataFlowGraph &G) -> void {
// Set the register reference in the reference node based on a machine
// operand (for references in statement nodes).
-auto RefNode::setRegRef(MachineOperand *Op, DataFlowGraph &G) -> void {
+void RefNode::setRegRef(MachineOperand *Op, DataFlowGraph &G) {
assert(NodeAttrs::type(Attrs) == NodeAttrs::Ref);
assert(!(NodeAttrs::flags(Attrs) & NodeAttrs::PhiRef));
(void)G;
@@ -431,7 +430,7 @@ auto RefNode::setRegRef(MachineOperand *Op, DataFlowGraph &G) -> void {
}
// Get the owner of a given reference node.
-auto RefNode::getOwner(const DataFlowGraph &G) -> Node {
+Node RefNode::getOwner(const DataFlowGraph &G) {
Node NA = G.addr<NodeBase *>(getNext());
while (NA.Addr != this) {
@@ -443,35 +442,35 @@ auto RefNode::getOwner(const DataFlowGraph &G) -> Node {
}
// Connect the def node to the reaching def node.
-auto DefNode::linkToDef(NodeId Self, Def DA) -> void {
+void DefNode::linkToDef(NodeId Self, Def DA) {
RefData.RD = DA.Id;
RefData.Sib = DA.Addr->getReachedDef();
DA.Addr->setReachedDef(Self);
}
// Connect the use node to the reaching def node.
-auto UseNode::linkToDef(NodeId Self, Def DA) -> void {
+void UseNode::linkToDef(NodeId Self, Def DA) {
RefData.RD = DA.Id;
RefData.Sib = DA.Addr->getReachedUse();
DA.Addr->setReachedUse(Self);
}
// Get the first member of the code node.
-auto CodeNode::getFirstMember(const DataFlowGraph &G) const -> Node {
+Node CodeNode::getFirstMember(const DataFlowGraph &G) const {
if (CodeData.FirstM == 0)
return Node();
return G.addr<NodeBase *>(CodeData.FirstM);
}
// Get the last member of the code node.
-auto CodeNode::getLastMember(const DataFlowGraph &G) const -> Node {
+Node CodeNode::getLastMember(const DataFlowGraph &G) const {
if (CodeData.LastM == 0)
return Node();
return G.addr<NodeBase *>(CodeData.LastM);
}
// Add node NA at the end of the member list of the given code node.
-auto CodeNode::addMember(Node NA, const DataFlowGraph &G) -> void {
+void CodeNode::addMember(Node NA, const DataFlowGraph &G) {
Node ML = getLastMember(G);
if (ML.Id != 0) {
ML.Addr->append(NA);
@@ -484,15 +483,14 @@ auto CodeNode::addMember(Node NA, const DataFlowGraph &G) -> void {
}
// Add node NA after member node MA in the given code node.
-auto CodeNode::addMemberAfter(Node MA, Node NA, const DataFlowGraph &G)
- -> void {
+void CodeNode::addMemberAfter(Node MA, Node NA, const DataFlowGraph &G) {
MA.Addr->append(NA);
if (CodeData.LastM == MA.Id)
CodeData.LastM = NA.Id;
}
// Remove member node NA from the given code node.
-auto CodeNode::removeMember(Node NA, const DataFlowGraph &G) -> void {
+void CodeNode::removeMember(Node NA, const DataFlowGraph &G) {
Node MA = getFirstMember(G);
assert(MA.Id != 0);
@@ -524,13 +522,13 @@ auto CodeNode::removeMember(Node NA, const DataFlowGraph &G) -> void {
}
// Return the list of all members of the code node.
-auto CodeNode::members(const DataFlowGraph &G) const -> NodeList {
+NodeList CodeNode::members(const DataFlowGraph &G) const {
static auto True = [](Node) -> bool { return true; };
return members_if(True, G);
}
// Return the owner of the given instr node.
-auto InstrNode::getOwner(const DataFlowGraph &G) -> Node {
+Node InstrNode::getOwner(const DataFlowGraph &G) {
Node NA = G.addr<NodeBase *>(getNext());
while (NA.Addr != this) {
@@ -543,7 +541,7 @@ auto InstrNode::getOwner(const DataFlowGraph &G) -> Node {
}
// Add the phi node PA to the given block node.
-auto BlockNode::addPhi(Phi PA, const DataFlowGraph &G) -> void {
+void BlockNode::addPhi(Phi PA, const DataFlowGraph &G) {
Node M = getFirstMember(G);
if (M.Id == 0) {
addMember(PA, G);
@@ -573,8 +571,8 @@ auto BlockNode::addPhi(Phi PA, const DataFlowGraph &G) -> void {
// Find the block node corresponding to the machine basic block BB in the
// given func node.
-auto FuncNode::findBlock(const MachineBasicBlock *BB,
- const DataFlowGraph &G) const -> Block {
+Block FuncNode::findBlock(const MachineBasicBlock *BB,
+ const DataFlowGraph &G) const {
auto EqBB = [BB](Node NA) -> bool { return Block(NA).Addr->getCode() == BB; };
NodeList Ms = members_if(EqBB, G);
if (!Ms.empty())
@@ -583,7 +581,7 @@ auto FuncNode::findBlock(const MachineBasicBlock *BB,
}
// Get the block node for the entry block in the given function.
-auto FuncNode::getEntryBlock(const DataFlowGraph &G) -> Block {
+Block FuncNode::getEntryBlock(const DataFlowGraph &G) {
MachineBasicBlock *EntryB = &getCode()->front();
return findBlock(EntryB, G);
}
@@ -593,14 +591,14 @@ auto FuncNode::getEntryBlock(const DataFlowGraph &G) -> Block {
// For a given instruction, check if there are any bits of RR that can remain
// unchanged across this def.
-auto TargetOperandInfo::isPreserving(const MachineInstr &In,
- unsigned OpNum) const -> bool {
+bool TargetOperandInfo::isPreserving(const MachineInstr &In,
+ unsigned OpNum) const {
return TII.isPredicated(In);
}
// Check if the definition of RR produces an unspecified value.
-auto TargetOperandInfo::isClobbering(const MachineInstr &In,
- unsigned OpNum) const -> bool {
+bool TargetOperandInfo::isClobbering(const MachineInstr &In,
+ unsigned OpNum) const {
const MachineOperand &Op = In.getOperand(OpNum);
if (Op.isRegMask())
return true;
@@ -612,8 +610,8 @@ auto TargetOperandInfo::isClobbering(const MachineInstr &In,
}
// Check if the given instruction specifically requires
-auto TargetOperandInfo::isFixedReg(const MachineInstr &In, unsigned OpNum) const
- -> bool {
+bool TargetOperandInfo::isFixedReg(const MachineInstr &In,
+ unsigned OpNum) const {
if (In.isCall() || In.isReturn() || In.isInlineAsm())
return true;
// Check for a tail call.
@@ -678,7 +676,7 @@ DataFlowGraph::DefStack::Iterator::Iterator(const DataFlowGraph::DefStack &S,
}
// Return the size of the stack, including block delimiters.
-auto DataFlowGraph::DefStack::size() const -> unsigned {
+unsigned DataFlowGraph::DefStack::size() const {
unsigned S = 0;
for (auto I = top(), E = bottom(); I != E; I.down())
S++;
@@ -688,14 +686,14 @@ auto DataFlowGraph::DefStack::size() const -> unsigned {
// Remove the top entry from the stack. Remove all intervening delimiters
// so that after this, the stack is either empty, or the top of the stack
// is a non-delimiter.
-auto DataFlowGraph::DefStack::pop() -> void {
+void DataFlowGraph::DefStack::pop() {
assert(!empty());
unsigned P = nextDown(Stack.size());
Stack.resize(P);
}
// Push a delimiter for block node N on the stack.
-auto DataFlowGraph::DefStack::start_block(NodeId N) -> void {
+void DataFlowGraph::DefStack::start_block(NodeId N) {
assert(N != 0);
Stack.push_back(Def(nullptr, N));
}
@@ -703,7 +701,7 @@ auto DataFlowGraph::DefStack::start_block(NodeId N) -> void {
// Remove all nodes from the top of the stack, until the delimited for
// block node N is encountered. Remove the delimiter as well. In effect,
// this will remove from the stack all definitions from block N.
-auto DataFlowGraph::DefStack::clear_block(NodeId N) -> void {
+void DataFlowGraph::DefStack::clear_block(NodeId N) {
assert(N != 0);
unsigned P = Stack.size();
while (P > 0) {
@@ -717,7 +715,7 @@ auto DataFlowGraph::DefStack::clear_block(NodeId N) -> void {
}
// Move the stack iterator up by one.
-auto DataFlowGraph::DefStack::nextUp(unsigned P) const -> unsigned {
+unsigned DataFlowGraph::DefStack::nextUp(unsigned P) const {
// Get the next valid position after P (skipping all delimiters).
// The input position P does not have to point to a non-delimiter.
unsigned SS = Stack.size();
@@ -732,7 +730,7 @@ auto DataFlowGraph::DefStack::nextUp(unsigned P) const -> unsigned {
}
// Move the stack iterator down by one.
-auto DataFlowGraph::DefStack::nextDown(unsigned P) const -> unsigned {
+unsigned DataFlowGraph::DefStack::nextDown(unsigned P) const {
// Get the preceding valid position before P (skipping all delimiters).
// The input position P does not have to point to a non-delimiter.
assert(P > 0 && P <= Stack.size());
@@ -748,7 +746,7 @@ auto DataFlowGraph::DefStack::nextDown(unsigned P) const -> unsigned {
// Register information.
-auto DataFlowGraph::getLandingPadLiveIns() const -> RegisterAggr {
+RegisterAggr DataFlowGraph::getLandingPadLiveIns() const {
RegisterAggr LR(getPRI());
const Function &F = MF.getFunction();
const Constant *PF = F.hasPersonalityFn() ? F.getPersonalityFn() : nullptr;
@@ -765,21 +763,21 @@ auto DataFlowGraph::getLandingPadLiveIns() const -> RegisterAggr {
// Node management functions.
// Get the pointer to the node with the id N.
-auto DataFlowGraph::ptr(NodeId N) const -> NodeBase * {
+NodeBase *DataFlowGraph::ptr(NodeId N) const {
if (N == 0)
return nullptr;
return Memory.ptr(N);
}
// Get the id of the node at the address P.
-auto DataFlowGraph::id(const NodeBase *P) const -> NodeId {
+NodeId DataFlowGraph::id(const NodeBase *P) const {
if (P == nullptr)
return 0;
return Memory.id(P);
}
// Allocate a new node and set the attributes to Attrs.
-auto DataFlowGraph::newNode(uint16_t Attrs) -> Node {
+Node DataFlowGraph::newNode(uint16_t Attrs) {
Node P = Memory.New();
P.Addr->init();
P.Addr->setAttrs(Attrs);
@@ -788,7 +786,7 @@ auto DataFlowGraph::newNode(uint16_t Attrs) -> Node {
// Make a copy of the given node B, except for the data-flow links, which
// are set to 0.
-auto DataFlowGraph::cloneNode(const Node B) -> Node {
+Node DataFlowGraph::cloneNode(const Node B) {
Node NA = newNode(0);
memcpy(NA.Addr, B.Addr, sizeof(NodeBase));
// Ref nodes need to have the data-flow links reset.
@@ -807,15 +805,15 @@ auto DataFlowGraph::cloneNode(const Node B) -> Node {
// Allocation routines for specific node types/kinds.
-auto DataFlowGraph::newUse(Instr Owner, MachineOperand &Op, uint16_t Flags)
- -> Use {
+rdf::Use DataFlowGraph::newUse(Instr Owner, MachineOperand &Op,
+ uint16_t Flags) {
Use UA = newNode(NodeAttrs::Ref | NodeAttrs::Use | Flags);
UA.Addr->setRegRef(&Op, *this);
return UA;
}
-auto DataFlowGraph::newPhiUse(Phi Owner, RegisterRef RR, Block PredB,
- uint16_t Flags) -> PhiUse {
+PhiUse DataFlowGraph::newPhiUse(Phi Owner, RegisterRef RR, Block PredB,
+ uint16_t Flags) {
PhiUse PUA = newNode(NodeAttrs::Ref | NodeAttrs::Use | Flags);
assert(Flags & NodeAttrs::PhiRef);
PUA.Addr->setRegRef(RR, *this);
@@ -823,48 +821,47 @@ auto DataFlowGraph::newPhiUse(Phi Owner, RegisterRef RR, Block PredB,
return PUA;
}
-auto DataFlowGraph::newDef(Instr Owner, MachineOperand &Op, uint16_t Flags)
- -> Def {
+Def DataFlowGraph::newDef(Instr Owner, MachineOperand &Op, uint16_t Flags) {
Def DA = newNode(NodeAttrs::Ref | NodeAttrs::Def | Flags);
DA.Addr->setRegRef(&Op, *this);
return DA;
}
-auto DataFlowGraph::newDef(Instr Owner, RegisterRef RR, uint16_t Flags) -> Def {
+Def DataFlowGraph::newDef(Instr Owner, RegisterRef RR, uint16_t Flags) {
Def DA = newNode(NodeAttrs::Ref | NodeAttrs::Def | Flags);
assert(Flags & NodeAttrs::PhiRef);
DA.Addr->setRegRef(RR, *this);
return DA;
}
-auto DataFlowGraph::newPhi(Block Owner) -> Phi {
+Phi DataFlowGraph::newPhi(Block Owner) {
Phi PA = newNode(NodeAttrs::Code | NodeAttrs::Phi);
Owner.Addr->addPhi(PA, *this);
return PA;
}
-auto DataFlowGraph::newStmt(Block Owner, MachineInstr *MI) -> Stmt {
+Stmt DataFlowGraph::newStmt(Block Owner, MachineInstr *MI) {
Stmt SA = newNode(NodeAttrs::Code | NodeAttrs::Stmt);
SA.Addr->setCode(MI);
Owner.Addr->addMember(SA, *this);
return SA;
}
-auto DataFlowGraph::newBlock(Func Owner, MachineBasicBlock *BB) -> Block {
+Block DataFlowGraph::newBlock(Func Owner, MachineBasicBlock *BB) {
Block BA = newNode(NodeAttrs::Code | NodeAttrs::Block);
BA.Addr->setCode(BB);
Owner.Addr->addMember(BA, *this);
return BA;
}
-auto DataFlowGraph::newFunc(MachineFunction *MF) -> Func {
+Func DataFlowGraph::newFunc(MachineFunction *MF) {
Func FA = newNode(NodeAttrs::Code | NodeAttrs::Func);
FA.Addr->setCode(MF);
return FA;
}
// Build the data flow graph.
-auto DataFlowGraph::build(unsigned Options) -> void {
+void DataFlowGraph::build(unsigned Options) {
reset();
TheFunc = newFunc(&MF);
@@ -960,8 +957,7 @@ auto DataFlowGraph::build(unsigned Options) -> void {
removeUnusedPhis();
}
-auto DataFlowGraph::makeRegRef(unsigned Reg, unsigned Sub) const
- -> RegisterRef {
+RegisterRef DataFlowGraph::makeRegRef(unsigned Reg, unsigned Sub) const {
assert(RegisterRef::isRegId(Reg) || RegisterRef::isMaskId(Reg));
assert(Reg != 0);
if (Sub != 0)
@@ -969,7 +965,7 @@ auto DataFlowGraph::makeRegRef(unsigned Reg, unsigned Sub) const
return RegisterRef(Reg);
}
-auto DataFlowGraph::makeRegRef(const MachineOperand &Op) const -> RegisterRef {
+RegisterRef DataFlowGraph::makeRegRef(const MachineOperand &Op) const {
assert(Op.isReg() || Op.isRegMask());
if (Op.isReg())
return makeRegRef(Op.getReg(), Op.getSubReg());
@@ -978,14 +974,14 @@ auto DataFlowGraph::makeRegRef(const MachineOperand &Op) const -> RegisterRef {
}
// For each stack in the map DefM, push the delimiter for block B on it.
-auto DataFlowGraph::markBlock(NodeId B, DefStackMap &DefM) -> void {
+void DataFlowGraph::markBlock(NodeId B, DefStackMap &DefM) {
// Push block delimiters.
for (auto &P : DefM)
P.second.start_block(B);
}
// Remove all definitions coming from block B from each stack in DefM.
-auto DataFlowGraph::releaseBlock(NodeId B, DefStackMap &DefM) -> void {
+void DataFlowGraph::releaseBlock(NodeId B, DefStackMap &DefM) {
// Pop all defs from this block from the definition stack. Defs that were
// added to the map during the traversal of instructions will not have a
// delimiter, but for those, the whole stack will be emptied.
@@ -1003,14 +999,14 @@ auto DataFlowGraph::releaseBlock(NodeId B, DefStackMap &DefM) -> void {
// Push all definitions from the instruction node IA to an appropriate
// stack in DefM.
-auto DataFlowGraph::pushAllDefs(Instr IA, DefStackMap &DefM) -> void {
+void DataFlowGraph::pushAllDefs(Instr IA, DefStackMap &DefM) {
pushClobbers(IA, DefM);
pushDefs(IA, DefM);
}
// Push all definitions from the instruction node IA to an appropriate
// stack in DefM.
-auto DataFlowGraph::pushClobbers(Instr IA, DefStackMap &DefM) -> void {
+void DataFlowGraph::pushClobbers(Instr IA, DefStackMap &DefM) {
NodeSet Visited;
std::set<RegisterId> Defined;
@@ -1054,7 +1050,7 @@ auto DataFlowGraph::pushClobbers(Instr IA, DefStackMap &DefM) -> void {
// Push all definitions from the instruction node IA to an appropriate
// stack in DefM.
-auto DataFlowGraph::pushDefs(Instr IA, DefStackMap &DefM) -> void {
+void DataFlowGraph::pushDefs(Instr IA, DefStackMap &DefM) {
NodeSet Visited;
#ifndef NDEBUG
std::set<RegisterId> Defined;
@@ -1108,7 +1104,7 @@ auto DataFlowGraph::pushDefs(Instr IA, DefStackMap &DefM) -> void {
// Return the list of all reference nodes related to RA, including RA itself.
// See "getNextRelated" for the meaning of a "related reference".
-auto DataFlowGraph::getRelatedRefs(Instr IA, Ref RA) const -> NodeList {
+NodeList DataFlowGraph::getRelatedRefs(Instr IA, Ref RA) const {
assert(IA.Id != 0 && RA.Id != 0);
NodeList Refs;
@@ -1121,7 +1117,7 @@ auto DataFlowGraph::getRelatedRefs(Instr IA, Ref RA) const -> NodeList {
}
// Clear all information in the graph.
-auto DataFlowGraph::reset() -> void {
+void DataFlowGraph::reset() {
Memory.clear();
BlockNodes.clear();
TheFunc = Func();
@@ -1133,7 +1129,7 @@ auto DataFlowGraph::reset() -> void {
// characteristics. Specific examples of related nodes are shadow reference
// nodes.
// Return the equivalent of nullptr if there are no more related references.
-auto DataFlowGraph::getNextRelated(Instr IA, Ref RA) const -> Ref {
+Ref DataFlowGraph::getNextRelated(Instr IA, Ref RA) const {
assert(IA.Id != 0 && RA.Id != 0);
auto Related = [this, RA](Ref TA) -> bool {
@@ -1171,8 +1167,8 @@ auto DataFlowGraph::getNextRelated(Instr IA, Ref RA) const -> Ref {
// first element is the element after which such a node should be inserted,
// and the second element is a null-address.
template <typename Predicate>
-auto DataFlowGraph::locateNextRef(Instr IA, Ref RA, Predicate P) const
- -> std::pair<Ref, Ref> {
+std::pair<Ref, Ref> DataFlowGraph::locateNextRef(Instr IA, Ref RA,
+ Predicate P) const {
assert(IA.Id != 0 && RA.Id != 0);
Ref NA;
@@ -1193,7 +1189,7 @@ auto DataFlowGraph::locateNextRef(Instr IA, Ref RA, Predicate P) const
// Get the next shadow node in IA corresponding to RA, and optionally create
// such a node if it does not exist.
-auto DataFlowGraph::getNextShadow(Instr IA, Ref RA, bool Create) -> Ref {
+Ref DataFlowGraph::getNextShadow(Instr IA, Ref RA, bool Create) {
assert(IA.Id != 0 && RA.Id != 0);
uint16_t Flags = RA.Addr->getFlags() | NodeAttrs::Shadow;
@@ -1213,7 +1209,7 @@ auto DataFlowGraph::getNextShadow(Instr IA, Ref RA, bool Create) -> Ref {
// Get the next shadow node in IA corresponding to RA. Return null-address
// if such a node does not exist.
-auto DataFlowGraph::getNextShadow(Instr IA, Ref RA) const -> Ref {
+Ref DataFlowGraph::getNextShadow(Instr IA, Ref RA) const {
assert(IA.Id != 0 && RA.Id != 0);
uint16_t Flags = RA.Addr->getFlags() | NodeAttrs::Shadow;
auto IsShadow = [Flags](Ref TA) -> bool {
@@ -1224,7 +1220,7 @@ auto DataFlowGraph::getNextShadow(Instr IA, Ref RA) const -> Ref {
// Create a new statement node in the block node BA that corresponds to
// the machine instruction MI.
-auto DataFlowGraph::buildStmt(Block BA, MachineInstr &In) -> void {
+void DataFlowGraph::buildStmt(Block BA, MachineInstr &In) {
Stmt SA = newStmt(BA, &In);
auto isCall = [](const MachineInstr &In) -> bool {
@@ -1358,7 +1354,7 @@ auto DataFlowGraph::buildStmt(Block BA, MachineInstr &In) -> void {
// Scan all defs in the block node BA and record in PhiM the locations of
// phi nodes corresponding to these defs.
-auto DataFlowGraph::recordDefsForDF(BlockRefsMap &PhiM, Block BA) -> void {
+void DataFlowGraph::recordDefsForDF(BlockRefsMap &PhiM, Block BA) {
// Check all defs from block BA and record them in each block in BA's
// iterated dominance frontier. This information will later be used to
// create phi nodes.
@@ -1397,8 +1393,8 @@ auto DataFlowGraph::recordDefsForDF(BlockRefsMap &PhiM, Block BA) -> void {
// Given the locations of phi nodes in the map PhiM, create the phi nodes
// that are located in the block node BA.
-auto DataFlowGraph::buildPhis(BlockRefsMap &PhiM, RegisterSet &AllRefs,
- Block BA) -> void {
+void DataFlowGraph::buildPhis(BlockRefsMap &PhiM, RegisterSet &AllRefs,
+ Block BA) {
// Check if this blocks has any DF defs, i.e. if there are any defs
// that this block is in the iterated dominance frontier of.
auto HasDF = PhiM.find(BA.Id);
@@ -1426,7 +1422,7 @@ auto DataFlowGraph::buildPhis(BlockRefsMap &PhiM, RegisterSet &AllRefs,
}
// Remove any unneeded phi nodes that were created during the build process.
-auto DataFlowGraph::removeUnusedPhis() -> void {
+void DataFlowGraph::removeUnusedPhis() {
// This will remove unused phis, i.e. phis where each def does not reach
// any uses or other defs. This will not detect or remove circular phi
// chains that are otherwise dead. Unused/dead phis are created during
@@ -1480,7 +1476,7 @@ auto DataFlowGraph::removeUnusedPhis() -> void {
// reaching def of TA to the appropriate def node. Create any shadow nodes
// as appropriate.
template <typename T>
-auto DataFlowGraph::linkRefUp(Instr IA, NodeAddr<T> TA, DefStack &DS) -> void {
+void DataFlowGraph::linkRefUp(Instr IA, NodeAddr<T> TA, DefStack &DS) {
if (DS.empty())
return;
RegisterRef RR = TA.Addr->getRegRef(*this);
@@ -1524,8 +1520,7 @@ auto DataFlowGraph::linkRefUp(Instr IA, NodeAddr<T> TA, DefStack &DS) -> void {
// Create data-flow links for all reference nodes in the statement node SA.
template <typename Predicate>
-auto DataFlowGraph::linkStmtRefs(DefStackMap &DefM, Stmt SA, Predicate P)
- -> void {
+void DataFlowGraph::linkStmtRefs(DefStackMap &DefM, Stmt SA, Predicate P) {
#ifndef NDEBUG
RegisterSet Defs(getPRI());
#endif
@@ -1556,7 +1551,7 @@ auto DataFlowGraph::linkStmtRefs(DefStackMap &DefM, Stmt SA, Predicate P)
// Create data-flow links for all instructions in the block node BA. This
// will include updating any phi nodes in BA.
-auto DataFlowGraph::linkBlockRefs(DefStackMap &DefM, Block BA) -> void {
+void DataFlowGraph::linkBlockRefs(DefStackMap &DefM, Block BA) {
// Push block delimiters.
markBlock(BA.Id, DefM);
@@ -1634,7 +1629,7 @@ auto DataFlowGraph::linkBlockRefs(DefStackMap &DefM, Block BA) -> void {
}
// Remove the use node UA from any data-flow and structural links.
-auto DataFlowGraph::unlinkUseDF(Use UA) -> void {
+void DataFlowGraph::unlinkUseDF(Use UA) {
NodeId RD = UA.Addr->getReachingDef();
NodeId Sib = UA.Addr->getSibling();
@@ -1661,7 +1656,7 @@ auto DataFlowGraph::unlinkUseDF(Use UA) -> void {
}
// Remove the def node DA from any data-flow and structural links.
-auto DataFlowGraph::unlinkDefDF(Def DA) -> void {
+void DataFlowGraph::unlinkDefDF(Def DA) {
//
// RD
// | reached
More information about the llvm-commits
mailing list