39#include "llvm/Config/llvm-config.h"
60#define DEBUG_TYPE "CSKY-constant-islands"
63STATISTIC(NumSplit,
"Number of uncond branches inserted");
64STATISTIC(NumCBrFixed,
"Number of cond branches fixed");
65STATISTIC(NumUBrFixed,
"Number of uncond branches fixed");
108 unsigned postOffset()
const {
return Offset + Size; }
111 std::vector<BasicBlockInfo> BBInfo;
116 std::vector<MachineBasicBlock *> WaterList;
122 using water_iterator = std::vector<MachineBasicBlock *>::iterator;
148 :
MI(Mi), CPEMI(Cpemi), MaxDisp(Maxdisp), NegOk(Neg) {
153 unsigned getMaxDisp()
const {
return MaxDisp - 16; }
155 void setMaxDisp(
unsigned Val) { MaxDisp = Val; }
160 std::vector<CPUser> CPUsers;
170 CPEntry(
MachineInstr *Cpemi,
unsigned Cpi,
unsigned Rc = 0)
171 : CPEMI(Cpemi), CPI(Cpi), RefCount(Rc) {}
179 std::vector<std::vector<CPEntry>> CPEntries;
187 unsigned MaxDisp : 31;
192 :
MI(Mi), MaxDisp(Maxdisp), IsCond(
Cond), UncondBr(Ubr) {}
197 std::vector<ImmBranch> ImmBranches;
205 unsigned PICLabelUId;
207 void initPICLabelUId(
unsigned UId) { PICLabelUId = UId; }
209 unsigned createPICLabelUId() {
return PICLabelUId++; }
227 MachineFunctionProperties::Property::NoVRegs);
230 void doInitialPlacement(std::vector<MachineInstr *> &CPEMIs);
231 CPEntry *findConstPoolEntry(
unsigned CPI,
const MachineInstr *CPEMI);
233 void initializeFunctionInfo(
const std::vector<MachineInstr *> &CPEMIs);
235 unsigned getUserOffset(CPUser &)
const;
238 bool isOffsetInRange(
unsigned UserOffset,
unsigned TrialOffset,
unsigned Disp,
240 bool isOffsetInRange(
unsigned UserOffset,
unsigned TrialOffset,
247 bool decrementCPEReferenceCount(
unsigned CPI,
MachineInstr *CPEMI);
248 int findInRangeCPEntry(CPUser &U,
unsigned UserOffset);
249 bool findAvailableWater(CPUser &U,
unsigned UserOffset,
250 water_iterator &WaterIter);
251 void createNewWater(
unsigned CPUserIndex,
unsigned UserOffset,
253 bool handleConstantPoolUser(
unsigned CPUserIndex);
255 bool removeUnusedCPEntries();
258 bool DoDump =
false);
262 bool fixupImmediateBr(ImmBranch &Br);
263 bool fixupConditionalBr(ImmBranch &Br);
264 bool fixupUnconditionalBr(ImmBranch &Br);
268char CSKYConstantIslands::ID = 0;
270bool CSKYConstantIslands::isOffsetInRange(
unsigned UserOffset,
271 unsigned TrialOffset,
273 return isOffsetInRange(UserOffset, TrialOffset,
U.getMaxDisp(),
U.NegOk);
276#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
279 for (
unsigned J = 0,
E = BBInfo.size(); J !=
E; ++J) {
293 << MCP->getConstants().size() <<
" CP entries, aligned to "
294 << MCP->getConstantPoolAlign().value() <<
" bytes *****\n");
296 TII = STI->getInstrInfo();
300 MF->getRegInfo().invalidateLiveness();
304 MF->RenumberBlocks();
306 bool MadeChange =
false;
310 std::vector<MachineInstr *> CPEMIs;
312 doInitialPlacement(CPEMIs);
315 initPICLabelUId(CPEMIs.size());
320 initializeFunctionInfo(CPEMIs);
325 MadeChange |= removeUnusedCPEntries();
329 unsigned NoCPIters = 0, NoBRIters = 0;
332 LLVM_DEBUG(
dbgs() <<
"Beginning CP iteration #" << NoCPIters <<
'\n');
333 bool CPChange =
false;
334 for (
unsigned I = 0,
E = CPUsers.size();
I !=
E; ++
I)
335 CPChange |= handleConstantPoolUser(
I);
336 if (CPChange && ++NoCPIters > 30)
342 NewWaterList.
clear();
344 LLVM_DEBUG(
dbgs() <<
"Beginning BR iteration #" << NoBRIters <<
'\n');
345 bool BRChange =
false;
346 for (
unsigned I = 0,
E = ImmBranches.size();
I !=
E; ++
I)
347 BRChange |= fixupImmediateBr(ImmBranches[
I]);
348 if (BRChange && ++NoBRIters > 30)
351 if (!CPChange && !BRChange)
368void CSKYConstantIslands::doInitialPlacement(
369 std::vector<MachineInstr *> &CPEMIs) {
375 const Align MaxAlign = MCP->getConstantPoolAlign();
393 const std::vector<MachineConstantPoolEntry> &CPs = MCP->getConstants();
396 for (
unsigned I = 0,
E = CPs.size();
I !=
E; ++
I) {
397 unsigned Size = CPs[
I].getSizeInBytes(TD);
398 assert(
Size >= 4 &&
"Too small constant pool entry");
399 Align Alignment = CPs[
I].getAlign();
405 unsigned LogAlign =
Log2(Alignment);
414 CPEMIs.push_back(CPEMI);
418 for (
unsigned A = LogAlign + 1;
A <=
Log2(MaxAlign); ++
A)
419 if (InsPoint[
A] == InsAt)
422 CPEntries.emplace_back(1, CPEntry(CPEMI,
I));
424 LLVM_DEBUG(
dbgs() <<
"Moved CPI#" <<
I <<
" to end of function, size = "
425 <<
Size <<
", align = " << Alignment.
value() <<
'\n');
451CSKYConstantIslands::CPEntry *
452CSKYConstantIslands::findConstPoolEntry(
unsigned CPI,
454 std::vector<CPEntry> &CPEs = CPEntries[CPI];
457 for (
unsigned I = 0,
E = CPEs.size();
I !=
E; ++
I) {
458 if (CPEs[
I].CPEMI == CPEMI)
470 assert(CPI < MCP->getConstants().
size() &&
"Invalid constant pool index.");
471 return MCP->getConstants()[CPI].getAlign();
477void CSKYConstantIslands::initializeFunctionInfo(
478 const std::vector<MachineInstr *> &CPEMIs) {
480 BBInfo.resize(MF->getNumBlockIDs());
487 computeBlockSize(&*
I);
490 adjustBBOffsetsAfter(&MF->front());
497 WaterList.push_back(&
MBB);
499 if (
MI.isDebugInstr())
502 int Opc =
MI.getOpcode();
503 if (
MI.isBranch() && !
MI.isIndirectBranch()) {
504 bool IsCond =
MI.isConditionalBranch();
507 int UOpc = CSKY::BR32;
509 switch (
MI.getOpcode()) {
523 unsigned MaxOffs = ((1 << (
Bits - 1)) - 1) * Scale;
524 ImmBranches.push_back(ImmBranch(&
MI, MaxOffs, IsCond, UOpc));
527 if (Opc == CSKY::CONSTPOOL_ENTRY)
531 for (
unsigned Op = 0,
E =
MI.getNumOperands();
Op !=
E; ++
Op)
532 if (
MI.getOperand(
Op).isCPI()) {
547 case CSKY::PseudoTLSLA32:
551 case CSKY::LRW32_Gen:
567 unsigned CPI =
MI.getOperand(
Op).getIndex();
569 unsigned MaxOffs = ((1 <<
Bits) - 1) * Scale;
570 CPUsers.push_back(CPUser(&
MI, CPEMI, MaxOffs, NegOk));
573 CPEntry *CPE = findConstPoolEntry(CPI, CPEMI);
574 assert(CPE &&
"Cannot find a corresponding CPEntry!");
594unsigned CSKYConstantIslands::getOffsetOf(
MachineInstr *
MI)
const {
604 assert(
I !=
MBB->
end() &&
"Didn't find MI in its own basic block?");
614 return LHS->getNumber() <
RHS->getNumber();
620void CSKYConstantIslands::updateForInsertedWaterBlock(
632 WaterList.insert(IP, NewBB);
635unsigned CSKYConstantIslands::getUserOffset(CPUser &U)
const {
636 unsigned UserOffset = getOffsetOf(
U.MI);
654 MF->insert(
MBBI, NewBB);
677 MF->RenumberBlocks(NewBB);
689 if (WaterBB == OrigBB)
690 WaterList.
insert(std::next(IP), NewBB);
692 WaterList.insert(IP, OrigBB);
693 NewWaterList.
insert(OrigBB);
700 computeBlockSize(OrigBB);
704 computeBlockSize(NewBB);
707 adjustBBOffsetsAfter(OrigBB);
715bool CSKYConstantIslands::isOffsetInRange(
unsigned UserOffset,
716 unsigned TrialOffset,
717 unsigned MaxDisp,
bool NegativeOK) {
718 if (UserOffset <= TrialOffset) {
720 if (TrialOffset - UserOffset <= MaxDisp)
722 }
else if (NegativeOK) {
723 if (UserOffset - TrialOffset <= MaxDisp)
733bool CSKYConstantIslands::isWaterInRange(
unsigned UserOffset,
736 unsigned CPEOffset = BBInfo[Water->
getNumber()].postOffset();
737 unsigned NextBlockOffset;
738 Align NextBlockAlignment;
740 if (NextBlock == MF->end()) {
741 NextBlockOffset = BBInfo[Water->
getNumber()].postOffset();
742 NextBlockAlignment =
Align(4);
744 NextBlockOffset = BBInfo[NextBlock->getNumber()].Offset;
745 NextBlockAlignment = NextBlock->getAlignment();
747 unsigned Size =
U.CPEMI->getOperand(2).getImm();
748 unsigned CPEEnd = CPEOffset +
Size;
753 if (CPEEnd > NextBlockOffset) {
754 Growth = CPEEnd - NextBlockOffset;
762 if (CPEOffset < UserOffset)
763 UserOffset += Growth;
768 return isOffsetInRange(UserOffset, CPEOffset, U);
776 unsigned MaxDisp,
bool NegOk,
778 unsigned CPEOffset = getOffsetOf(CPEMI);
782 unsigned Block =
MI->getParent()->getNumber();
785 <<
" max delta=" << MaxDisp
786 <<
format(
" insn address=%#x", UserOffset) <<
" in "
789 <<
format(
"CPE address=%#x offset=%+d: ", CPEOffset,
790 int(CPEOffset - UserOffset));
794 return isOffsetInRange(UserOffset, CPEOffset, MaxDisp, NegOk);
814 for (
unsigned I = BBNum + 1,
E = MF->getNumBlockIDs();
I <
E; ++
I) {
817 unsigned Offset = BBInfo[
I - 1].Offset + BBInfo[
I - 1].Size;
826bool CSKYConstantIslands::decrementCPEReferenceCount(
unsigned CPI,
829 CPEntry *CPE = findConstPoolEntry(CPI, CPEMI);
830 assert(CPE &&
"Unexpected!");
831 if (--CPE->RefCount == 0) {
832 removeDeadCPEMI(CPEMI);
833 CPE->CPEMI =
nullptr;
846int CSKYConstantIslands::findInRangeCPEntry(CPUser &U,
unsigned UserOffset) {
851 if (isCPEntryInRange(UserMI, UserOffset, CPEMI,
U.getMaxDisp(),
U.NegOk,
859 std::vector<CPEntry> &CPEs = CPEntries[CPI];
860 for (
unsigned I = 0,
E = CPEs.size();
I !=
E; ++
I) {
862 if (CPEs[
I].CPEMI == CPEMI)
865 if (CPEs[
I].CPEMI ==
nullptr)
867 if (isCPEntryInRange(UserMI, UserOffset, CPEs[
I].CPEMI,
U.getMaxDisp(),
870 << CPEs[
I].CPI <<
"\n");
872 U.CPEMI = CPEs[
I].CPEMI;
883 return decrementCPEReferenceCount(CPI, CPEMI) ? 2 : 1;
892 unsigned Bits, Scale;
907 unsigned MaxOffs = ((1 << (Bits - 1)) - 1) * Scale;
919bool CSKYConstantIslands::findAvailableWater(CPUser &U,
unsigned UserOffset,
920 water_iterator &WaterIter) {
921 if (WaterList.empty())
924 unsigned BestGrowth = ~0
u;
925 for (water_iterator IP = std::prev(WaterList.end()),
B = WaterList.begin();;
937 if (isWaterInRange(UserOffset, WaterBB, U, Growth) &&
938 (WaterBB->
getNumber() <
U.HighWaterMark->getNumber() ||
939 NewWaterList.
count(WaterBB)) &&
940 Growth < BestGrowth) {
945 <<
" Growth=" << Growth <<
'\n');
954 return BestGrowth != ~0
u;
964void CSKYConstantIslands::createNewWater(
unsigned CPUserIndex,
967 CPUser &
U = CPUsers[CPUserIndex];
979 unsigned CPEOffset = UserBBI.
postOffset() + Delta;
981 if (isOffsetInRange(UserOffset, CPEOffset, U)) {
983 <<
format(
", expected CPE offset %#x\n", CPEOffset));
992 int UncondBr = CSKY::BR32;
997 ImmBranches.push_back(
998 ImmBranch(&UserMBB->
back(), MaxDisp,
false, UncondBr));
999 BBInfo[UserMBB->
getNumber()].Size +=
TII->getInstSizeInBytes(*NewMI);
1000 adjustBBOffsetsAfter(UserMBB);
1011 unsigned BaseInsertOffset = UserOffset +
U.getMaxDisp();
1018 BaseInsertOffset -= 4;
1027 if (BaseInsertOffset + 8 >= UserBBI.
postOffset()) {
1031 unsigned EndInsertOffset =
1035 unsigned CPUIndex = CPUserIndex + 1;
1036 unsigned NumCPUsers = CPUsers.size();
1037 for (
unsigned Offset = UserOffset +
TII->getInstSizeInBytes(*UserMI);
1038 Offset < BaseInsertOffset;
1040 assert(
MI != UserMBB->
end() &&
"Fell off end of block");
1041 if (CPUIndex < NumCPUsers && CPUsers[CPUIndex].
MI ==
MI) {
1042 CPUser &
U = CPUsers[CPUIndex];
1043 if (!isOffsetInRange(
Offset, EndInsertOffset, U)) {
1052 EndInsertOffset +=
U.CPEMI->getOperand(2).getImm();
1057 NewMBB = splitBlockBeforeInstr(*--
MI);
1064bool CSKYConstantIslands::handleConstantPoolUser(
unsigned CPUserIndex) {
1065 CPUser &
U = CPUsers[CPUserIndex];
1071 unsigned UserOffset = getUserOffset(U);
1075 int result = findInRangeCPEntry(U, UserOffset);
1085 if (findAvailableWater(U, UserOffset, IP)) {
1092 if (NewWaterList.
erase(WaterBB))
1093 NewWaterList.
insert(NewIsland);
1099 createNewWater(CPUserIndex, UserOffset, NewMBB);
1108 if (IP != WaterList.end())
1109 NewWaterList.
erase(WaterBB);
1112 NewWaterList.
insert(NewIsland);
1119 if (IP != WaterList.end())
1120 WaterList.erase(IP);
1126 updateForInsertedWaterBlock(NewIsland);
1129 decrementCPEReferenceCount(CPI, CPEMI);
1133 unsigned ID = createPICLabelUId();
1137 U.HighWaterMark = NewIsland;
1142 CPEntries[CPI].push_back(CPEntry(
U.CPEMI,
ID, 1));
1150 adjustBBOffsetsAfter(&*--NewIsland->
getIterator());
1160 dbgs() <<
" Moved CPE to #" <<
ID <<
" CPI=" << CPI
1168void CSKYConstantIslands::removeDeadCPEMI(
MachineInstr *CPEMI) {
1174 if (CPEBB->
empty()) {
1184 adjustBBOffsetsAfter(CPEBB);
1194bool CSKYConstantIslands::removeUnusedCPEntries() {
1195 unsigned MadeChange =
false;
1196 for (
unsigned I = 0,
E = CPEntries.size();
I !=
E; ++
I) {
1197 std::vector<CPEntry> &CPEs = CPEntries[
I];
1198 for (
unsigned J = 0, Ee = CPEs.size(); J != Ee; ++J) {
1199 if (CPEs[J].RefCount == 0 && CPEs[J].CPEMI) {
1200 removeDeadCPEMI(CPEs[J].CPEMI);
1201 CPEs[J].CPEMI =
nullptr;
1214 unsigned BrOffset = getOffsetOf(
MI);
1215 unsigned DestOffset = BBInfo[DestBB->
getNumber()].Offset;
1219 <<
" max delta=" << MaxDisp <<
" from " << getOffsetOf(
MI)
1220 <<
" to " << DestOffset <<
" offset "
1221 <<
int(DestOffset - BrOffset) <<
"\t" << *
MI);
1223 if (BrOffset <= DestOffset) {
1225 if (DestOffset - BrOffset <= MaxDisp)
1228 if (BrOffset - DestOffset <= MaxDisp)
1236bool CSKYConstantIslands::fixupImmediateBr(ImmBranch &Br) {
1241 if (isBBInRange(
MI, DestBB, Br.MaxDisp))
1245 return fixupUnconditionalBr(Br);
1246 return fixupConditionalBr(Br);
1253bool CSKYConstantIslands::fixupUnconditionalBr(ImmBranch &Br) {
1257 if (!MFI->isLRSpilled())
1261 Br.MaxDisp = ((1 << (26 - 1)) - 1) * 2;
1262 MI->setDesc(
TII->get(CSKY::BSR32_BR));
1264 adjustBBOffsetsAfter(
MBB);
1275bool CSKYConstantIslands::fixupConditionalBr(ImmBranch &Br) {
1281 Cond.push_back(
MI->getOperand(0));
1311 if (isBBInRange(
MI, NewDest, Br.MaxDisp)) {
1313 dbgs() <<
" Invert Bcc condition and swap its destination with "
1316 MI->getOperand(
MI->getNumExplicitOperands() - 1).setMBB(NewDest);
1318 MI->setDesc(
TII->get(
Cond[0].getImm()));
1325 splitBlockBeforeInstr(*
MI);
1328 int Delta =
TII->getInstSizeInBytes(
MBB->
back());
1341 <<
" also invert condition and change dest. to "
1348 .
addReg(
MI->getOperand(0).getReg())
1356 ImmBranches.push_back(ImmBranch(&
MBB->
back(), MaxDisp,
false, Br.UncondBr));
1359 BBInfo[
MI->getParent()->getNumber()].Size -=
TII->getInstSizeInBytes(*
MI);
1360 MI->eraseFromParent();
1361 adjustBBOffsetsAfter(
MBB);
1367 return new CSKYConstantIslands();
1371 "CSKY constant island placement and branch shortening pass",
MachineBasicBlock MachineBasicBlock::iterator MBBI
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static unsigned getUnconditionalBrDisp(int Opc)
getUnconditionalBrDisp - Returns the maximum displacement that can fit in the specific unconditional ...
static bool bbHasFallthrough(MachineBasicBlock *MBB)
BBHasFallthrough - Return true if the specified basic block can fallthrough into the block immediatel...
static bool bbIsJumpedOver(MachineBasicBlock *MBB)
BBIsJumpedOver - Return true of the specified basic block's only predecessor unconditionally branches...
static bool compareMbbNumbers(const MachineBasicBlock *LHS, const MachineBasicBlock *RHS)
CompareMBBNumbers - Little predicate function to sort the WaterList by MBB ID.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
const HexagonInstrInfo * TII
This file declares the MachineConstantPool class which is an abstract constant pool to keep track of ...
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
const SmallVectorImpl< MachineOperand > & Cond
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallSet class.
This file defines the SmallVector class.
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
This class represents an Operation in the Expression.
A parsed version of the target data layout string in and methods for querying it.
FunctionPass class - This class is used to implement most global optimizations.
bool reverseBranchCondition(SmallVectorImpl< MachineOperand > &Cond) const override
Reverses the branch condition of the specified condition list, returning false on success and true if...
unsigned pred_size() const
void transferSuccessors(MachineBasicBlock *FromMBB)
Transfers all the successors from MBB to this machine basic block (i.e., copies all the successors Fr...
instr_iterator insert(instr_iterator I, MachineInstr *M)
Insert MI into the instruction list before I, possibly inside a bundle.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
void push_back(MachineInstr *MI)
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
succ_iterator succ_begin()
unsigned succ_size() const
void setAlignment(Align A)
Set alignment of the basic block.
std::vector< MachineBasicBlock * >::iterator succ_iterator
void addSuccessor(MachineBasicBlock *Succ, BranchProbability Prob=BranchProbability::getUnknown())
Add Succ as a successor of this MachineBasicBlock.
pred_iterator pred_begin()
MachineInstrBundleIterator< MachineInstr, true > reverse_iterator
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
Align getAlignment() const
Return alignment of the basic block.
MachineInstrBundleIterator< MachineInstr > iterator
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
virtual MachineFunctionProperties getRequiredProperties() const
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
void RenumberBlocks(MachineBasicBlock *MBBFrom=nullptr)
RenumberBlocks - This discards all of the MachineBasicBlock numbers and recomputes them.
BasicBlockListType::const_iterator const_iterator
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
const MachineInstrBuilder & addConstantPoolIndex(unsigned Idx, int Offset=0, unsigned TargetFlags=0) const
const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned TargetFlags=0) const
MachineInstr * getInstr() const
If conversion operators fail, use this method to get the MachineInstr explicitly.
Representation of each machine instruction.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
unsigned getNumOperands() const
Retuns the total number of operands.
unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
bool isUnconditionalBranch(QueryType Type=AnyInBundle) const
Return true if this is a branch which always transfers control flow to some other block.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
const MachineOperand & getOperand(unsigned i) const
MachineBasicBlock * getMBB() const
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
void setMBB(MachineBasicBlock *MBB)
static MachineOperand CreateImm(int64_t Val)
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
self_iterator getIterator()
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
bool isAligned(Align Lhs, uint64_t SizeInBytes)
Checks that SizeInBytes is a multiple of the alignment.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
uint64_t offsetToAlignment(uint64_t Value, Align Alignment)
Returns the offset to the next integer (mod 2**64) that is greater than or equal to Value and is a mu...
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
FunctionPass * createCSKYConstantIslandPass()
Returns a pass that converts branches to long branches.
DWARFExpression::Operation Op
unsigned Log2(Align A)
Returns the log2 of the alignment.
Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t value() const
This is a hole in the type system and should not be abused.
BasicBlockInfo - Information about the offset and size of a single basic block.
unsigned Size
Size - Size of the basic block in bytes.
unsigned postOffset(Align Alignment=Align(1)) const
Compute the offset immediately following this block.
unsigned Offset
Offset - Distance from the beginning of the function to the beginning of this basic block.