#include "XCore.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/IntrinsicsXCore.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/NoFolder.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#define DEBUG_TYPE …
usingnamespacellvm;
static cl::opt<unsigned> MaxThreads(
"xcore-max-threads", cl::Optional,
cl::desc("Maximum number of threads (for emulation thread-local storage)"),
cl::Hidden, cl::value_desc("number"), cl::init(8));
namespace {
struct XCoreLowerThreadLocal : public ModulePass { … };
}
char XCoreLowerThreadLocal::ID = …;
INITIALIZE_PASS(…)
ModulePass *llvm::createXCoreLowerThreadLocalPass() { … }
static ArrayType *createLoweredType(Type *OriginalType) { … }
static Constant *
createLoweredInitializer(ArrayType *NewType, Constant *OriginalInitializer) { … }
static bool replaceConstantExprOp(ConstantExpr *CE, Pass *P) { … }
static bool rewriteNonInstructionUses(GlobalVariable *GV, Pass *P) { … }
static bool isZeroLengthArray(Type *Ty) { … }
bool XCoreLowerThreadLocal::lowerGlobal(GlobalVariable *GV) { … }
bool XCoreLowerThreadLocal::runOnModule(Module &M) { … }