[LLVMdev] [PATCH] TLS support for Windows 32+64bit

Eli Friedman eli.friedman at gmail.com
Wed Jan 25 13:38:23 PST 2012


On Thu, Jan 19, 2012 at 9:24 AM, Kai <kai at redstar.de> wrote:
> Hi!
>
> I added 2 more tests and also refined an assert statement. Applies cleanly
> to r148473 now. Are there more comments on the code? Thank you!!

+  assert(Inst.getOperand(0).isReg() &&
+	     (Inst.getOperand(ImmOp).isImm() ||
+		 (Inst.getOperand(ImmOp).isExpr() &&
+		  Inst.getOperand(ImmOp).getExpr()->getKind() == MCExpr::SymbolRef) &&
+		  static_cast<const
MCSymbolRefExpr*>(Inst.getOperand(ImmOp).getExpr())->getKind() ==
MCSymbolRefExpr::VK_SECREL) &&

Just asserting "Inst.getOperand(ImmOp).isImm() ||
(Inst.getOperand(ImmOp).isExpr()" should be sufficient here; in
theory, a wide variety of relocatable expressions are legal here, even
if we don't actually generate code like that at the moment.

I would prefer if someone more familiar with COFF MC stuff could take
a look to make sure there isn't anything obviously wrong; otherwise,
the patch looks good.

-Eli



More information about the llvm-dev mailing list