Retourner au contenu associé (journal : LLVM dans un gestionnaire de paquets ?)
Posté par meuh31 le 01 septembre 2009 à 17:55. En réponse au journal LLVM dans un gestionnaire de paquets ?. Évalué à 3.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Re: LLVM IR n'est pas portable
Posté par meuh31 . En réponse au journal LLVM dans un gestionnaire de paquets ?. Évalué à 3.
cat ir.c
int take_ptr(long ptr) {
return *(int*)ptr;
}
clang ir.c -emit-llvm -o - | llvm-as | opt -O3 | llvm-dis
; ModuleID = ''
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
target triple = "i386-pc-linux-gnu"
%struct.__block_descriptor = type { i32, i32 }
%struct.__block_literal_generic = type { i8*, i32, i32, i8*, %struct.__block_descriptor* }
define i32 @take_ptr(i32 %ptr) nounwind {
entry:
%conv = inttoptr i32 %ptr to i32* ; <i32*> [#uses=1]
%tmp1 = load i32* %conv ; [#uses=1]
ret i32 %tmp1
}
Note le "long -> i32" qui ne sera pas valide sur une architecture 64 bits. :(