The X86 code was switch out here:
https://codereview.chromium.org/
1216933015/diff/150001/src/IceTargetLoweringX86Base.h
The important bit might be that it's static const char * instead of
static IceString. This removes static ctor/dtor for that array,
which LTO doesn't seem to be able to optimize out, leaving ARM
and MIPS symbols in the X86-only build. After changing it to static
const char *, LTO is able to optimize out the ARM and MIPS
symbols in the x86-only build, saving about 3KB of .text and
few bytes of .rodata.
BUG=none
R=jpp@chromium.org
Review URL: https://codereview.chromium.org/
1246013004 .
return false;
}
-IceString TargetARM32::RegNames[] = {
+IceString TargetARM32::getRegName(SizeT RegNum, Type Ty) const {
+ assert(RegNum < RegARM32::Reg_NUM);
+ (void)Ty;
+ static const char *RegNames[] = {
#define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
isFP) \
name,
- REGARM32_TABLE
+ REGARM32_TABLE
#undef X
-};
+ };
-IceString TargetARM32::getRegName(SizeT RegNum, Type Ty) const {
- assert(RegNum < RegARM32::Reg_NUM);
- (void)Ty;
return RegNames[RegNum];
}
llvm::SmallBitVector ScratchRegs;
llvm::SmallBitVector RegsUsed;
VarList PhysicalRegisters[IceType_NUM];
- static IceString RegNames[];
/// Helper class that understands the Calling Convention and register
/// assignments. The first few integer type parameters can use r0-r3,
return false;
}
-IceString TargetMIPS32::RegNames[] = {
+IceString TargetMIPS32::getRegName(SizeT RegNum, Type Ty) const {
+ assert(RegNum < RegMIPS32::Reg_NUM);
+ (void)Ty;
+ static const char *RegNames[] = {
#define X(val, encode, name, scratch, preserved, stackptr, frameptr, isInt, \
isFP) \
name,
- REGMIPS32_TABLE
+ REGMIPS32_TABLE
#undef X
-};
-
-IceString TargetMIPS32::getRegName(SizeT RegNum, Type Ty) const {
- assert(RegNum < RegMIPS32::Reg_NUM);
- (void)Ty;
+ };
return RegNames[RegNum];
}
llvm::SmallBitVector ScratchRegs;
llvm::SmallBitVector RegsUsed;
VarList PhysicalRegisters[IceType_NUM];
- static IceString RegNames[];
private:
~TargetMIPS32() override = default;