<commit_before>//===-- llvm/Target/TargetData.h - Data size & alignment routines-*- C++ -*-==//
//
// This file defines target properties related to datatype size/offset/alignment
// information.  It uses lazy annotations to cache information about how 
// structure types are laid out and used.
//
// This structure should be created once, filled in if the defaults are not
// correct and then passed around by const&.  None of the members functions
// require modification to the object.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_TARGETDATA_H
#define LLVM_TARGET_TARGETDATA_H

#include "llvm/Annotation.h"
#include "Support/DataTypes.h"
#include <vector>
class Value;
class Type;
class StructType;
class StructLayout;

class TargetData {
  unsigned char ByteAlignment;         // Defaults to 1 bytes
  unsigned char ShortAlignment;        // Defaults to 2 bytes
  unsigned char IntAlignment;          // Defaults to 4 bytes
  unsigned char LongAlignment;         // Defaults to 8 bytes
  unsigned char FloatAlignment;        // Defaults to 4 bytes
  unsigned char DoubleAlignment;       // Defaults to 8 bytes
  unsigned char PointerSize;           // Defaults to 8 bytes
  unsigned char IntegerRegSize;        // Defaults to PointerSize = 8 bytes
  unsigned char PointerAlignment;      // Defaults to 8 bytes
  AnnotationID  AID;                   // AID for structure layout annotation
 
  static Annotation *TypeAnFactory(AnnotationID, const Annotable *, void *);
public:
  TargetData(const std::string &TargetName,
             unsigned char IntRegSize = 8,
             unsigned char PtrSize = 8,
	     unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
	     unsigned char FloatAl = 4, unsigned char LongAl = 8, 
	     unsigned char IntAl = 4, unsigned char ShortAl = 2,
	     unsigned char ByteAl = 1);
  ~TargetData();  // Not virtual, do not subclass this class

  unsigned char getByteAlignment()    const { return    ByteAlignment; }
  unsigned char getShortAlignment()   const { return   ShortAlignment; }
  unsigned char getIntAlignment()     const { return     IntAlignment; }
  unsigned char getLongAlignment()    const { return    LongAlignment; }
  unsigned char getFloatAlignment()   const { return   FloatAlignment; }
  unsigned char getDoubleAlignment()  const { return  DoubleAlignment; }
  unsigned char getPointerAlignment() const { return PointerAlignment; }
  unsigned char getPointerSize()      const { return PointerSize; }
  unsigned char getIntegerRegize()    const { return IntegerRegSize; }
  AnnotationID  getStructLayoutAID()  const { return AID; }

  // getTypeSize - Return the number of bytes neccesary to hold the specified
  // type
  uint64_t      getTypeSize     (const Type *Ty) const;

  // getTypeAlignment - Return the minimum required alignment for the specified
  // type
  unsigned char getTypeAlignment(const Type *Ty) const;

  // getIndexOffset - return the offset from the beginning of the type for the
  // specified indices.  This is used to implement getElementPtr and load and 
  // stores that include the implicit form of getelementptr.
  //
  uint64_t      getIndexedOffset(const Type *Ty, 
				 const std::vector<Value*> &Indices) const;
  
  inline const StructLayout *getStructLayout(const StructType *Ty) const {
    return (const StructLayout*)
         ((const Annotable*)Ty)->getOrCreateAnnotation(AID);
  }
};

// This annotation (attached ONLY to StructType classes) is used to lazily
// calculate structure layout information for a target machine, based on the
// TargetData structure.
//
struct StructLayout : public Annotation {
  std::vector<uint64_t> MemberOffsets;
  uint64_t StructSize;
  unsigned StructAlignment;
private:
  friend class TargetData;   // Only TargetData can create this class
  inline StructLayout(const StructType *ST, const TargetData &TD);
};

#endif<commit_msg>There are no implicit gep forms of load and store anymore<commit_after>//===-- llvm/Target/TargetData.h - Data size & alignment routines-*- C++ -*-==//
//
// This file defines target properties related to datatype size/offset/alignment
// information.  It uses lazy annotations to cache information about how 
// structure types are laid out and used.
//
// This structure should be created once, filled in if the defaults are not
// correct and then passed around by const&.  None of the members functions
// require modification to the object.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_TARGETDATA_H
#define LLVM_TARGET_TARGETDATA_H

#include "llvm/Annotation.h"
#include "Support/DataTypes.h"
#include <vector>
class Value;
class Type;
class StructType;
class StructLayout;

class TargetData {
  unsigned char ByteAlignment;         // Defaults to 1 bytes
  unsigned char ShortAlignment;        // Defaults to 2 bytes
  unsigned char IntAlignment;          // Defaults to 4 bytes
  unsigned char LongAlignment;         // Defaults to 8 bytes
  unsigned char FloatAlignment;        // Defaults to 4 bytes
  unsigned char DoubleAlignment;       // Defaults to 8 bytes
  unsigned char PointerSize;           // Defaults to 8 bytes
  unsigned char IntegerRegSize;        // Defaults to PointerSize = 8 bytes
  unsigned char PointerAlignment;      // Defaults to 8 bytes
  AnnotationID  AID;                   // AID for structure layout annotation
 
  static Annotation *TypeAnFactory(AnnotationID, const Annotable *, void *);
public:
  TargetData(const std::string &TargetName,
             unsigned char IntRegSize = 8,
             unsigned char PtrSize = 8,
	     unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
	     unsigned char FloatAl = 4, unsigned char LongAl = 8, 
	     unsigned char IntAl = 4, unsigned char ShortAl = 2,
	     unsigned char ByteAl = 1);
  ~TargetData();  // Not virtual, do not subclass this class

  unsigned char getByteAlignment()    const { return    ByteAlignment; }
  unsigned char getShortAlignment()   const { return   ShortAlignment; }
  unsigned char getIntAlignment()     const { return     IntAlignment; }
  unsigned char getLongAlignment()    const { return    LongAlignment; }
  unsigned char getFloatAlignment()   const { return   FloatAlignment; }
  unsigned char getDoubleAlignment()  const { return  DoubleAlignment; }
  unsigned char getPointerAlignment() const { return PointerAlignment; }
  unsigned char getPointerSize()      const { return PointerSize; }
  unsigned char getIntegerRegize()    const { return IntegerRegSize; }
  AnnotationID  getStructLayoutAID()  const { return AID; }

  // getTypeSize - Return the number of bytes neccesary to hold the specified
  // type
  uint64_t      getTypeSize     (const Type *Ty) const;

  // getTypeAlignment - Return the minimum required alignment for the specified
  // type
  unsigned char getTypeAlignment(const Type *Ty) const;

  // getIndexOffset - return the offset from the beginning of the type for the
  // specified indices.  This is used to implement getelementptr.
  //
  uint64_t      getIndexedOffset(const Type *Ty, 
				 const std::vector<Value*> &Indices) const;
  
  inline const StructLayout *getStructLayout(const StructType *Ty) const {
    return (const StructLayout*)
         ((const Annotable*)Ty)->getOrCreateAnnotation(AID);
  }
};

// This annotation (attached ONLY to StructType classes) is used to lazily
// calculate structure layout information for a target machine, based on the
// TargetData structure.
//
struct StructLayout : public Annotation {
  std::vector<uint64_t> MemberOffsets;
  uint64_t StructSize;
  unsigned StructAlignment;
private:
  friend class TargetData;   // Only TargetData can create this class
  inline StructLayout(const StructType *ST, const TargetData &TD);
};

#endif
{'fraction_non_alphanumeric': 0.0941417242261448, 'fraction_numerical': 0.00665131747249936, 'mean_word_length': 3.055497925311203, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6590944', 'n_tokens_mistral': 2064, 'n_tokens_neox': 1971, 'n_words': 806}