llvm/llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp

//===-- XCoreLowerThreadLocal - Lower thread local variables --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file contains a pass that lowers thread local variables on the
///        XCore.
///
//===----------------------------------------------------------------------===//

#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 {
  /// Lowers thread local variables on the XCore. Each thread local variable is
  /// expanded to an array of n elements indexed by the thread ID where n is the
  /// fixed number hardware threads supported by the device.
  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) {}