[LLVMbugs] [Bug 4625] New: cpp backend does not support new API (LLVMContext, etc)

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Jul 26 07:39:20 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4625

           Summary: cpp backend does not support new API (LLVMContext, etc)
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: extremal.ik at gmail.com
                CC: llvmbugs at cs.uiuc.edu


; ModuleID = 'test.bc'

define void @test(i32 %value) nounwind  {
entry:
    %tmp0 = icmp eq i32 %value, 0
    ret void
}

after llvm-as and llc -march=cpp calling we have this C++ code:

// Generated by llvm2cpp - DO NOT MODIFY!


Module* makeXorEncryptModule(Module *mod) {

mod->setModuleIdentifier("test.ll.bc");

// Type Definitions
std::vector<const Type*>FuncTy_0_args;
FuncTy_0_args.push_back(IntegerType::get(32));
FunctionType* FuncTy_0 = FunctionType::get(
  /*Result=*/Type::VoidTy,
  /*Params=*/FuncTy_0_args,
  /*isVarArg=*/false);


// Function Declarations

Function* func_test = Function::Create(
  /*Type=*/FuncTy_0,
  /*Linkage=*/GlobalValue::ExternalLinkage,
  /*Name=*/"test", mod); 
func_test->setCallingConv(CallingConv::C);
AttrListPtr func_test_PAL;
{
  SmallVector<AttributeWithIndex, 4> Attrs;
  AttributeWithIndex PAWI;
  PAWI.Index = 4294967295U; PAWI.Attrs = 0  | Attribute::NoUnwind;
  Attrs.push_back(PAWI);
  func_test_PAL = AttrListPtr::get(Attrs.begin(), Attrs.end());

}
func_test->setAttributes(func_test_PAL);

// Global Variable Declarations


// Constant Definitions
ConstantInt* const_int32_1 = ConstantInt::get(APInt(32,  "0", 1, 10));

// Global Variable Definitions

// Function Definitions

// Function: test (func_test)
{
  Function::arg_iterator args = func_test->arg_begin();
  Value* int32_value = args++;
  int32_value->setName("value");

  BasicBlock* label_entry = BasicBlock::Create("entry",func_test,0);

  // Block entry (label_entry)
  ICmpInst* int1_tmp0 = new ICmpInst(ICmpInst::ICMP_EQ, int32_value,
const_int32_1, "tmp0", label_entry);
  ReturnInst::Create(label_entry);

}

return mod;

}

This code valid for llvm 2.5, but not for top-of-tree(for example
ConstantInt::get call at line 39 is obsolete).


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list