[LLVMdev] The size of char
Vladimir Prus
ghost at cs.msu.su
Sat Jun 19 05:33:01 PDT 2004
To figure out the size of data varaibles for my backend, I tries this code
stolen from X86 backend:
const TargetData& TD = m_tm.getTargetData();
unsigned size = TD.getTypeSize(initializer->getType());
However, the getTypeInfo function in TargetData.cpp contains this:
case Type::VoidTyID:
case Type::BoolTyID:
case Type::UByteTyID:
case Type::SByteTyID: Size = 1; Alignment = TD->getByteAlignment();
return;
The problem is that my target can't address bytes -- the memory interface
itself specifies word addresses. For that reason, I'd like to allocate 4-byte
(word) blocks even for bools/chars/ubytes and so on. That's exactly what the
standard compiler does, btw.
So, what am I to do, except for copy-pasting the function and adjusting sizes?
- Volodya
More information about the llvm-dev
mailing list