//===- subzero/src/IceDefs.h - Common Subzero declaraions -------*- C++ -*-===//
//
//                        The Subzero Code Generator
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares various useful types and classes that have
// widespread use across Subzero.  Every Subzero source file is
// expected to include IceDefs.h.
//
//===----------------------------------------------------------------------===//

#ifndef SUBZERO_SRC_ICEDEFS_H
#define SUBZERO_SRC_ICEDEFS_H

#include <cassert>
#include <cstdint>
#include <cstdio>     // snprintf
#include <functional> // std::less
#include <limits>
#include <list>
#include <map>
#include <string>
#include <vector>
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"

namespace Ice {

class Cfg;
class CfgNode;
class Constant;
class FunctionDeclaration;
class GlobalContext;
class GlobalDeclaration;
class Inst;
class InstAssign;
class InstPhi;
class InstTarget;
class LiveRange;
class Liveness;
class Operand;
class TargetLowering;
class Variable;
class VariableDeclaration;
class VariablesMetadata;

typedef llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 1024 * 1024>
ArenaAllocator;

ArenaAllocator *getCurrentCfgAllocator();

template <typename T> struct CfgLocalAllocator {
  using value_type = T;
  CfgLocalAllocator() = default;
  template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {}
  T *allocate(std::size_t Num) {
    return getCurrentCfgAllocator()->Allocate<T>(Num);
  }
  void deallocate(T *, std::size_t) {}
};
template <typename T, typename U>
inline bool operator==(const CfgLocalAllocator<T> &,
                       const CfgLocalAllocator<U> &) {
  return true;
}
template <typename T, typename U>
inline bool operator!=(const CfgLocalAllocator<T> &,
                       const CfgLocalAllocator<U> &) {
  return false;
}

typedef std::string IceString;
typedef llvm::ilist<Inst> InstList;
// Ideally PhiList would be llvm::ilist<InstPhi>, and similar for
// AssignList, but this runs into issues with SFINAE.
typedef InstList PhiList;
typedef InstList AssignList;
// VarList and NodeList are arena-allocated from the Cfg's allocator.
typedef std::vector<Variable *, CfgLocalAllocator<Variable *>> VarList;
typedef std::vector<CfgNode *, CfgLocalAllocator<CfgNode *>> NodeList;
typedef std::vector<Constant *> ConstantList;

// SizeT is for holding small-ish limits like number of source
// operands in an instruction.  It is used instead of size_t (which
// may be 64-bits wide) when we want to save space.
typedef uint32_t SizeT;

// InstNumberT is for holding an instruction number.  Instruction
// numbers are used for representing Variable live ranges.
typedef int32_t InstNumberT;

// A LiveBeginEndMapEntry maps a Variable::Number value to an
// Inst::Number value, giving the instruction number that begins or
// ends a variable's live range.
typedef std::pair<SizeT, InstNumberT> LiveBeginEndMapEntry;
typedef std::vector<LiveBeginEndMapEntry,
                    CfgLocalAllocator<LiveBeginEndMapEntry> > LiveBeginEndMap;
typedef llvm::BitVector LivenessBV;

typedef uint32_t TimerStackIdT;
typedef uint32_t TimerIdT;

// PNaCl is ILP32, so theoretically we should only need 32-bit offsets.
typedef int32_t RelocOffsetT;
enum { RelocAddrSize = 4 };

enum LivenessMode {
  // Basic version of live-range-end calculation.  Marks the last uses
  // of variables based on dataflow analysis.  Records the set of
  // live-in and live-out variables for each block.  Identifies and
  // deletes dead instructions (primarily stores).
  Liveness_Basic,

  // In addition to Liveness_Basic, also calculate the complete
  // live range for each variable in a form suitable for interference
  // calculation and register allocation.
  Liveness_Intervals
};

enum RegAllocKind {
  RAK_Global, // full, global register allocation
  RAK_InfOnly // allocation only for infinite-weight Variables
};

enum VerboseItem {
  IceV_None = 0,
  IceV_Instructions = 1 << 0,
  IceV_Deleted = 1 << 1,
  IceV_InstNumbers = 1 << 2,
  IceV_Preds = 1 << 3,
  IceV_Succs = 1 << 4,
  IceV_Liveness = 1 << 5,
  IceV_RegManager = 1 << 6,
  IceV_RegOrigins = 1 << 7,
  IceV_LinearScan = 1 << 8,
  IceV_Frame = 1 << 9,
  IceV_AddrOpt = 1 << 10,
  IceV_Random = 1 << 11,
  IceV_All = ~IceV_None,
  IceV_Most = IceV_All & ~IceV_LinearScan
};
typedef uint32_t VerboseMask;

typedef llvm::raw_ostream Ostream;
typedef llvm::raw_fd_ostream Fdstream;

// Reverse range adaptors written in terms of llvm::make_range().
template <typename T>
llvm::iterator_range<typename T::const_reverse_iterator>
reverse_range(const T &Container) {
  return llvm::make_range(Container.rbegin(), Container.rend());
}
template <typename T>
llvm::iterator_range<typename T::reverse_iterator> reverse_range(T &Container) {
  return llvm::make_range(Container.rbegin(), Container.rend());
}

} // end of namespace Ice

#endif // SUBZERO_SRC_ICEDEFS_H
