[llvm-commits] [gcc-plugin] r80777 - in /gcc-plugin/trunk: llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-debug.cpp llvm-debug.h llvm-internal.h llvm-types.cpp
Duncan Sands
baldrick at free.fr
Wed Sep 2 03:38:07 PDT 2009
Author: baldrick
Date: Wed Sep 2 05:38:07 2009
New Revision: 80777
URL: http://llvm.org/viewvc/llvm-project?rev=80777&view=rev
Log:
Synchronize with llvm-gcc revision 80776.
Modified:
gcc-plugin/trunk/llvm-abi.h
gcc-plugin/trunk/llvm-backend.cpp
gcc-plugin/trunk/llvm-convert.cpp
gcc-plugin/trunk/llvm-debug.cpp
gcc-plugin/trunk/llvm-debug.h
gcc-plugin/trunk/llvm-internal.h
gcc-plugin/trunk/llvm-types.cpp
Modified: gcc-plugin/trunk/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-abi.h?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-abi.h (original)
+++ gcc-plugin/trunk/llvm-abi.h Wed Sep 2 05:38:07 2009
@@ -30,6 +30,7 @@
// LLVM headers
#include "llvm/Attributes.h"
+#include "llvm/CallingConv.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Target/TargetData.h"
Modified: gcc-plugin/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-backend.cpp?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-backend.cpp (original)
+++ gcc-plugin/trunk/llvm-backend.cpp Wed Sep 2 05:38:07 2009
@@ -355,28 +355,13 @@
}
//TODO// GuessAtInliningThreshold - Figure out a reasonable threshold to pass llvm's
-//TODO// inliner. There are 12 user-settable gcc params that affect inlining. llvm
-//TODO// (so far) only has one knob; the param that corresponds most closely, and
-//TODO// which we use, is max-inline-insns-auto (set by -finline-limit, which is
-//TODO// what most users actually use). This maps only very approximately to what
-//TODO// llvm's inliner is doing, but it's the best we've got.
+//TODO// inliner. gcc has many options that control inlining, but we have decided
+//TODO// not to support anything like that for llvm-gcc.
//TODOstatic unsigned GuessAtInliningThreshold() {
//TODO unsigned threshold = 200;
-//TODO // Get the default value for gcc's max-inline-insns-auto. This is the value
-//TODO // after all language and target dependent changes to the global default are
-//TODO // applied, but before parsing the command line.
-//TODO unsigned default_miia = default_max_inline_insns_auto;
-//TODO // See if the actual value is the same as the default.
-//TODO unsigned miia = MAX_INLINE_INSNS_AUTO;
-//TODO if (miia == default_miia) {
-//TODO if (optimize_size || optimize < 3)
-//TODO // Reduce inline limit.
-//TODO threshold = 50;
-//TODO } else {
-//TODO // We have an overriding user-specified value. Multiply by 20/9, which is
-//TODO // the Magic Number converting 90 to 200.
-//TODO threshold = miia * 20 / 9;
-//TODO }
+//TODO if (optimize_size || optimize < 3)
+//TODO // Reduce inline limit.
+//TODO threshold = 50;
//TODO return threshold;
//TODO}
Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Wed Sep 2 05:38:07 2009
@@ -34,8 +34,10 @@
#include "llvm/Module.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/System/Host.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
@@ -44,7 +46,6 @@
// System headers
#include <gmp.h>
-#include <iostream>
// GCC headers
#undef VISIBILITY_HIDDEN
@@ -832,9 +833,11 @@
switch (TREE_CODE(exp)) {
default:
- std::cerr << "Unhandled expression!\n"
- << "TREE_CODE: " << TREE_CODE(exp) << "\n";
- debug_tree(exp);
+ DEBUG({
+ llvm::errs() << "Unhandled expression!\n"
+ << "TREE_CODE: " << TREE_CODE(exp) << "\n";
+ debug_tree(exp);
+ });
abort();
// Control flow
@@ -1028,8 +1031,10 @@
switch (TREE_CODE(exp)) {
default:
- std::cerr << "Unhandled lvalue expression!\n";
- debug_tree(exp);
+ DEBUG({
+ errs() << "Unhandled lvalue expression!\n";
+ debug_tree(exp);
+ });
abort();
case PARM_DECL:
@@ -1111,7 +1116,7 @@
//===----------------------------------------------------------------------===//
void TreeToLLVM::TODO(tree exp) {
- std::cerr << "Unhandled tree node\n";
+ DEBUG(errs() << "Unhandled tree node\n");
if (exp) debug_tree(exp);
abort();
}
@@ -4534,6 +4539,17 @@
unsigned OTyBits = TD.getTypeSizeInBits(OTy);
unsigned OpTyBits = TD.getTypeSizeInBits(OpTy);
if (OTyBits == 0 || OpTyBits == 0 || OTyBits < OpTyBits) {
+ // It's tempting to implement the OTyBits < OpTyBits case by truncating
+ // Op down to OTy, however that breaks in the case of an inline asm
+ // constraint that corresponds to a single register, because the
+ // user can write code that assumes the whole register is defined,
+ // despite the output operand being only a subset of the register. For
+ // example:
+ //
+ // asm ("sarl $10, %%eax" : "=a"(c) : "0"(1000000));
+ //
+ // The expected behavior is for %eax to be fully defined with the value
+ // 1000000 immediately before the asm.
error_at(EXPR_LOCATION(exp),
"unsupported inline asm: input constraint with a matching "
"output constraint of incompatible type!");
@@ -7145,7 +7161,7 @@
} else if (ElTy == Type::getInt32Ty(Context)) {
assert((Len&3) == 0 &&
"Length in bytes should be a multiple of element size");
- const uint32_t *InStr = (const unsigned *)TREE_STRING_POINTER(exp);
+ const uint32_t *InStr = (const uint32_t *)TREE_STRING_POINTER(exp);
for (unsigned i = 0; i != Len/4; ++i) {
// gcc has constructed the initializer elements in the target endianness,
// but we're going to treat them as ordinary ints from here, with
Modified: gcc-plugin/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-debug.cpp?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-debug.cpp (original)
+++ gcc-plugin/trunk/llvm-debug.cpp Wed Sep 2 05:38:07 2009
@@ -287,7 +287,7 @@
llvm::DIDescriptor D;
if (!RegionStack.empty())
D = RegionStack.back();
- D = DebugFactory.CreateBlock(D);
+ D = DebugFactory.CreateLexicalBlock(D);
RegionStack.push_back(D);
DebugFactory.InsertRegionStart(D, CurBB);
}
@@ -416,6 +416,7 @@
break;
}
}
+
return
DebugFactory.CreateBasicType(getOrCreateCompileUnit(main_input_filename),
TypeName,
@@ -455,17 +456,20 @@
DIType FromTy = getOrCreateType(TREE_TYPE(type));
// type* and type&
// FIXME: Should BLOCK_POINTER_TYP have its own DW_TAG?
- unsigned Tag = (TREE_CODE(type) == POINTER_TYPE) ?
+ unsigned Tag = TREE_CODE(type) == POINTER_TYPE ?
DW_TAG_pointer_type :
DW_TAG_reference_type;
expanded_location Loc = GetNodeLocation(type);
- return DebugFactory.CreateDerivedType(Tag, findRegion(type), "",
+
+ std::string PName;
+ FromTy.getName(PName);
+ return DebugFactory.CreateDerivedType(Tag, findRegion(type), PName,
getOrCreateCompileUnit(NULL),
0 /*line no*/,
NodeSizeInBits(type),
NodeAlignInBits(type),
0 /*offset */,
- 0 /* flags */,
+ 0,
FromTy);
}
@@ -590,13 +594,22 @@
// recursive) and replace all uses of the forward declaration with the
// final definition.
expanded_location Loc = GetNodeLocation(TREE_CHAIN(type), false);
+ // FIXME: findRegion() is not able to find context all the time. This
+ // means when type names in different context match then FwdDecl is
+ // reused because MDNodes are uniqued. To avoid this, use type context
+ /// also while creating FwdDecl for now.
+ std::string FwdName;
+ if (TYPE_CONTEXT(type))
+ FwdName = GetNodeName(TYPE_CONTEXT(type));
+ FwdName = FwdName + GetNodeName(type);
+ unsigned Flags = llvm::DIType::FlagFwdDecl;
llvm::DICompositeType FwdDecl =
DebugFactory.CreateCompositeType(Tag,
findRegion(type),
- GetNodeName(type),
+ FwdName,
getOrCreateCompileUnit(Loc.file),
Loc.line,
- 0, 0, 0, llvm::DIType::FlagFwdDecl,
+ 0, 0, 0, Flags,
llvm::DIType(), llvm::DIArray(),
RunTimeLang);
@@ -605,7 +618,7 @@
return FwdDecl;
// Insert into the TypeCache so that recursive uses will find it.
- TypeCache[type] = FwdDecl;
+ TypeCache[type] = FwdDecl.getNode();
// Convert all the elements.
llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
@@ -616,7 +629,6 @@
tree BInfoType = BINFO_TYPE (BInfo);
DIType BaseClass = getOrCreateType(BInfoType);
- expanded_location loc = GetNodeLocation(type);
// FIXME : name, size, align etc...
DIType DTy =
DebugFactory.CreateDerivedType(DW_TAG_inheritance,
@@ -696,14 +708,14 @@
llvm::DIArray Elements =
DebugFactory.GetOrCreateArray(EltTys.data(), EltTys.size());
-
+
llvm::DICompositeType RealDecl =
DebugFactory.CreateCompositeType(Tag, findRegion(type),
GetNodeName(type),
getOrCreateCompileUnit(Loc.file),
Loc.line,
NodeSizeInBits(type), NodeAlignInBits(type),
- 0, 0, llvm::DIType(), Elements,
+ 0, Flags, llvm::DIType(), Elements,
RunTimeLang);
// Now that we have a real decl for the struct, replace anything using the
@@ -716,11 +728,14 @@
DIType DebugInfo::createVariantType(tree type, DIType MainTy) {
DIType Ty;
- if (tree Name = TYPE_NAME(type)) {
- if (TREE_CODE(Name) == TYPE_DECL && DECL_ORIGINAL_TYPE(Name)) {
- expanded_location TypeDefLoc = GetNodeLocation(Name);
- Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, findRegion(type),
- GetNodeName(Name),
+ if (tree TyDef = TYPE_NAME(type)) {
+ std::map<tree_node *, MDNode *>::iterator I = TypeCache.find(TyDef);
+ if (I != TypeCache.end())
+ return DIType(I->second);
+ if (TREE_CODE(TyDef) == TYPE_DECL && DECL_ORIGINAL_TYPE(TyDef)) {
+ expanded_location TypeDefLoc = GetNodeLocation(TyDef);
+ Ty = DebugFactory.CreateDerivedType(DW_TAG_typedef, findRegion(TyDef),
+ GetNodeName(TyDef),
getOrCreateCompileUnit(TypeDefLoc.file),
TypeDefLoc.line,
0 /*size*/,
@@ -728,8 +743,7 @@
0 /*offset */,
0 /*flags*/,
MainTy);
- // Set the slot early to prevent recursion difficulties.
- TypeCache[type] = Ty;
+ TypeCache[TyDef] = Ty.getNode();
return Ty;
}
}
@@ -759,7 +773,7 @@
MainTy);
if (TYPE_VOLATILE(type) || TYPE_READONLY(type)) {
- TypeCache[type] = Ty;
+ TypeCache[type] = Ty.getNode();
return Ty;
}
@@ -779,17 +793,13 @@
if (TREE_CODE(type) == VOID_TYPE) return DIType();
// Check to see if the compile unit already has created this type.
- DIType &Slot = TypeCache[type];
- if (!Slot.isNull())
- return Slot;
-
+ std::map<tree_node *, MDNode *>::iterator I = TypeCache.find(type);
+ if (I != TypeCache.end())
+ return DIType(I->second);
+
DIType MainTy;
- if (type != TYPE_MAIN_VARIANT(type)) {
- if (TYPE_NEXT_VARIANT(type) && type != TYPE_NEXT_VARIANT(type))
- MainTy = getOrCreateType(TYPE_NEXT_VARIANT(type));
- else if (TYPE_MAIN_VARIANT(type))
- MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type));
- }
+ if (type != TYPE_MAIN_VARIANT(type) && TYPE_MAIN_VARIANT(type))
+ MainTy = getOrCreateType(TYPE_MAIN_VARIANT(type));
DIType Ty = createVariantType(type, MainTy);
if (!Ty.isNull())
@@ -809,7 +819,7 @@
case REFERENCE_TYPE:
Ty = createPointerType(type);
break;
-
+
case OFFSET_TYPE: {
// gen_type_die(TYPE_OFFSET_BASETYPE(type), context_die);
// gen_type_die(TREE_TYPE(type), context_die);
@@ -844,7 +854,7 @@
Ty = createBasicType(type);
break;
}
- TypeCache[type] = Ty;
+ TypeCache[type] = Ty.getNode();
return Ty;
}
@@ -870,7 +880,7 @@
bool isMain) {
if (!FullPath)
FullPath = main_input_filename;
- GlobalVariable *&CU = CUCache[FullPath];
+ MDNode *&CU = CUCache[FullPath];
if (CU)
return DICompileUnit(CU);
@@ -911,6 +921,6 @@
version_string, isMain,
optimize, "",
ObjcRunTimeVer);
- CU = NewCU.getGV();
+ CU = NewCU.getNode();
return NewCU;
}
Modified: gcc-plugin/trunk/llvm-debug.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-debug.h?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-debug.h (original)
+++ gcc-plugin/trunk/llvm-debug.h Wed Sep 2 05:38:07 2009
@@ -56,8 +56,8 @@
const char *PrevFullPath; // Previous location file encountered.
int PrevLineNo; // Previous location line# encountered.
BasicBlock *PrevBB; // Last basic block encountered.
- std::map<std::string, GlobalVariable *> CUCache;
- std::map<tree_node *, DIType> TypeCache;
+ std::map<std::string, MDNode *> CUCache;
+ std::map<tree_node *, MDNode *> TypeCache;
// Cache of previously constructed
// Types.
std::vector<DIDescriptor> RegionStack;
Modified: gcc-plugin/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-internal.h?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-internal.h (original)
+++ gcc-plugin/trunk/llvm-internal.h Wed Sep 2 05:38:07 2009
@@ -442,12 +442,6 @@
Value *EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align);
Value *EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align);
- /// EmitSjLjDispatcher - Emit SJLJ EH dispatcher
- void EmitSjLjDispatcher();
-
- /// EmitSjLjLandingPads - Emit SJLJ EH landing pads.
- void EmitSjLjLandingPads();
-
/// EmitLandingPads - Emit EH landing pads.
void EmitLandingPads();
Modified: gcc-plugin/trunk/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-types.cpp?rev=80777&r1=80776&r2=80777&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-types.cpp (original)
+++ gcc-plugin/trunk/llvm-types.cpp Wed Sep 2 05:38:07 2009
@@ -724,8 +724,8 @@
case 128:
#ifdef TARGET_POWERPC
return SET_TYPE_LLVM(type, Type::getPPC_FP128Ty(Context));
-#elif 0
- // This is for IEEE double extended, e.g. Sparc
+#elif defined(TARGET_ZARCH) || defined(TARGET_CPU_sparc) // FIXME: Use some generic define.
+ // This is for IEEE double extended, e.g. Sparc
return SET_TYPE_LLVM(type, Type::getFP128Ty(Context));
#else
// 128-bit long doubles map onto { double, double }.
More information about the llvm-commits
mailing list