[llvm-dev] Alignment Member Functions should be Virtual

Hiroyuki Chishiro via llvm-dev llvm-dev at lists.llvm.org
Tue May 1 04:35:18 PDT 2018


Dear community,

I have developed a backend of new 32-bit RISC ISA, which does not have
unaligned memory access instructions (e.g., LWL, LWR, SWL, and SWR in
MIPS).
Since char and short variables are not 32-bit alignment, these
variables cannot be correctly accessed.
Therefore, alignment member functions, especially getCharAlign() and
getShortAlign() of TargetInfo class in
clang/include/clang/Basic/TargetInfo.h, should be virtual, in order to
achieve an ISA-specific alignment in an ISA-specific subclass of
TargetInfo class.
In my subclass, these return values are 32.

Sincerely,
Hiroyuki Chishiro

-- 
Hiroyuki Chishiro <chishiro at pf.is.s.u-tokyo.ac.jp>
The University of Tokyo


More information about the llvm-dev mailing list