diff options
Diffstat (limited to 'include/llvm/CodeGen')
63 files changed, 382 insertions, 243 deletions
diff --git a/include/llvm/CodeGen/Analysis.h b/include/llvm/CodeGen/Analysis.h index c4b94ed..96e9554 100644 --- a/include/llvm/CodeGen/Analysis.h +++ b/include/llvm/CodeGen/Analysis.h @@ -115,6 +115,6 @@ bool returnTypeIsEligibleForTailCall(const Function *F, // or we are in LTO. bool canBeOmittedFromSymbolTable(const GlobalValue *GV); -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 47201e2..8a0989f 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -418,16 +418,17 @@ public: /// Emit reference to a ttype global with a specified encoding. void EmitTTypeReference(const GlobalValue *GV, unsigned Encoding) const; - /// Emit the 4-byte offset of Label from the start of its section. This can - /// be done with a special directive if the target supports it (e.g. cygwin) - /// or by emitting it as an offset from a label at the start of the section. - void emitSectionOffset(const MCSymbol *Label) const; + /// Emit a reference to a symbol for use in dwarf. Different object formats + /// represent this in different ways. Some use a relocation others encode + /// the label offset in its section. + void emitDwarfSymbolReference(const MCSymbol *Label, + bool ForceOffset = false) const; /// Emit the 4-byte offset of a string from the start of its section. /// /// When possible, emit a DwarfStringPool section offset without any /// relocations, and without using the symbol. Otherwise, defers to \a - /// emitSectionOffset(). + /// emitDwarfSymbolReference(). void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const; /// Get the value for DW_AT_APPLE_isa. Zero if no isa encoding specified. @@ -534,6 +535,6 @@ private: void EmitXXStructorList(const Constant *List, bool isCtor); GCMetadataPrinter *GetOrCreateGCPrinter(GCStrategy &C); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/BasicTTIImpl.h b/include/llvm/CodeGen/BasicTTIImpl.h index 3e464f4..cb61cc7 100644 --- a/include/llvm/CodeGen/BasicTTIImpl.h +++ b/include/llvm/CodeGen/BasicTTIImpl.h @@ -830,6 +830,6 @@ public: } }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h index 91fb0a9..7c90190 100644 --- a/include/llvm/CodeGen/CalcSpillWeights.h +++ b/include/llvm/CodeGen/CalcSpillWeights.h @@ -74,6 +74,6 @@ namespace llvm { const MachineBlockFrequencyInfo &MBFI, VirtRegAuxInfo::NormalizingFn norm = normalizeSpillWeight); -} +} // namespace llvm #endif // LLVM_CODEGEN_CALCSPILLWEIGHTS_H diff --git a/include/llvm/CodeGen/CommandFlags.h b/include/llvm/CodeGen/CommandFlags.h index b824df3..3c3f770 100644 --- a/include/llvm/CodeGen/CommandFlags.h +++ b/include/llvm/CodeGen/CommandFlags.h @@ -16,6 +16,7 @@ #ifndef LLVM_CODEGEN_COMMANDFLAGS_H #define LLVM_CODEGEN_COMMANDFLAGS_H +#include "llvm/ADT/StringExtras.h" #include "llvm/IR/Module.h" #include "llvm/MC/MCTargetOptionsCommandFlags.h" #include "llvm//MC/SubtargetFeature.h" @@ -150,7 +151,7 @@ FuseFPOps("fp-contract", clEnumValN(FPOpFusion::Standard, "on", "Only fuse 'blessed' FP ops."), clEnumValN(FPOpFusion::Strict, "off", - "Only fuse FP ops when the result won't be effected."), + "Only fuse FP ops when the result won't be affected."), clEnumValEnd)); cl::list<std::string> @@ -247,7 +248,6 @@ static inline TargetOptions InitTargetOptionsFromCodeGenFlags() { Options.FloatABIType = FloatABIForCalls; Options.NoZerosInBSS = DontPlaceZerosInBSS; Options.GuaranteedTailCallOpt = EnableGuaranteedTailCallOpt; - Options.DisableTailCalls = DisableTailCalls; Options.StackAlignmentOverride = OverrideStackAlignment; Options.TrapFuncName = TrapFuncName; Options.PositionIndependentExecutable = EnablePIE; @@ -315,6 +315,11 @@ static inline void setFunctionAttributes(StringRef CPU, StringRef Features, "no-frame-pointer-elim", DisableFPElim ? "true" : "false"); + if (DisableTailCalls.getNumOccurrences() > 0) + NewAttrs = NewAttrs.addAttribute(Ctx, AttributeSet::FunctionIndex, + "disable-tail-calls", + toStringRef(DisableTailCalls)); + // Let NewAttrs override Attrs. NewAttrs = Attrs.addAttributes(Ctx, AttributeSet::FunctionIndex, NewAttrs); F.setAttributes(NewAttrs); diff --git a/include/llvm/CodeGen/DFAPacketizer.h b/include/llvm/CodeGen/DFAPacketizer.h index f9cdc2a..ccff388 100644 --- a/include/llvm/CodeGen/DFAPacketizer.h +++ b/include/llvm/CodeGen/DFAPacketizer.h @@ -159,6 +159,6 @@ public: } }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/DIE.h b/include/llvm/CodeGen/DIE.h index 464e0fa..1ea3217 100644 --- a/include/llvm/CodeGen/DIE.h +++ b/include/llvm/CodeGen/DIE.h @@ -635,6 +635,6 @@ public: #endif }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/FaultMaps.h b/include/llvm/CodeGen/FaultMaps.h new file mode 100644 index 0000000..d5c2fee --- /dev/null +++ b/include/llvm/CodeGen/FaultMaps.h @@ -0,0 +1,73 @@ +//===------------------- FaultMaps.h - StackMaps ----------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_FAULTMAPS_H +#define LLVM_CODEGEN_FAULTMAPS_H + +#include "llvm/ADT/DenseMap.h" +#include "llvm/MC/MCSymbol.h" + +#include <vector> +#include <map> + +namespace llvm { + +class AsmPrinter; +class MCExpr; +class MCSymbol; +class MCStreamer; + +class FaultMaps { +public: + enum FaultKind { FaultingLoad = 1, FaultKindMax }; + + static const char *faultTypeToString(FaultKind); + + explicit FaultMaps(AsmPrinter &AP); + + void recordFaultingOp(FaultKind FaultTy, const MCSymbol *HandlerLabel); + void serializeToFaultMapSection(); + +private: + static const char *WFMP; + + struct FaultInfo { + FaultKind Kind; + const MCExpr *FaultingOffsetExpr; + const MCExpr *HandlerOffsetExpr; + + FaultInfo() + : Kind(FaultKindMax), FaultingOffsetExpr(nullptr), + HandlerOffsetExpr(nullptr) {} + + explicit FaultInfo(FaultMaps::FaultKind Kind, const MCExpr *FaultingOffset, + const MCExpr *HandlerOffset) + : Kind(Kind), FaultingOffsetExpr(FaultingOffset), + HandlerOffsetExpr(HandlerOffset) {} + }; + + typedef std::vector<FaultInfo> FunctionFaultInfos; + + // We'd like to keep a stable iteration order for FunctionInfos to help + // FileCheck based testing. + struct MCSymbolComparator { + bool operator()(const MCSymbol *LHS, const MCSymbol *RHS) const { + return LHS->getName() < RHS->getName(); + } + }; + + std::map<const MCSymbol *, FunctionFaultInfos, MCSymbolComparator> + FunctionInfos; + AsmPrinter &AP; + + void emitFunctionInfo(const MCSymbol *FnLabel, const FunctionFaultInfos &FFI); +}; +} // namespace llvm + +#endif diff --git a/include/llvm/CodeGen/GCMetadata.h b/include/llvm/CodeGen/GCMetadata.h index e883bd1..b34f67a 100644 --- a/include/llvm/CodeGen/GCMetadata.h +++ b/include/llvm/CodeGen/GCMetadata.h @@ -201,6 +201,6 @@ public: /// will soon change. GCFunctionInfo &getFunctionInfo(const Function &F); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/GCMetadataPrinter.h b/include/llvm/CodeGen/GCMetadataPrinter.h index 2208470..e451cd2 100644 --- a/include/llvm/CodeGen/GCMetadataPrinter.h +++ b/include/llvm/CodeGen/GCMetadataPrinter.h @@ -59,6 +59,6 @@ public: virtual ~GCMetadataPrinter(); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/GCStrategy.h b/include/llvm/CodeGen/GCStrategy.h index a1b8e89..2a4dabb 100644 --- a/include/llvm/CodeGen/GCStrategy.h +++ b/include/llvm/CodeGen/GCStrategy.h @@ -172,6 +172,6 @@ public: /// register your GCMetadataPrinter subclass with the /// GCMetadataPrinterRegistery as well. typedef Registry<GCStrategy> GCRegistry; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/GCs.h b/include/llvm/CodeGen/GCs.h index 5207f80..5418fff 100644 --- a/include/llvm/CodeGen/GCs.h +++ b/include/llvm/CodeGen/GCs.h @@ -41,6 +41,6 @@ void linkErlangGCPrinter(); void linkShadowStackGC(); void linkStatepointExampleGC(); -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/ISDOpcodes.h b/include/llvm/CodeGen/ISDOpcodes.h index c2071fe..5a1cf59 100644 --- a/include/llvm/CodeGen/ISDOpcodes.h +++ b/include/llvm/CodeGen/ISDOpcodes.h @@ -890,8 +890,8 @@ namespace ISD { CVT_INVALID /// Marker - Invalid opcode }; -} // end llvm::ISD namespace +} // namespace ISD -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/IntrinsicLowering.h b/include/llvm/CodeGen/IntrinsicLowering.h index 9e6ab7d..a764645 100644 --- a/include/llvm/CodeGen/IntrinsicLowering.h +++ b/include/llvm/CodeGen/IntrinsicLowering.h @@ -54,6 +54,6 @@ namespace llvm { /// simple integer bswap. static bool LowerToByteSwap(CallInst *CI); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/LatencyPriorityQueue.h b/include/llvm/CodeGen/LatencyPriorityQueue.h index f347f66..cc33f34 100644 --- a/include/llvm/CodeGen/LatencyPriorityQueue.h +++ b/include/llvm/CodeGen/LatencyPriorityQueue.h @@ -93,6 +93,6 @@ private: void AdjustPriorityOfUnscheduledPreds(SUnit *SU); SUnit *getSingleUnscheduledPred(SUnit *SU); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h index 7d7e48a..7478c3a 100644 --- a/include/llvm/CodeGen/LexicalScopes.h +++ b/include/llvm/CodeGen/LexicalScopes.h @@ -252,6 +252,6 @@ private: LexicalScope *CurrentFnLexicalScope; }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h index 9b8b91c..ea44ab1 100644 --- a/include/llvm/CodeGen/LiveInterval.h +++ b/include/llvm/CodeGen/LiveInterval.h @@ -866,5 +866,5 @@ namespace llvm { }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index 9673f80..9d68841 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -444,6 +444,6 @@ extern cl::opt<bool> UseSegmentSetForPhysRegs; class HMEditor; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/LiveRangeEdit.h b/include/llvm/CodeGen/LiveRangeEdit.h index c97c636..f04efc3 100644 --- a/include/llvm/CodeGen/LiveRangeEdit.h +++ b/include/llvm/CodeGen/LiveRangeEdit.h @@ -228,6 +228,6 @@ public: const MachineBlockFrequencyInfo&); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/LiveStackAnalysis.h b/include/llvm/CodeGen/LiveStackAnalysis.h index f495507..b4808ab 100644 --- a/include/llvm/CodeGen/LiveStackAnalysis.h +++ b/include/llvm/CodeGen/LiveStackAnalysis.h @@ -95,6 +95,6 @@ namespace llvm { /// print - Implement the dump method. void print(raw_ostream &O, const Module* = nullptr) const override; }; -} +} // namespace llvm #endif /* LLVM_CODEGEN_LIVESTACK_ANALYSIS_H */ diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index 55b97dc..334e8c5 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -306,6 +306,6 @@ public: void setPHIJoin(unsigned Reg) { PHIJoins.set(Reg); } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MIRParser/MIRParser.h b/include/llvm/CodeGen/MIRParser/MIRParser.h index 710b2d4..67b756d 100644 --- a/include/llvm/CodeGen/MIRParser/MIRParser.h +++ b/include/llvm/CodeGen/MIRParser/MIRParser.h @@ -19,33 +19,62 @@ #define LLVM_CODEGEN_MIRPARSER_MIRPARSER_H #include "llvm/ADT/StringRef.h" +#include "llvm/CodeGen/MachineFunctionInitializer.h" #include "llvm/IR/Module.h" #include "llvm/Support/MemoryBuffer.h" #include <memory> namespace llvm { +class MIRParserImpl; class SMDiagnostic; +/// This class initializes machine functions by applying the state loaded from +/// a MIR file. +class MIRParser : public MachineFunctionInitializer { + std::unique_ptr<MIRParserImpl> Impl; + +public: + MIRParser(std::unique_ptr<MIRParserImpl> Impl); + MIRParser(const MIRParser &) = delete; + ~MIRParser(); + + /// Parse the optional LLVM IR module that's embedded in the MIR file. + /// + /// A new, empty module is created if the LLVM IR isn't present. + /// Returns null if a parsing error occurred. + std::unique_ptr<Module> parseLLVMModule(); + + /// Initialize the machine function to the state that's described in the MIR + /// file. + /// + /// Return true if error occurred. + bool initializeMachineFunction(MachineFunction &MF) override; +}; + /// This function is the main interface to the MIR serialization format parser. /// -/// It reads a YAML file that has an optional LLVM IR and returns an LLVM -/// module. +/// It reads in a MIR file and returns a MIR parser that can parse the embedded +/// LLVM IR module and initialize the machine functions by parsing the machine +/// function's state. +/// /// \param Filename - The name of the file to parse. /// \param Error - Error result info. -/// \param Context - Context in which to allocate globals info. -std::unique_ptr<Module> parseMIRFile(StringRef Filename, SMDiagnostic &Error, - LLVMContext &Context); +/// \param Context - Context which will be used for the parsed LLVM IR module. +std::unique_ptr<MIRParser> createMIRParserFromFile(StringRef Filename, + SMDiagnostic &Error, + LLVMContext &Context); /// This function is another interface to the MIR serialization format parser. /// -/// It parses the optional LLVM IR in the given buffer, and returns an LLVM -/// module. +/// It returns a MIR parser that works with the given memory buffer and that can +/// parse the embedded LLVM IR module and initialize the machine functions by +/// parsing the machine function's state. +/// /// \param Contents - The MemoryBuffer containing the machine level IR. -/// \param Error - Error result info. -/// \param Context - Context in which to allocate globals info. -std::unique_ptr<Module> parseMIR(std::unique_ptr<MemoryBuffer> Contents, - SMDiagnostic &Error, LLVMContext &Context); +/// \param Context - Context which will be used for the parsed LLVM IR module. +std::unique_ptr<MIRParser> +createMIRParser(std::unique_ptr<MemoryBuffer> Contents, LLVMContext &Context); } // end namespace llvm diff --git a/include/llvm/CodeGen/MIRYamlMapping.h b/include/llvm/CodeGen/MIRYamlMapping.h index f9d4c74..b1fe47a 100644 --- a/include/llvm/CodeGen/MIRYamlMapping.h +++ b/include/llvm/CodeGen/MIRYamlMapping.h @@ -20,17 +20,54 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/YAMLTraits.h" +#include <vector> + +namespace llvm { +namespace yaml { + +struct MachineBasicBlock { + std::string Name; + unsigned Alignment = 0; + bool IsLandingPad = false; + bool AddressTaken = false; + // TODO: Serialize the successors and liveins. + // TODO: Serialize machine instructions. +}; + +template <> struct MappingTraits<MachineBasicBlock> { + static void mapping(IO &YamlIO, MachineBasicBlock &MBB) { + YamlIO.mapOptional("name", MBB.Name, + std::string()); // Don't print out an empty name. + YamlIO.mapOptional("alignment", MBB.Alignment); + YamlIO.mapOptional("isLandingPad", MBB.IsLandingPad); + YamlIO.mapOptional("addressTaken", MBB.AddressTaken); + } +}; + +} // end namespace yaml +} // end namespace llvm + +LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::MachineBasicBlock) namespace llvm { namespace yaml { struct MachineFunction { StringRef Name; + unsigned Alignment = 0; + bool ExposesReturnsTwice = false; + bool HasInlineAsm = false; + + std::vector<MachineBasicBlock> BasicBlocks; }; template <> struct MappingTraits<MachineFunction> { static void mapping(IO &YamlIO, MachineFunction &MF) { YamlIO.mapRequired("name", MF.Name); + YamlIO.mapOptional("alignment", MF.Alignment); + YamlIO.mapOptional("exposesReturnsTwice", MF.ExposesReturnsTwice); + YamlIO.mapOptional("hasInlineAsm", MF.HasInlineAsm); + YamlIO.mapOptional("body", MF.BasicBlocks); } }; diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h index 357aef0..619894c 100644 --- a/include/llvm/CodeGen/MachineBasicBlock.h +++ b/include/llvm/CodeGen/MachineBasicBlock.h @@ -801,6 +801,6 @@ public: MachineBasicBlock::iterator getInitial() { return I; } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h index feb394e..9d0a069 100644 --- a/include/llvm/CodeGen/MachineBlockFrequencyInfo.h +++ b/include/llvm/CodeGen/MachineBlockFrequencyInfo.h @@ -66,6 +66,6 @@ public: }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineBranchProbabilityInfo.h b/include/llvm/CodeGen/MachineBranchProbabilityInfo.h index 7ba7495..da6ea1d 100644 --- a/include/llvm/CodeGen/MachineBranchProbabilityInfo.h +++ b/include/llvm/CodeGen/MachineBranchProbabilityInfo.h @@ -84,7 +84,7 @@ public: const MachineBasicBlock *Dst) const; }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h index c619afb..8a915fb 100644 --- a/include/llvm/CodeGen/MachineConstantPool.h +++ b/include/llvm/CodeGen/MachineConstantPool.h @@ -174,6 +174,6 @@ public: void dump() const; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineDominanceFrontier.h b/include/llvm/CodeGen/MachineDominanceFrontier.h index 4131194..f8dd2cd 100644 --- a/include/llvm/CodeGen/MachineDominanceFrontier.h +++ b/include/llvm/CodeGen/MachineDominanceFrontier.h @@ -104,6 +104,6 @@ public: void getAnalysisUsage(AnalysisUsage &AU) const override; }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h index 4428fa6..6518114 100644 --- a/include/llvm/CodeGen/MachineDominators.h +++ b/include/llvm/CodeGen/MachineDominators.h @@ -270,6 +270,6 @@ template <> struct GraphTraits<MachineDominatorTree*> } }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h index 3889d471..ac92a4b 100644 --- a/include/llvm/CodeGen/MachineFrameInfo.h +++ b/include/llvm/CodeGen/MachineFrameInfo.h @@ -79,9 +79,9 @@ public: /// @brief Abstract Stack Frame Information class MachineFrameInfo { - // StackObject - Represent a single object allocated on the stack. + // Represent a single object allocated on the stack. struct StackObject { - // SPOffset - The offset of this object from the stack pointer on entry to + // The offset of this object from the stack pointer on entry to // the function. This field has no meaning for a variable sized element. int64_t SPOffset; @@ -89,23 +89,23 @@ class MachineFrameInfo { // ~0ULL means a dead object. uint64_t Size; - // Alignment - The required alignment of this stack slot. + // The required alignment of this stack slot. unsigned Alignment; - // isImmutable - If true, the value of the stack object is set before + // If true, the value of the stack object is set before // entering the function and is not modified inside the function. By // default, fixed objects are immutable unless marked otherwise. bool isImmutable; - // isSpillSlot - If true the stack object is used as spill slot. It + // If true the stack object is used as spill slot. It // cannot alias any other memory objects. bool isSpillSlot; - /// Alloca - If this stack object is originated from an Alloca instruction + /// If this stack object is originated from an Alloca instruction /// this value saves the original IR allocation. Can be NULL. const AllocaInst *Alloca; - // PreAllocated - If true, the object was mapped into the local frame + // If true, the object was mapped into the local frame // block and doesn't need additional handling for allocation beyond that. bool PreAllocated; @@ -121,51 +121,47 @@ class MachineFrameInfo { isSpillSlot(isSS), Alloca(Val), PreAllocated(false), isAliased(A) {} }; - /// StackAlignment - The alignment of the stack. + /// The alignment of the stack. unsigned StackAlignment; - /// StackRealignable - Can the stack be realigned. + /// Can the stack be realigned. bool StackRealignable; - /// Objects - The list of stack objects allocated... - /// + /// The list of stack objects allocated. std::vector<StackObject> Objects; - /// NumFixedObjects - This contains the number of fixed objects contained on + /// This contains the number of fixed objects contained on /// the stack. Because fixed objects are stored at a negative index in the /// Objects list, this is also the index to the 0th object in the list. - /// unsigned NumFixedObjects; - /// HasVarSizedObjects - This boolean keeps track of whether any variable + /// This boolean keeps track of whether any variable /// sized objects have been allocated yet. - /// bool HasVarSizedObjects; - /// FrameAddressTaken - This boolean keeps track of whether there is a call + /// This boolean keeps track of whether there is a call /// to builtin \@llvm.frameaddress. bool FrameAddressTaken; - /// ReturnAddressTaken - This boolean keeps track of whether there is a call + /// This boolean keeps track of whether there is a call /// to builtin \@llvm.returnaddress. bool ReturnAddressTaken; - /// HasStackMap - This boolean keeps track of whether there is a call + /// This boolean keeps track of whether there is a call /// to builtin \@llvm.experimental.stackmap. bool HasStackMap; - /// HasPatchPoint - This boolean keeps track of whether there is a call + /// This boolean keeps track of whether there is a call /// to builtin \@llvm.experimental.patchpoint. bool HasPatchPoint; - /// StackSize - The prolog/epilog code inserter calculates the final stack + /// The prolog/epilog code inserter calculates the final stack /// offsets for all of the fixed size objects, updating the Objects list /// above. It then updates StackSize to contain the number of bytes that need /// to be allocated on entry to the function. - /// uint64_t StackSize; - /// OffsetAdjustment - The amount that a frame offset needs to be adjusted to + /// The amount that a frame offset needs to be adjusted to /// have the actual offset from the stack/frame pointer. The exact usage of /// this is target-dependent, but it is typically used to adjust between /// SP-relative and FP-relative offsets. E.G., if objects are accessed via @@ -176,52 +172,49 @@ class MachineFrameInfo { /// corresponding adjustments are performed directly. int OffsetAdjustment; - /// MaxAlignment - The prolog/epilog code inserter may process objects - /// that require greater alignment than the default alignment the target - /// provides. To handle this, MaxAlignment is set to the maximum alignment + /// The prolog/epilog code inserter may process objects that require greater + /// alignment than the default alignment the target provides. + /// To handle this, MaxAlignment is set to the maximum alignment /// needed by the objects on the current frame. If this is greater than the /// native alignment maintained by the compiler, dynamic alignment code will /// be needed. /// unsigned MaxAlignment; - /// AdjustsStack - Set to true if this function adjusts the stack -- e.g., + /// Set to true if this function adjusts the stack -- e.g., /// when calling another function. This is only valid during and after /// prolog/epilog code insertion. bool AdjustsStack; - /// HasCalls - Set to true if this function has any function calls. + /// Set to true if this function has any function calls. bool HasCalls; - /// StackProtectorIdx - The frame index for the stack protector. + /// The frame index for the stack protector. int StackProtectorIdx; - /// FunctionContextIdx - The frame index for the function context. Used for - /// SjLj exceptions. + /// The frame index for the function context. Used for SjLj exceptions. int FunctionContextIdx; - /// MaxCallFrameSize - This contains the size of the largest call frame if the - /// target uses frame setup/destroy pseudo instructions (as defined in the - /// TargetFrameInfo class). This information is important for frame pointer - /// elimination. If is only valid during and after prolog/epilog code - /// insertion. - /// + /// This contains the size of the largest call frame if the target uses frame + /// setup/destroy pseudo instructions (as defined in the TargetFrameInfo + /// class). This information is important for frame pointer elimination. + /// If is only valid during and after prolog/epilog code insertion. unsigned MaxCallFrameSize; - /// CSInfo - The prolog/epilog code inserter fills in this vector with each + /// The prolog/epilog code inserter fills in this vector with each /// callee saved register saved in the frame. Beyond its use by the prolog/ /// epilog code inserter, this data used for debug info and exception /// handling. std::vector<CalleeSavedInfo> CSInfo; - /// CSIValid - Has CSInfo been set yet? + /// Has CSInfo been set yet? bool CSIValid; - /// LocalFrameObjects - References to frame indices which are mapped + /// References to frame indices which are mapped /// into the local frame allocation block. <FrameIdx, LocalOffset> SmallVector<std::pair<int, int64_t>, 32> LocalFrameObjects; - /// LocalFrameSize - Size of the pre-allocated local frame block. + /// Size of the pre-allocated local frame block. int64_t LocalFrameSize; /// Required alignment of the local object blob, which is the strictest @@ -284,101 +277,90 @@ public: HasTailCall = false; } - /// hasStackObjects - Return true if there are any stack objects in this - /// function. - /// + /// Return true if there are any stack objects in this function. bool hasStackObjects() const { return !Objects.empty(); } - /// hasVarSizedObjects - This method may be called any time after instruction + /// This method may be called any time after instruction /// selection is complete to determine if the stack frame for this function /// contains any variable sized objects. - /// bool hasVarSizedObjects() const { return HasVarSizedObjects; } - /// getStackProtectorIndex/setStackProtectorIndex - Return the index for the - /// stack protector object. - /// + /// Return the index for the stack protector object. int getStackProtectorIndex() const { return StackProtectorIdx; } void setStackProtectorIndex(int I) { StackProtectorIdx = I; } - /// getFunctionContextIndex/setFunctionContextIndex - Return the index for the - /// function context object. This object is used for SjLj exceptions. + /// Return the index for the function context object. + /// This object is used for SjLj exceptions. int getFunctionContextIndex() const { return FunctionContextIdx; } void setFunctionContextIndex(int I) { FunctionContextIdx = I; } - /// isFrameAddressTaken - This method may be called any time after instruction + /// This method may be called any time after instruction /// selection is complete to determine if there is a call to /// \@llvm.frameaddress in this function. bool isFrameAddressTaken() const { return FrameAddressTaken; } void setFrameAddressIsTaken(bool T) { FrameAddressTaken = T; } - /// isReturnAddressTaken - This method may be called any time after + /// This method may be called any time after /// instruction selection is complete to determine if there is a call to /// \@llvm.returnaddress in this function. bool isReturnAddressTaken() const { return ReturnAddressTaken; } void setReturnAddressIsTaken(bool s) { ReturnAddressTaken = s; } - /// hasStackMap - This method may be called any time after instruction + /// This method may be called any time after instruction /// selection is complete to determine if there is a call to builtin /// \@llvm.experimental.stackmap. bool hasStackMap() const { return HasStackMap; } void setHasStackMap(bool s = true) { HasStackMap = s; } - /// hasPatchPoint - This method may be called any time after instruction + /// This method may be called any time after instruction /// selection is complete to determine if there is a call to builtin /// \@llvm.experimental.patchpoint. bool hasPatchPoint() const { return HasPatchPoint; } void setHasPatchPoint(bool s = true) { HasPatchPoint = s; } - /// getObjectIndexBegin - Return the minimum frame object index. - /// + /// Return the minimum frame object index. int getObjectIndexBegin() const { return -NumFixedObjects; } - /// getObjectIndexEnd - Return one past the maximum frame object index. - /// + /// Return one past the maximum frame object index. int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; } - /// getNumFixedObjects - Return the number of fixed objects. + /// Return the number of fixed objects. unsigned getNumFixedObjects() const { return NumFixedObjects; } - /// getNumObjects - Return the number of objects. - /// + /// Return the number of objects. unsigned getNumObjects() const { return Objects.size(); } - /// mapLocalFrameObject - Map a frame index into the local object block + /// Map a frame index into the local object block void mapLocalFrameObject(int ObjectIndex, int64_t Offset) { LocalFrameObjects.push_back(std::pair<int, int64_t>(ObjectIndex, Offset)); Objects[ObjectIndex + NumFixedObjects].PreAllocated = true; } - /// getLocalFrameObjectMap - Get the local offset mapping for a for an object + /// Get the local offset mapping for a for an object. std::pair<int, int64_t> getLocalFrameObjectMap(int i) { assert (i >= 0 && (unsigned)i < LocalFrameObjects.size() && "Invalid local object reference!"); return LocalFrameObjects[i]; } - /// getLocalFrameObjectCount - Return the number of objects allocated into - /// the local object block. + /// Return the number of objects allocated into the local object block. int64_t getLocalFrameObjectCount() { return LocalFrameObjects.size(); } - /// setLocalFrameSize - Set the size of the local object blob. + /// Set the size of the local object blob. void setLocalFrameSize(int64_t sz) { LocalFrameSize = sz; } - /// getLocalFrameSize - Get the size of the local object blob. + /// Get the size of the local object blob. int64_t getLocalFrameSize() const { return LocalFrameSize; } - /// setLocalFrameMaxAlign - Required alignment of the local object blob, + /// Required alignment of the local object blob, /// which is the strictest alignment of any object in it. void setLocalFrameMaxAlign(unsigned Align) { LocalFrameMaxAlign = Align; } - /// getLocalFrameMaxAlign - Return the required alignment of the local - /// object blob. + /// Return the required alignment of the local object blob. unsigned getLocalFrameMaxAlign() const { return LocalFrameMaxAlign; } - /// getUseLocalStackAllocationBlock - Get whether the local allocation blob - /// should be allocated together or let PEI allocate the locals in it - /// directly. + /// Get whether the local allocation blob should be allocated together or + /// let PEI allocate the locals in it directly. bool getUseLocalStackAllocationBlock() {return UseLocalStackAllocationBlock;} /// setUseLocalStackAllocationBlock - Set whether the local allocation blob @@ -388,30 +370,28 @@ public: UseLocalStackAllocationBlock = v; } - /// isObjectPreAllocated - Return true if the object was pre-allocated into - /// the local block. + /// Return true if the object was pre-allocated into the local block. bool isObjectPreAllocated(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); return Objects[ObjectIdx+NumFixedObjects].PreAllocated; } - /// getObjectSize - Return the size of the specified object. - /// + /// Return the size of the specified object. int64_t getObjectSize(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); return Objects[ObjectIdx+NumFixedObjects].Size; } - /// setObjectSize - Change the size of the specified stack object. + /// Change the size of the specified stack object. void setObjectSize(int ObjectIdx, int64_t Size) { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); Objects[ObjectIdx+NumFixedObjects].Size = Size; } - /// getObjectAlignment - Return the alignment of the specified stack object. + /// Return the alignment of the specified stack object. unsigned getObjectAlignment(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); @@ -426,7 +406,7 @@ public: ensureMaxAlignment(Align); } - /// getObjectAllocation - Return the underlying Alloca of the specified + /// Return the underlying Alloca of the specified /// stack object if it exists. Returns 0 if none exists. const AllocaInst* getObjectAllocation(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && @@ -434,9 +414,8 @@ public: return Objects[ObjectIdx+NumFixedObjects].Alloca; } - /// getObjectOffset - Return the assigned stack offset of the specified object + /// Return the assigned stack offset of the specified object /// from the incoming stack pointer. - /// int64_t getObjectOffset(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); @@ -445,9 +424,8 @@ public: return Objects[ObjectIdx+NumFixedObjects].SPOffset; } - /// setObjectOffset - Set the stack frame offset of the specified object. The + /// Set the stack frame offset of the specified object. The /// offset is relative to the stack pointer on entry to the function. - /// void setObjectOffset(int ObjectIdx, int64_t SPOffset) { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); @@ -456,44 +434,37 @@ public: Objects[ObjectIdx+NumFixedObjects].SPOffset = SPOffset; } - /// getStackSize - Return the number of bytes that must be allocated to hold + /// Return the number of bytes that must be allocated to hold /// all of the fixed size frame objects. This is only valid after /// Prolog/Epilog code insertion has finalized the stack frame layout. - /// uint64_t getStackSize() const { return StackSize; } - /// setStackSize - Set the size of the stack... - /// + /// Set the size of the stack. void setStackSize(uint64_t Size) { StackSize = Size; } /// Estimate and return the size of the stack frame. unsigned estimateStackSize(const MachineFunction &MF) const; - /// getOffsetAdjustment - Return the correction for frame offsets. - /// + /// Return the correction for frame offsets. int getOffsetAdjustment() const { return OffsetAdjustment; } - /// setOffsetAdjustment - Set the correction for frame offsets. - /// + /// Set the correction for frame offsets. void setOffsetAdjustment(int Adj) { OffsetAdjustment = Adj; } - /// getMaxAlignment - Return the alignment in bytes that this function must be - /// aligned to, which is greater than the default stack alignment provided by - /// the target. - /// + /// Return the alignment in bytes that this function must be aligned to, + /// which is greater than the default stack alignment provided by the target. unsigned getMaxAlignment() const { return MaxAlignment; } - /// ensureMaxAlignment - Make sure the function is at least Align bytes - /// aligned. + /// Make sure the function is at least Align bytes aligned. void ensureMaxAlignment(unsigned Align); - /// AdjustsStack - Return true if this function adjusts the stack -- e.g., + /// Return true if this function adjusts the stack -- e.g., /// when calling another function. This is only valid during and after /// prolog/epilog code insertion. bool adjustsStack() const { return AdjustsStack; } void setAdjustsStack(bool V) { AdjustsStack = V; } - /// hasCalls - Return true if the current function has any function calls. + /// Return true if the current function has any function calls. bool hasCalls() const { return HasCalls; } void setHasCalls(bool V) { HasCalls = V; } @@ -513,7 +484,7 @@ public: bool hasTailCall() const { return HasTailCall; } void setHasTailCall() { HasTailCall = true; } - /// getMaxCallFrameSize - Return the maximum size of a call frame that must be + /// Return the maximum size of a call frame that must be /// allocated for an outgoing function call. This is only available if /// CallFrameSetup/Destroy pseudo instructions are used by the target, and /// then only during or after prolog/epilog code insertion. @@ -521,25 +492,23 @@ public: unsigned getMaxCallFrameSize() const { return MaxCallFrameSize; } void setMaxCallFrameSize(unsigned S) { MaxCallFrameSize = S; } - /// CreateFixedObject - Create a new object at a fixed location on the stack. + /// Create a new object at a fixed location on the stack. /// All fixed objects should be created before other objects are created for /// efficiency. By default, fixed objects are not pointed to by LLVM IR /// values. This returns an index with a negative value. - /// int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool Immutable, bool isAliased = false); - /// CreateFixedSpillStackObject - Create a spill slot at a fixed location - /// on the stack. Returns an index with a negative value. + /// Create a spill slot at a fixed location on the stack. + /// Returns an index with a negative value. int CreateFixedSpillStackObject(uint64_t Size, int64_t SPOffset); - /// isFixedObjectIndex - Returns true if the specified index corresponds to a - /// fixed stack object. + /// Returns true if the specified index corresponds to a fixed stack object. bool isFixedObjectIndex(int ObjectIdx) const { return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects); } - /// isAliasedObjectIndex - Returns true if the specified index corresponds + /// Returns true if the specified index corresponds /// to an object that might be pointed to by an LLVM IR value. bool isAliasedObjectIndex(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && @@ -558,61 +527,52 @@ public: return Objects[ObjectIdx+NumFixedObjects].isImmutable; } - /// isSpillSlotObjectIndex - Returns true if the specified index corresponds - /// to a spill slot.. + /// Returns true if the specified index corresponds to a spill slot. bool isSpillSlotObjectIndex(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); return Objects[ObjectIdx+NumFixedObjects].isSpillSlot; } - /// isDeadObjectIndex - Returns true if the specified index corresponds to - /// a dead object. + /// Returns true if the specified index corresponds to a dead object. bool isDeadObjectIndex(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL; } - /// CreateStackObject - Create a new statically sized stack object, returning + /// Create a new statically sized stack object, returning /// a nonnegative identifier to represent it. - /// int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS, const AllocaInst *Alloca = nullptr); - /// CreateSpillStackObject - Create a new statically sized stack object that - /// represents a spill slot, returning a nonnegative identifier to represent - /// it. - /// + /// Create a new statically sized stack object that represents a spill slot, + /// returning a nonnegative identifier to represent it. int CreateSpillStackObject(uint64_t Size, unsigned Alignment); - /// RemoveStackObject - Remove or mark dead a statically sized stack object. - /// + /// Remove or mark dead a statically sized stack object. void RemoveStackObject(int ObjectIdx) { // Mark it dead. Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL; } - /// CreateVariableSizedObject - Notify the MachineFrameInfo object that a - /// variable sized object has been created. This must be created whenever a - /// variable sized object is created, whether or not the index returned is - /// actually used. - /// + /// Notify the MachineFrameInfo object that a variable sized object has been + /// created. This must be created whenever a variable sized object is + /// created, whether or not the index returned is actually used. int CreateVariableSizedObject(unsigned Alignment, const AllocaInst *Alloca); - /// getCalleeSavedInfo - Returns a reference to call saved info vector for the - /// current function. + /// Returns a reference to call saved info vector for the current function. const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const { return CSInfo; } - /// setCalleeSavedInfo - Used by prolog/epilog inserter to set the function's - /// callee saved information. + /// Used by prolog/epilog inserter to set the function's callee saved + /// information. void setCalleeSavedInfo(const std::vector<CalleeSavedInfo> &CSI) { CSInfo = CSI; } - /// isCalleeSavedInfoValid - Has the callee saved info been calculated yet? + /// Has the callee saved info been calculated yet? bool isCalleeSavedInfoValid() const { return CSIValid; } void setCalleeSavedInfoValid(bool v) { CSIValid = v; } @@ -632,15 +592,14 @@ public: /// method always returns an empty set. BitVector getPristineRegs(const MachineFunction &MF) const; - /// print - Used by the MachineFunction printer to print information about - /// stack objects. Implemented in MachineFunction.cpp - /// + /// Used by the MachineFunction printer to print information about + /// stack objects. Implemented in MachineFunction.cpp. void print(const MachineFunction &MF, raw_ostream &OS) const; /// dump - Print the function to stderr. void dump(const MachineFunction &MF) const; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 94610ca..d838cad 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -546,6 +546,6 @@ template <> struct GraphTraits<Inverse<const MachineFunction*> > : } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineFunctionAnalysis.h b/include/llvm/CodeGen/MachineFunctionAnalysis.h index 023eeb1..576e72b 100644 --- a/include/llvm/CodeGen/MachineFunctionAnalysis.h +++ b/include/llvm/CodeGen/MachineFunctionAnalysis.h @@ -19,6 +19,7 @@ namespace llvm { class MachineFunction; +class MachineFunctionInitializer; class TargetMachine; /// MachineFunctionAnalysis - This class is a Pass that manages a @@ -28,9 +29,12 @@ private: const TargetMachine &TM; MachineFunction *MF; unsigned NextFnNum; + MachineFunctionInitializer *MFInitializer; + public: static char ID; - explicit MachineFunctionAnalysis(const TargetMachine &tm); + explicit MachineFunctionAnalysis(const TargetMachine &tm, + MachineFunctionInitializer *MFInitializer); ~MachineFunctionAnalysis() override; MachineFunction &getMF() const { return *MF; } @@ -46,6 +50,6 @@ private: void getAnalysisUsage(AnalysisUsage &AU) const override; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineFunctionInitializer.h b/include/llvm/CodeGen/MachineFunctionInitializer.h new file mode 100644 index 0000000..ff4c29c --- /dev/null +++ b/include/llvm/CodeGen/MachineFunctionInitializer.h @@ -0,0 +1,38 @@ +//===- MachineFunctionInitalizer.h - machine function initializer ---------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file declares an interface that allows custom machine function +// initialization. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_MACHINEFUNCTIONINITIALIZER_H +#define LLVM_CODEGEN_MACHINEFUNCTIONINITIALIZER_H + +namespace llvm { + +class MachineFunction; + +/// This interface provides a way to initialize machine functions after they are +/// created by the machine function analysis pass. +class MachineFunctionInitializer { + virtual void anchor(); + +public: + virtual ~MachineFunctionInitializer() {} + + /// Initialize the machine function. + /// + /// Return true if error occurred. + virtual bool initializeMachineFunction(MachineFunction &MF) = 0; +}; + +} // end namespace llvm + +#endif diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h index 50a1f6e..0e09c90 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -54,6 +54,6 @@ private: bool runOnFunction(Function &F) override; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index edda03f..0313e93 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -1235,6 +1235,6 @@ inline raw_ostream& operator<<(raw_ostream &OS, const MachineInstr &MI) { return OS; } -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h index 47397c6..0778ff4 100644 --- a/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/include/llvm/CodeGen/MachineInstrBuilder.h @@ -40,7 +40,7 @@ namespace RegState { ImplicitDefine = Implicit | Define, ImplicitKill = Implicit | Kill }; -} +} // namespace RegState class MachineInstrBuilder { MachineFunction *MF; @@ -502,6 +502,6 @@ public: } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineInstrBundle.h b/include/llvm/CodeGen/MachineInstrBundle.h index 1220224..edebfa6 100644 --- a/include/llvm/CodeGen/MachineInstrBundle.h +++ b/include/llvm/CodeGen/MachineInstrBundle.h @@ -247,6 +247,6 @@ public: const MachineOperand *operator->() const { return &deref(); } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h index adcd1d0..b59b585 100644 --- a/include/llvm/CodeGen/MachineJumpTableInfo.h +++ b/include/llvm/CodeGen/MachineJumpTableInfo.h @@ -125,6 +125,6 @@ public: void dump() const; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h index 438ef2e..8c245ae 100644 --- a/include/llvm/CodeGen/MachineLoopInfo.h +++ b/include/llvm/CodeGen/MachineLoopInfo.h @@ -186,6 +186,6 @@ template <> struct GraphTraits<MachineLoop*> { } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h index a16c294..9962ff9 100644 --- a/include/llvm/CodeGen/MachineMemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -221,6 +221,6 @@ public: raw_ostream &operator<<(raw_ostream &OS, const MachineMemOperand &MRO); -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index ce45c16..5faf8de 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -157,11 +157,6 @@ class MachineModuleInfo : public ImmutablePass { /// emit common EH frames. std::vector<const Function *> Personalities; - /// UsedFunctions - The functions in the @llvm.used list in a more easily - /// searchable format. This does not include the functions in - /// llvm.compiler.used. - SmallPtrSet<const Function *, 32> UsedFunctions; - /// AddrLabelSymbols - This map keeps track of which symbol is being used for /// the specified basic block's address of label. MMIAddrLabelMap *AddrLabelSymbols; @@ -246,10 +241,6 @@ public: return const_cast<MachineModuleInfo*>(this)->getObjFileInfo<Ty>(); } - /// AnalyzeModule - Scan the module for global debug information. - /// - void AnalyzeModule(const Module &M); - /// hasDebugInfo - Returns true if valid debug info is present. /// bool hasDebugInfo() const { return DbgInfoAvailable; } @@ -339,13 +330,6 @@ public: return Personalities; } - /// isUsedFunction - Return true if the functions in the llvm.used list. This - /// does not return true for things in llvm.compiler.used unless they are also - /// in llvm.used. - bool isUsedFunction(const Function *F) const { - return UsedFunctions.count(F); - } - /// addCatchTypeInfo - Provide the catch typeinfo for a landing pad. /// void addCatchTypeInfo(MachineBasicBlock *LandingPad, @@ -457,6 +441,6 @@ public: }; // End class MachineModuleInfo -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h index ddffdca..8c8ce71 100644 --- a/include/llvm/CodeGen/MachineOperand.h +++ b/include/llvm/CodeGen/MachineOperand.h @@ -741,6 +741,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const MachineOperand& MO) { // See friend declaration above. This additional declaration is required in // order to compile LLVM with IBM xlC compiler. hash_code hash_value(const MachineOperand &MO); -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineRegionInfo.h b/include/llvm/CodeGen/MachineRegionInfo.h index cf49c29..794f1d6 100644 --- a/include/llvm/CodeGen/MachineRegionInfo.h +++ b/include/llvm/CodeGen/MachineRegionInfo.h @@ -176,6 +176,6 @@ EXTERN_TEMPLATE_INSTANTIATION(class RegionBase<RegionTraits<MachineFunction>>); EXTERN_TEMPLATE_INSTANTIATION(class RegionNodeBase<RegionTraits<MachineFunction>>); EXTERN_TEMPLATE_INSTANTIATION(class RegionInfoBase<RegionTraits<MachineFunction>>); -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h index e5b837a..c17ad38 100644 --- a/include/llvm/CodeGen/MachineRegisterInfo.h +++ b/include/llvm/CodeGen/MachineRegisterInfo.h @@ -1036,6 +1036,6 @@ getPressureSets(unsigned RegUnit) const { return PSetIterator(RegUnit, this); } -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineSSAUpdater.h b/include/llvm/CodeGen/MachineSSAUpdater.h index 5f988ad..dad0c46 100644 --- a/include/llvm/CodeGen/MachineSSAUpdater.h +++ b/include/llvm/CodeGen/MachineSSAUpdater.h @@ -111,6 +111,6 @@ private: MachineSSAUpdater(const MachineSSAUpdater&) = delete; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/MachineValueType.h b/include/llvm/CodeGen/MachineValueType.h index a728df3..a3eea5b 100644 --- a/include/llvm/CodeGen/MachineValueType.h +++ b/include/llvm/CodeGen/MachineValueType.h @@ -644,6 +644,6 @@ class MVT { /// @} }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/PBQPRAConstraint.h b/include/llvm/CodeGen/PBQPRAConstraint.h index 833b9ba..832c043 100644 --- a/include/llvm/CodeGen/PBQPRAConstraint.h +++ b/include/llvm/CodeGen/PBQPRAConstraint.h @@ -64,6 +64,6 @@ private: void anchor() override; }; -} +} // namespace llvm #endif /* LLVM_CODEGEN_PBQPRACONSTRAINT_H */ diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index 9c7e7b4..3aeec2a 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -552,6 +552,10 @@ namespace llvm { /// MachineCSE - This pass performs global CSE on machine instructions. extern char &MachineCSEID; + /// ImplicitNullChecks - This pass folds null pointer checks into nearby + /// memory operations. + extern char &ImplicitNullChecksID; + /// MachineLICM - This pass performs LICM on machine instructions. extern char &MachineLICMID; @@ -633,7 +637,7 @@ namespace llvm { /// createForwardControlFlowIntegrityPass - This pass adds control-flow /// integrity. ModulePass *createForwardControlFlowIntegrityPass(); -} // End llvm namespace +} // namespace llvm /// Target machine pass initializer for passes with dependencies. Use with /// INITIALIZE_TM_PASS_END. diff --git a/include/llvm/CodeGen/PseudoSourceValue.h b/include/llvm/CodeGen/PseudoSourceValue.h index cc3e25a..e0ec72f 100644 --- a/include/llvm/CodeGen/PseudoSourceValue.h +++ b/include/llvm/CodeGen/PseudoSourceValue.h @@ -106,6 +106,6 @@ namespace llvm { int getFrameIndex() const { return FI; } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/RegisterScavenging.h b/include/llvm/CodeGen/RegisterScavenging.h index df3fd34..b2e31fa 100644 --- a/include/llvm/CodeGen/RegisterScavenging.h +++ b/include/llvm/CodeGen/RegisterScavenging.h @@ -184,6 +184,6 @@ private: }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/ResourcePriorityQueue.h b/include/llvm/CodeGen/ResourcePriorityQueue.h index 0097e04..d1ea9ff 100644 --- a/include/llvm/CodeGen/ResourcePriorityQueue.h +++ b/include/llvm/CodeGen/ResourcePriorityQueue.h @@ -131,6 +131,6 @@ private: unsigned numberRCValPredInSU (SUnit *SU, unsigned RCId); unsigned numberRCValSuccInSU (SUnit *SU, unsigned RCId); }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/RuntimeLibcalls.h b/include/llvm/CodeGen/RuntimeLibcalls.h index 2be5de6..34adde5 100644 --- a/include/llvm/CodeGen/RuntimeLibcalls.h +++ b/include/llvm/CodeGen/RuntimeLibcalls.h @@ -429,7 +429,7 @@ namespace RTLIB { /// Return the SYNC_FETCH_AND_* value for the given opcode and type, or /// UNKNOWN_LIBCALL if there is none. Libcall getATOMIC(unsigned Opc, MVT VT); -} -} +} // namespace RTLIB +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index 8391314..9b5d59c 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -748,6 +748,6 @@ namespace llvm { reverse_iterator rend() { return Index2Node.rend(); } const_reverse_iterator rend() const { return Index2Node.rend(); } }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/ScheduleHazardRecognizer.h b/include/llvm/CodeGen/ScheduleHazardRecognizer.h index 8a40e72..ef872a2 100644 --- a/include/llvm/CodeGen/ScheduleHazardRecognizer.h +++ b/include/llvm/CodeGen/ScheduleHazardRecognizer.h @@ -106,6 +106,6 @@ public: } }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/ScoreboardHazardRecognizer.h b/include/llvm/CodeGen/ScoreboardHazardRecognizer.h index ab14c2d..5911cfb 100644 --- a/include/llvm/CodeGen/ScoreboardHazardRecognizer.h +++ b/include/llvm/CodeGen/ScoreboardHazardRecognizer.h @@ -121,6 +121,6 @@ public: void RecedeCycle() override; }; -} +} // namespace llvm #endif //!LLVM_CODEGEN_SCOREBOARDHAZARDRECOGNIZER_H diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 78fdd04..aa50dea 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -669,7 +669,7 @@ public: SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT); SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N); SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2, - bool nuw = false, bool nsw = false, bool exact = false); + const SDNodeFlags *Flags = nullptr); SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2, SDValue N3); SDValue getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue N1, SDValue N2, @@ -990,8 +990,7 @@ public: /// Get the specified node if it's already available, or else return NULL. SDNode *getNodeIfExists(unsigned Opcode, SDVTList VTs, ArrayRef<SDValue> Ops, - bool nuw = false, bool nsw = false, - bool exact = false); + const SDNodeFlags *Flags = nullptr); /// Creates a SDDbgValue node. SDDbgValue *getDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, @@ -1253,8 +1252,8 @@ private: void allnodes_clear(); BinarySDNode *GetBinarySDNode(unsigned Opcode, SDLoc DL, SDVTList VTs, - SDValue N1, SDValue N2, bool nuw, bool nsw, - bool exact); + SDValue N1, SDValue N2, + const SDNodeFlags *Flags = nullptr); /// Look up the node specified by ID in CSEMap. If it exists, return it. If /// not, return the insertion token that will make insertion faster. This diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h index a011e4c..dc4fa2b 100644 --- a/include/llvm/CodeGen/SelectionDAGISel.h +++ b/include/llvm/CodeGen/SelectionDAGISel.h @@ -301,6 +301,6 @@ private: }; -} +} // namespace llvm #endif /* LLVM_CODEGEN_SELECTIONDAGISEL_H */ diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index daa1943..4b65eaa 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -89,7 +89,7 @@ namespace ISD { /// Return true if the node has at least one operand /// and all operands of the specified node are ISD::UNDEF. bool allOperandsUndef(const SDNode *N); -} // end llvm:ISD namespace +} // namespace ISD //===----------------------------------------------------------------------===// /// Unlike LLVM values, Selection DAG nodes may return multiple @@ -1017,6 +1017,11 @@ static bool isBinOpWithFlags(unsigned Opcode) { case ISD::ADD: case ISD::SUB: case ISD::SHL: + case ISD::FADD: + case ISD::FDIV: + case ISD::FMUL: + case ISD::FREM: + case ISD::FSUB: return true; default: return false; @@ -1029,8 +1034,8 @@ class BinaryWithFlagsSDNode : public BinarySDNode { public: SDNodeFlags Flags; BinaryWithFlagsSDNode(unsigned Opc, unsigned Order, DebugLoc dl, SDVTList VTs, - SDValue X, SDValue Y) - : BinarySDNode(Opc, Order, dl, VTs, X, Y), Flags() {} + SDValue X, SDValue Y, const SDNodeFlags &NodeFlags) + : BinarySDNode(Opc, Order, dl, VTs, X, Y), Flags(NodeFlags) {} static bool classof(const SDNode *N) { return isBinOpWithFlags(N->getOpcode()); } @@ -2263,8 +2268,8 @@ namespace ISD { return isa<StoreSDNode>(N) && cast<StoreSDNode>(N)->getAddressingMode() == ISD::UNINDEXED; } -} +} // namespace ISD -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h index 9d6d6f5..5f21397 100644 --- a/include/llvm/CodeGen/SlotIndexes.h +++ b/include/llvm/CodeGen/SlotIndexes.h @@ -705,6 +705,6 @@ namespace llvm { struct IntervalMapInfo<SlotIndex> : IntervalMapHalfOpenInfo<SlotIndex> { }; -} +} // namespace llvm #endif // LLVM_CODEGEN_SLOTINDEXES_H diff --git a/include/llvm/CodeGen/StackMaps.h b/include/llvm/CodeGen/StackMaps.h index 46a773f..ba27404 100644 --- a/include/llvm/CodeGen/StackMaps.h +++ b/include/llvm/CodeGen/StackMaps.h @@ -255,6 +255,6 @@ private: void debug() { print(dbgs()); } }; -} +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h index e1a9fd3..e02d7db 100644 --- a/include/llvm/CodeGen/ValueTypes.h +++ b/include/llvm/CodeGen/ValueTypes.h @@ -361,6 +361,6 @@ namespace llvm { unsigned getExtendedSizeInBits() const; }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/VirtRegMap.h b/include/llvm/CodeGen/VirtRegMap.h index d7e9209..5b771d0 100644 --- a/include/llvm/CodeGen/VirtRegMap.h +++ b/include/llvm/CodeGen/VirtRegMap.h @@ -185,6 +185,6 @@ namespace llvm { VRM.print(OS); return OS; } -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/CodeGen/WinEHFuncInfo.h b/include/llvm/CodeGen/WinEHFuncInfo.h index 1cff320..5c1b3df 100644 --- a/include/llvm/CodeGen/WinEHFuncInfo.h +++ b/include/llvm/CodeGen/WinEHFuncInfo.h @@ -144,14 +144,15 @@ struct WinEHFuncInfo { SmallVector<WinEHUnwindMapEntry, 4> UnwindMap; SmallVector<WinEHTryBlockMapEntry, 4> TryBlockMap; SmallVector<std::pair<MCSymbol *, int>, 4> IPToStateList; - int UnwindHelpFrameIdx; - int UnwindHelpFrameOffset; + int UnwindHelpFrameIdx = INT_MAX; + int UnwindHelpFrameOffset = -1; + unsigned NumIPToStateFuncsVisited = 0; - unsigned NumIPToStateFuncsVisited; + /// frameescape index of the 32-bit EH registration node. Set by + /// WinEHStatePass and used indirectly by SEH filter functions of the parent. + int EHRegNodeEscapeIndex = INT_MAX; - WinEHFuncInfo() - : UnwindHelpFrameIdx(INT_MAX), UnwindHelpFrameOffset(-1), - NumIPToStateFuncsVisited(0) {} + WinEHFuncInfo() {} }; /// Analyze the IR in ParentFn and it's handlers to build WinEHFuncInfo, which @@ -160,5 +161,5 @@ struct WinEHFuncInfo { void calculateWinCXXEHStateNumbers(const Function *ParentFn, WinEHFuncInfo &FuncInfo); -} +} // namespace llvm #endif // LLVM_CODEGEN_WINEHFUNCINFO_H |