Changeset View
Standalone View
include/llvm/IR/InvariantInfo.h
- This file was added.
//===-------- llvm/InvariantInfo.h - invariant_start/end info ---*- C++ -*-===// | |||||
// | |||||
// The LLVM Compiler Infrastructure | |||||
// | |||||
// This file is distributed under the University of Illinois Open Source | |||||
// License. See LICENSE.TXT for details. | |||||
// | |||||
//===----------------------------------------------------------------------===// | |||||
// | |||||
// This file defines properties for handling invariant_start/end instructions | |||||
// for purposes of load elimination. | |||||
// | |||||
//===----------------------------------------------------------------------===// | |||||
#ifndef LLVM_IR_INVARIANTINFO_H | |||||
#define LLVM_IR_INVARIANTINFO_H | |||||
#include "llvm/ADT/DenseMap.h" | |||||
namespace llvm { | |||||
class Value; | |||||
class DataLayout; | |||||
class IntrinsicInst; | |||||
nlewycky: Alphabetize. | |||||
/// PreservedInvariantInfo -- A data structure to mark and access processed | |||||
/// invariant intrinsic calls. | |||||
class InvariantInfo { | |||||
nlewyckyUnsubmitted Not Done ReplyInline ActionsOne side says "PreservedInvariantInfo" the other side says "InvariantInfo". Just remove the class name from the comment, that style is pre-style guide. Also, "a data structure to mark and access processed invariant intrinsic calls"? I don't think that tells me what it does or what it's for. Is it a cache of invariant intrinsics that pertain to a given Value? nlewycky: One side says "PreservedInvariantInfo" the other side says "InvariantInfo". Just remove the… | |||||
Please add some high level comments describing how this is supposed to be used. sanjoy: Please add some high level comments describing how this is supposed to be used. | |||||
Ok. lvoufo: Ok. | |||||
/// \brief A mapping of each 'writeonce' allocated memory (via a | |||||
Please add some comments on how you deal with passes RAUW'ing or erasing values. sanjoy: Please add some comments on how you deal with passes RAUW'ing or erasing values. | |||||
Ok. lvoufo: Ok. | |||||
nlewyckyUnsubmitted Not Done ReplyInline Actions"writeonce" is not defined anywhere? nlewycky: "writeonce" is not defined anywhere? | |||||
/// GlobalVariable or AllocaInst instance) to its matching intrisic_start | |||||
nlewyckyUnsubmitted Not Done ReplyInline ActionsTypo in "intrisic_start" nlewycky: Typo in "intrisic_start" | |||||
/// call. This is to be used by GVN, InstCombine, GlobalOpt and BasicAA | |||||
/// to process invariant intrinsics for purposes of eliminating redundant | |||||
/// load instructions. | |||||
DenseMap<Value *, IntrinsicInst *> InvariantMarkers; | |||||
public: | |||||
/// \brief Access the 'InvariantMarkers' mapping to extract invariant_start | |||||
/// instruction that is associated with the given Address. | |||||
IntrinsicInst *GetStartInstruction(const Value *Addr) const; | |||||
/// \brief Add an entry to the 'InvariantMarkers' mapping. | |||||
void SetStartInstruction(Value *Addr, IntrinsicInst *IStart); | |||||
}; | |||||
/// PreservedInvariantInfo -- Information processed from invariant intrinsics, | |||||
nlewyckyUnsubmitted Not Done ReplyInline ActionsRemove struct name from comment. nlewycky: Remove struct name from comment. | |||||
/// for a given query instruction. | |||||
struct PreservedInvariantInfo { | |||||
IntrinsicInst *II; | |||||
Value *LoadedAddr; | |||||
InvariantInfo &InvInfo; | |||||
PreservedInvariantInfo(Value *Query, const DataLayout &DL, | |||||
InvariantInfo &InvInfo); | |||||
}; | |||||
/// PreserveInvariantInfo -- An RAII object to save and restore information | |||||
Please document these functions. sanjoy: Please document these functions. | |||||
Do you mean in addition to the documentation of its implementation in lib/IR/InvariantInfo.cpp ? lvoufo: Do you mean in addition to the documentation of its implementation in lib/IR/InvariantInfo.cpp ? | |||||
Never mind, I just saw the docs in the implementation file. :) The doxygen comments are typically put in the header. sanjoy: Never mind, I just saw the docs in the implementation file. :)
The doxygen comments are… | |||||
No problem. I just figured it would be more legible to have the detailed documentation right next to the implementation. I can add some high-level comments on the prototypes too if it help. lvoufo: No problem. I just figured it would be more legible to have the detailed documentation right… | |||||
/// from processed invariant intrinsics. | |||||
class PreserveInvariantInfo { | |||||
nlewyckyUnsubmitted Not Done ReplyInline ActionsHold on, you have one struct PreservedInvariantInfo and one class PreserveInvariantInfo? Please rename one of them. nlewycky: Hold on, you have one struct PreservedInvariantInfo and one class PreserveInvariantInfo? Please… | |||||
PreservedInvariantInfo Preserved; | |||||
void CheckPreservedInfo() const; | |||||
public: | |||||
PreserveInvariantInfo(PreservedInvariantInfo Info); | |||||
~PreserveInvariantInfo(); | |||||
}; | |||||
/// \brief Process invariant_start/end intrinsics: Mark addresses as "within | |||||
/// an invariant range" specified by the given intrinsic call. | |||||
bool processInvariantIntrinsic(IntrinsicInst *II, InvariantInfo &InvInfo); | |||||
/// \brief Handle invariant_start/end intrinsics when scanning intructions | |||||
/// backward to either find available loads or look for pointer dependencies | |||||
/// from a given query instruction, based on preserved invariant info. | |||||
bool BackwardScanInvariantIntrinsic(const IntrinsicInst *II, | |||||
const PreservedInvariantInfo &Preserved, | |||||
InvariantInfo &InvInfo); | |||||
} // End llvm namespace | |||||
#endif |
Alphabetize.