mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Merging r182297:
------------------------------------------------------------------------ r182297 | jholewinski | 2013-05-20 09:42:16 -0700 (Mon, 20 May 2013) | 1 line [NVPTX] Add programmatic interface to NVVMReflect pass ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_33@182827 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b47f06ee6c
commit
f3d2075c75
@ -16,6 +16,7 @@
|
|||||||
#define LLVM_TARGET_NVPTX_H
|
#define LLVM_TARGET_NVPTX_H
|
||||||
|
|
||||||
#include "MCTargetDesc/NVPTXBaseInfo.h"
|
#include "MCTargetDesc/NVPTXBaseInfo.h"
|
||||||
|
#include "llvm/ADT/StringMap.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/IR/Value.h"
|
#include "llvm/IR/Value.h"
|
||||||
#include "llvm/Support/ErrorHandling.h"
|
#include "llvm/Support/ErrorHandling.h"
|
||||||
@ -63,6 +64,8 @@ FunctionPass *createLowerStructArgsPass(NVPTXTargetMachine &);
|
|||||||
FunctionPass *createNVPTXReMatPass(NVPTXTargetMachine &);
|
FunctionPass *createNVPTXReMatPass(NVPTXTargetMachine &);
|
||||||
FunctionPass *createNVPTXReMatBlockPass(NVPTXTargetMachine &);
|
FunctionPass *createNVPTXReMatBlockPass(NVPTXTargetMachine &);
|
||||||
ModulePass *createGenericToNVVMPass();
|
ModulePass *createGenericToNVVMPass();
|
||||||
|
ModulePass *createNVVMReflectPass();
|
||||||
|
ModulePass *createNVVMReflectPass(const StringMap<int>& Mapping);
|
||||||
|
|
||||||
bool isImageOrSamplerVal(const Value *, const Module *);
|
bool isImageOrSamplerVal(const Value *, const Module *);
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
#include "NVPTX.h"
|
||||||
#include "llvm/ADT/DenseMap.h"
|
#include "llvm/ADT/DenseMap.h"
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/ADT/StringMap.h"
|
#include "llvm/ADT/StringMap.h"
|
||||||
@ -40,7 +41,7 @@ using namespace llvm;
|
|||||||
namespace llvm { void initializeNVVMReflectPass(PassRegistry &); }
|
namespace llvm { void initializeNVVMReflectPass(PassRegistry &); }
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class LLVM_LIBRARY_VISIBILITY NVVMReflect : public ModulePass {
|
class NVVMReflect : public ModulePass {
|
||||||
private:
|
private:
|
||||||
StringMap<int> VarMap;
|
StringMap<int> VarMap;
|
||||||
typedef DenseMap<std::string, int>::iterator VarMapIter;
|
typedef DenseMap<std::string, int>::iterator VarMapIter;
|
||||||
@ -48,9 +49,18 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
NVVMReflect() : ModulePass(ID) {
|
NVVMReflect() : ModulePass(ID), ReflectFunction(0) {
|
||||||
|
initializeNVVMReflectPass(*PassRegistry::getPassRegistry());
|
||||||
VarMap.clear();
|
VarMap.clear();
|
||||||
ReflectFunction = 0;
|
}
|
||||||
|
|
||||||
|
NVVMReflect(const StringMap<int> &Mapping)
|
||||||
|
: ModulePass(ID), ReflectFunction(0) {
|
||||||
|
initializeNVVMReflectPass(*PassRegistry::getPassRegistry());
|
||||||
|
for (StringMap<int>::const_iterator I = Mapping.begin(), E = Mapping.end();
|
||||||
|
I != E; ++I) {
|
||||||
|
VarMap[(*I).getKey()] = (*I).getValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); }
|
void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); }
|
||||||
@ -60,6 +70,14 @@ public:
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModulePass *llvm::createNVVMReflectPass() {
|
||||||
|
return new NVVMReflect();
|
||||||
|
}
|
||||||
|
|
||||||
|
ModulePass *llvm::createNVVMReflectPass(const StringMap<int>& Mapping) {
|
||||||
|
return new NVVMReflect(Mapping);
|
||||||
|
}
|
||||||
|
|
||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
NVVMReflectEnabled("nvvm-reflect-enable", cl::init(true),
|
NVVMReflectEnabled("nvvm-reflect-enable", cl::init(true),
|
||||||
cl::desc("NVVM reflection, enabled by default"));
|
cl::desc("NVVM reflection, enabled by default"));
|
||||||
|
Loading…
Reference in New Issue
Block a user