[LLVMdev] How to set constant pool section?

Konstantin Vladimirov konstantin.vladimirov at gmail.com
Wed Mar 14 06:57:27 PDT 2012


Hi,

In the document: http://llvm.org/docs/WritingAnLLVMBackend.html
described example like:

SparcTargetAsmInfo::SparcTargetAsmInfo(const SparcTargetMachine &TM) {
  Data16bitsDirective = "\t.half\t";
  Data32bitsDirective = "\t.word\t";
  Data64bitsDirective = 0;  // .xword is only supported by V9.
  ZeroDirective = "\t.skip\t";
  CommentString = "!";
  ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
}

That is wrong for LLVM 3.0

In latest LLVM versions, Sparc have MC subtarget and:

SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Target &T, StringRef TT) {
  IsLittleEndian = false;
  Triple TheTriple(TT);
  if (TheTriple.getArch() == Triple::sparcv9)
    PointerSize = 8;

  Data16bitsDirective = "\t.half\t";
  Data32bitsDirective = "\t.word\t";
  Data64bitsDirective = 0;  // .xword is only supported by V9.
  ZeroDirective = "\t.skip\t";
  CommentString = "!";
  HasLEB128 = true;
  SupportsDebugInformation = true;

  SunStyleELFSectionSwitchSyntax = true;
  UsesELFSectionDirectiveForBSS = true;

  WeakRefDirective = "\t.weak\t";

  PrivateGlobalPrefix = ".L";
}

But I can not find in Sparc, or any other backend code to set
ConstantPoolSection.

I tried in my backend deriving MCAsmInfo, but it seems, that
ConstantPoolSection is not member of MCAsmInfo.

I really need in my backend value for this section, distinct from
default. Where can I set it?

Thanks in advance for all suggestions.

---
With best regards, Konstantin



More information about the llvm-dev mailing list