mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Reformat 3 files in llvm/include/llvm/CodeGen/.
llvm-svn: 249287
This commit is contained in:
parent
1c96707452
commit
af9dd4326b
@ -19,41 +19,40 @@
|
||||
#include "llvm/IR/Intrinsics.h"
|
||||
|
||||
namespace llvm {
|
||||
class CallInst;
|
||||
class Module;
|
||||
class DataLayout;
|
||||
class CallInst;
|
||||
class Module;
|
||||
class DataLayout;
|
||||
|
||||
class IntrinsicLowering {
|
||||
const DataLayout& DL;
|
||||
class IntrinsicLowering {
|
||||
const DataLayout &DL;
|
||||
|
||||
|
||||
bool Warned;
|
||||
public:
|
||||
explicit IntrinsicLowering(const DataLayout &DL) :
|
||||
DL(DL), Warned(false) {}
|
||||
bool Warned;
|
||||
|
||||
/// AddPrototypes - This method, if called, causes all of the prototypes
|
||||
/// that might be needed by an intrinsic lowering implementation to be
|
||||
/// inserted into the module specified.
|
||||
void AddPrototypes(Module &M);
|
||||
public:
|
||||
explicit IntrinsicLowering(const DataLayout &DL) : DL(DL), Warned(false) {}
|
||||
|
||||
/// LowerIntrinsicCall - This method replaces a call with the LLVM function
|
||||
/// which should be used to implement the specified intrinsic function call.
|
||||
/// If an intrinsic function must be implemented by the code generator
|
||||
/// (such as va_start), this function should print a message and abort.
|
||||
///
|
||||
/// Otherwise, if an intrinsic function call can be lowered, the code to
|
||||
/// implement it (often a call to a non-intrinsic function) is inserted
|
||||
/// _after_ the call instruction and the call is deleted. The caller must
|
||||
/// be capable of handling this kind of change.
|
||||
///
|
||||
void LowerIntrinsicCall(CallInst *CI);
|
||||
/// AddPrototypes - This method, if called, causes all of the prototypes
|
||||
/// that might be needed by an intrinsic lowering implementation to be
|
||||
/// inserted into the module specified.
|
||||
void AddPrototypes(Module &M);
|
||||
|
||||
/// LowerToByteSwap - Replace a call instruction into a call to bswap
|
||||
/// intrinsic. Return false if it has determined the call is not a
|
||||
/// simple integer bswap.
|
||||
static bool LowerToByteSwap(CallInst *CI);
|
||||
};
|
||||
/// LowerIntrinsicCall - This method replaces a call with the LLVM function
|
||||
/// which should be used to implement the specified intrinsic function call.
|
||||
/// If an intrinsic function must be implemented by the code generator
|
||||
/// (such as va_start), this function should print a message and abort.
|
||||
///
|
||||
/// Otherwise, if an intrinsic function call can be lowered, the code to
|
||||
/// implement it (often a call to a non-intrinsic function) is inserted
|
||||
/// _after_ the call instruction and the call is deleted. The caller must
|
||||
/// be capable of handling this kind of change.
|
||||
///
|
||||
void LowerIntrinsicCall(CallInst *CI);
|
||||
|
||||
/// LowerToByteSwap - Replace a call instruction into a call to bswap
|
||||
/// intrinsic. Return false if it has determined the call is not a
|
||||
/// simple integer bswap.
|
||||
static bool LowerToByteSwap(CallInst *CI);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -25,76 +25,74 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class LiveStacks : public MachineFunctionPass {
|
||||
const TargetRegisterInfo *TRI;
|
||||
class LiveStacks : public MachineFunctionPass {
|
||||
const TargetRegisterInfo *TRI;
|
||||
|
||||
/// Special pool allocator for VNInfo's (LiveInterval val#).
|
||||
///
|
||||
VNInfo::Allocator VNInfoAllocator;
|
||||
/// Special pool allocator for VNInfo's (LiveInterval val#).
|
||||
///
|
||||
VNInfo::Allocator VNInfoAllocator;
|
||||
|
||||
/// S2IMap - Stack slot indices to live interval mapping.
|
||||
///
|
||||
typedef std::unordered_map<int, LiveInterval> SS2IntervalMap;
|
||||
SS2IntervalMap S2IMap;
|
||||
/// S2IMap - Stack slot indices to live interval mapping.
|
||||
///
|
||||
typedef std::unordered_map<int, LiveInterval> SS2IntervalMap;
|
||||
SS2IntervalMap S2IMap;
|
||||
|
||||
/// S2RCMap - Stack slot indices to register class mapping.
|
||||
std::map<int, const TargetRegisterClass*> S2RCMap;
|
||||
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
LiveStacks() : MachineFunctionPass(ID) {
|
||||
initializeLiveStacksPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
/// S2RCMap - Stack slot indices to register class mapping.
|
||||
std::map<int, const TargetRegisterClass *> S2RCMap;
|
||||
|
||||
typedef SS2IntervalMap::iterator iterator;
|
||||
typedef SS2IntervalMap::const_iterator const_iterator;
|
||||
const_iterator begin() const { return S2IMap.begin(); }
|
||||
const_iterator end() const { return S2IMap.end(); }
|
||||
iterator begin() { return S2IMap.begin(); }
|
||||
iterator end() { return S2IMap.end(); }
|
||||
public:
|
||||
static char ID; // Pass identification, replacement for typeid
|
||||
LiveStacks() : MachineFunctionPass(ID) {
|
||||
initializeLiveStacksPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
unsigned getNumIntervals() const { return (unsigned)S2IMap.size(); }
|
||||
typedef SS2IntervalMap::iterator iterator;
|
||||
typedef SS2IntervalMap::const_iterator const_iterator;
|
||||
const_iterator begin() const { return S2IMap.begin(); }
|
||||
const_iterator end() const { return S2IMap.end(); }
|
||||
iterator begin() { return S2IMap.begin(); }
|
||||
iterator end() { return S2IMap.end(); }
|
||||
|
||||
LiveInterval &getOrCreateInterval(int Slot, const TargetRegisterClass *RC);
|
||||
unsigned getNumIntervals() const { return (unsigned)S2IMap.size(); }
|
||||
|
||||
LiveInterval &getInterval(int Slot) {
|
||||
assert(Slot >= 0 && "Spill slot indice must be >= 0");
|
||||
SS2IntervalMap::iterator I = S2IMap.find(Slot);
|
||||
assert(I != S2IMap.end() && "Interval does not exist for stack slot");
|
||||
return I->second;
|
||||
}
|
||||
LiveInterval &getOrCreateInterval(int Slot, const TargetRegisterClass *RC);
|
||||
|
||||
const LiveInterval &getInterval(int Slot) const {
|
||||
assert(Slot >= 0 && "Spill slot indice must be >= 0");
|
||||
SS2IntervalMap::const_iterator I = S2IMap.find(Slot);
|
||||
assert(I != S2IMap.end() && "Interval does not exist for stack slot");
|
||||
return I->second;
|
||||
}
|
||||
LiveInterval &getInterval(int Slot) {
|
||||
assert(Slot >= 0 && "Spill slot indice must be >= 0");
|
||||
SS2IntervalMap::iterator I = S2IMap.find(Slot);
|
||||
assert(I != S2IMap.end() && "Interval does not exist for stack slot");
|
||||
return I->second;
|
||||
}
|
||||
|
||||
bool hasInterval(int Slot) const {
|
||||
return S2IMap.count(Slot);
|
||||
}
|
||||
const LiveInterval &getInterval(int Slot) const {
|
||||
assert(Slot >= 0 && "Spill slot indice must be >= 0");
|
||||
SS2IntervalMap::const_iterator I = S2IMap.find(Slot);
|
||||
assert(I != S2IMap.end() && "Interval does not exist for stack slot");
|
||||
return I->second;
|
||||
}
|
||||
|
||||
const TargetRegisterClass *getIntervalRegClass(int Slot) const {
|
||||
assert(Slot >= 0 && "Spill slot indice must be >= 0");
|
||||
std::map<int, const TargetRegisterClass*>::const_iterator
|
||||
I = S2RCMap.find(Slot);
|
||||
assert(I != S2RCMap.end() &&
|
||||
"Register class info does not exist for stack slot");
|
||||
return I->second;
|
||||
}
|
||||
bool hasInterval(int Slot) const { return S2IMap.count(Slot); }
|
||||
|
||||
VNInfo::Allocator& getVNInfoAllocator() { return VNInfoAllocator; }
|
||||
const TargetRegisterClass *getIntervalRegClass(int Slot) const {
|
||||
assert(Slot >= 0 && "Spill slot indice must be >= 0");
|
||||
std::map<int, const TargetRegisterClass *>::const_iterator I =
|
||||
S2RCMap.find(Slot);
|
||||
assert(I != S2RCMap.end() &&
|
||||
"Register class info does not exist for stack slot");
|
||||
return I->second;
|
||||
}
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
void releaseMemory() override;
|
||||
VNInfo::Allocator &getVNInfoAllocator() { return VNInfoAllocator; }
|
||||
|
||||
/// runOnMachineFunction - pass entry point
|
||||
bool runOnMachineFunction(MachineFunction&) override;
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
void releaseMemory() override;
|
||||
|
||||
/// print - Implement the dump method.
|
||||
void print(raw_ostream &O, const Module* = nullptr) const override;
|
||||
};
|
||||
/// runOnMachineFunction - pass entry point
|
||||
bool runOnMachineFunction(MachineFunction &) override;
|
||||
|
||||
/// print - Implement the dump method.
|
||||
void print(raw_ostream &O, const Module * = nullptr) const override;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* LLVM_CODEGEN_LIVESTACK_ANALYSIS_H */
|
||||
|
@ -18,79 +18,71 @@
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
|
||||
namespace llvm {
|
||||
class MCSymbol;
|
||||
class MCSymbol;
|
||||
|
||||
/// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
|
||||
/// for MachO targets.
|
||||
class MachineModuleInfoMachO : public MachineModuleInfoImpl {
|
||||
/// FnStubs - Darwin '$stub' stubs. The key is something like "Lfoo$stub",
|
||||
/// the value is something like "_foo".
|
||||
DenseMap<MCSymbol*, StubValueTy> FnStubs;
|
||||
|
||||
/// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
|
||||
/// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
|
||||
/// is true if this GV is external.
|
||||
DenseMap<MCSymbol*, StubValueTy> GVStubs;
|
||||
|
||||
/// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
|
||||
/// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
|
||||
/// these are for things with hidden visibility. The extra bit is true if
|
||||
/// this GV is external.
|
||||
DenseMap<MCSymbol*, StubValueTy> HiddenGVStubs;
|
||||
|
||||
virtual void anchor(); // Out of line virtual method.
|
||||
public:
|
||||
MachineModuleInfoMachO(const MachineModuleInfo &) {}
|
||||
|
||||
StubValueTy &getFnStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return FnStubs[Sym];
|
||||
}
|
||||
/// MachineModuleInfoMachO - This is a MachineModuleInfoImpl implementation
|
||||
/// for MachO targets.
|
||||
class MachineModuleInfoMachO : public MachineModuleInfoImpl {
|
||||
/// FnStubs - Darwin '$stub' stubs. The key is something like "Lfoo$stub",
|
||||
/// the value is something like "_foo".
|
||||
DenseMap<MCSymbol *, StubValueTy> FnStubs;
|
||||
|
||||
StubValueTy &getGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return GVStubs[Sym];
|
||||
}
|
||||
/// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
|
||||
/// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
|
||||
/// is true if this GV is external.
|
||||
DenseMap<MCSymbol *, StubValueTy> GVStubs;
|
||||
|
||||
StubValueTy &getHiddenGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return HiddenGVStubs[Sym];
|
||||
}
|
||||
/// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
|
||||
/// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
|
||||
/// these are for things with hidden visibility. The extra bit is true if
|
||||
/// this GV is external.
|
||||
DenseMap<MCSymbol *, StubValueTy> HiddenGVStubs;
|
||||
|
||||
/// Accessor methods to return the set of stubs in sorted order.
|
||||
SymbolListTy GetFnStubList() {
|
||||
return getSortedStubs(FnStubs);
|
||||
}
|
||||
SymbolListTy GetGVStubList() {
|
||||
return getSortedStubs(GVStubs);
|
||||
}
|
||||
SymbolListTy GetHiddenGVStubList() {
|
||||
return getSortedStubs(HiddenGVStubs);
|
||||
}
|
||||
};
|
||||
virtual void anchor(); // Out of line virtual method.
|
||||
public:
|
||||
MachineModuleInfoMachO(const MachineModuleInfo &) {}
|
||||
|
||||
/// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
|
||||
/// for ELF targets.
|
||||
class MachineModuleInfoELF : public MachineModuleInfoImpl {
|
||||
/// GVStubs - These stubs are used to materialize global addresses in PIC
|
||||
/// mode.
|
||||
DenseMap<MCSymbol*, StubValueTy> GVStubs;
|
||||
StubValueTy &getFnStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return FnStubs[Sym];
|
||||
}
|
||||
|
||||
virtual void anchor(); // Out of line virtual method.
|
||||
public:
|
||||
MachineModuleInfoELF(const MachineModuleInfo &) {}
|
||||
StubValueTy &getGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return GVStubs[Sym];
|
||||
}
|
||||
|
||||
StubValueTy &getGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return GVStubs[Sym];
|
||||
}
|
||||
StubValueTy &getHiddenGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return HiddenGVStubs[Sym];
|
||||
}
|
||||
|
||||
/// Accessor methods to return the set of stubs in sorted order.
|
||||
/// Accessor methods to return the set of stubs in sorted order.
|
||||
SymbolListTy GetFnStubList() { return getSortedStubs(FnStubs); }
|
||||
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
|
||||
SymbolListTy GetHiddenGVStubList() { return getSortedStubs(HiddenGVStubs); }
|
||||
};
|
||||
|
||||
SymbolListTy GetGVStubList() {
|
||||
return getSortedStubs(GVStubs);
|
||||
}
|
||||
};
|
||||
/// MachineModuleInfoELF - This is a MachineModuleInfoImpl implementation
|
||||
/// for ELF targets.
|
||||
class MachineModuleInfoELF : public MachineModuleInfoImpl {
|
||||
/// GVStubs - These stubs are used to materialize global addresses in PIC
|
||||
/// mode.
|
||||
DenseMap<MCSymbol *, StubValueTy> GVStubs;
|
||||
|
||||
virtual void anchor(); // Out of line virtual method.
|
||||
public:
|
||||
MachineModuleInfoELF(const MachineModuleInfo &) {}
|
||||
|
||||
StubValueTy &getGVStubEntry(MCSymbol *Sym) {
|
||||
assert(Sym && "Key cannot be null");
|
||||
return GVStubs[Sym];
|
||||
}
|
||||
|
||||
/// Accessor methods to return the set of stubs in sorted order.
|
||||
|
||||
SymbolListTy GetGVStubList() { return getSortedStubs(GVStubs); }
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user