mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Add a method to generate a string representation from a TargetData.
This continues the work on PR 761. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28239 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
07000c6f01
commit
2577c22131
@ -94,6 +94,11 @@ public:
|
|||||||
unsigned char getPointerSize() const { return PointerSize; }
|
unsigned char getPointerSize() const { return PointerSize; }
|
||||||
unsigned char getPointerSizeInBits() const { return 8*PointerSize; }
|
unsigned char getPointerSizeInBits() const { return 8*PointerSize; }
|
||||||
|
|
||||||
|
/// getStringRepresentation - Return the string representation of the
|
||||||
|
/// TargetData. This representation is in the same format accepted by the
|
||||||
|
/// string constructor above.
|
||||||
|
std::string getStringRepresentation() const;
|
||||||
|
|
||||||
/// getTypeSize - Return the number of bytes necessary to hold the specified
|
/// getTypeSize - Return the number of bytes necessary to hold the specified
|
||||||
/// type.
|
/// type.
|
||||||
///
|
///
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <sstream>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Handle the Pass registration stuff necessary to use TargetData's.
|
// Handle the Pass registration stuff necessary to use TargetData's.
|
||||||
@ -218,6 +219,26 @@ TargetData::~TargetData() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string TargetData::getStringRepresentation() const {
|
||||||
|
std::stringstream repr;
|
||||||
|
|
||||||
|
if (LittleEndian)
|
||||||
|
repr << "e";
|
||||||
|
else
|
||||||
|
repr << "E";
|
||||||
|
|
||||||
|
repr << "-p:" << (PointerSize * 8) << ":" << (PointerAlignment * 8);
|
||||||
|
repr << "-d:64:" << (DoubleAlignment * 8);
|
||||||
|
repr << "-f:32:" << (FloatAlignment * 8);
|
||||||
|
repr << "-l:64:" << (LongAlignment * 8);
|
||||||
|
repr << "-i:32:" << (IntAlignment * 8);
|
||||||
|
repr << "-s:16:" << (ShortAlignment * 8);
|
||||||
|
repr << "-b:8:" << (ByteAlignment * 8);
|
||||||
|
repr << "-B:8:" << (BoolAlignment * 8);
|
||||||
|
|
||||||
|
return repr.str();
|
||||||
|
}
|
||||||
|
|
||||||
const StructLayout *TargetData::getStructLayout(const StructType *Ty) const {
|
const StructLayout *TargetData::getStructLayout(const StructType *Ty) const {
|
||||||
if (Layouts == 0)
|
if (Layouts == 0)
|
||||||
Layouts = new std::map<std::pair<const TargetData*,const StructType*>,
|
Layouts = new std::map<std::pair<const TargetData*,const StructType*>,
|
||||||
|
Loading…
Reference in New Issue
Block a user