[llvm-commits] [llvm] r72154 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/call-imm.ll

Dan Gohman gohman at apple.com
Tue May 19 18:41:43 PDT 2009


On May 19, 2009, at 6:11 PM, Evan Cheng wrote:

> Author: evancheng
> Date: Tue May 19 20:11:00 2009
> New Revision: 72154
>
> URL: http://llvm.org/viewvc/llvm-project?rev=72154&view=rev
> Log:
> Cannot use immediate as call absolute target in PIC mode.
>
> Modified:
>    llvm/trunk/lib/Target/X86/X86InstrInfo.td
>    llvm/trunk/test/CodeGen/X86/call-imm.ll
>
> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=72154&r1=72153&r2=72154&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue May 19 20:11:00 2009
> @@ -234,6 +234,7 @@
> def SmallCode    : Predicate<"TM.getCodeModel() == CodeModel::Small">;
> def NotSmallCode : Predicate<"TM.getCodeModel() != CodeModel::Small">;
> def IsStatic     : Predicate<"TM.getRelocationModel() ==  
> Reloc::Static">;
> +def IsNotPIC     : Predicate<"TM.getRelocationModel() !=  
> Reloc::PIC_">;
> def OptForSpeed  : Predicate<"!OptForSize">;
> def FastBTMem    : Predicate<"!Subtarget->isBTMemSlow()">;
>
> @@ -562,7 +563,7 @@
>       Uses = [ESP] in {
>     def CALLpcrel32 : Ii32<0xE8, RawFrm, (outs), (ins i32imm: 
> $dst,variable_ops),
>                            "call\t${dst:call}", [(X86call imm:$dst)]>,
> -                      Requires<[In32BitMode]>;
> +                      Requires<[In32BitMode, IsNotPIC]>;

This looks like it says that CALLpcrel32 is valid only for PIC,
which isn't true. It looks like the (X86call imm:$dst) pattern
should be moved out into a "def : Pat" like the other patterns
for CALLpcrel32, so that the Requires<[IsNotPIC]> can apply to
just that pattern, not the instruction itself.

Also, it looks like the Darwin linker rejects "call 12345678" in
dynamic-no-pic mode as well as PIC mode.

Dan




More information about the llvm-commits mailing list